How to disable the hl-line function in the specified mode

i enable hl mode in global scope using the following code.

(global-hl-line-mode t) 

disable the hl-line function in the specified mode. I am doing this with the following code.

 (add-hook 'org-mode-hook (lambda () (global-hl-line-mode 0))) 

but it disables the hl-line function for the global area.

How to disable the hl-line function in the specified mode?

+6
source share
3 answers

The frequency of information and documentation in Commentary in the source file.

 [...] ;; You could make variable `global-hl-line-mode' buffer-local and set ;; it to nil to avoid highlighting specific buffers, when the global ;; mode is used. [...] 

That way you can put something like this in your .emacs .

 (global-hl-line-mode) (make-variable-buffer-local 'global-hl-line-mode) (add-hook 'some-mode-hook (lambda () (setq global-hl-line-mode nil))) ... 
+9
source

use hl-line-mode insted global-hl-line-mode .

EDIT: You are right. This does not work.

The comment says the global mode is not intended to be used. I accept this means that you cannot selectively turn it off after turning it on.

I turn on hl-line-mode in the main modes where I need it.

+1
source

write the following line in the dotEmacs file and use f5 to switch hl-line-mode

(global-set-key [f5] 'hl-line-mode)

0
source

Source: https://habr.com/ru/post/912304/


All Articles