How to disable global minor mode in a separate buffer for emacs

I have smart-tab mode as global minor mode on

(global-smart-tab-mode 1) 

and you want to disable it in eshell mode,

 (add-hook 'eshell-mode-hook (lambda () (smart-tab-mode -1))) 

but it seems that this does not work, and I am sure that this hook is completed. If I manually started (smart-tab-mode -1) in eshell, everything is fine.

I don’t know why, can someone help me, thanks in advance!

+4
source share
2 answers

I believe that deactivating minor mode in eshell-mode-hook and activation caused by global-smart-tab-mode being called in the wrong order.

In recent versions of smart-tab.el there is a smart-tab-disabled-major-modes variable, to which you could add eshell-mode , i.e. (add-to-list 'smart-tab-disabled-major-modes 'eshell-mode) .

+2
source

There are different versions of smart-tab.el around - which one are you using? If the version of John Anderson , you do not need to add a hook, you can simply configure the variable smart-tab-disabled-major-modes by calling

 Mx customize-variable <ENTER> smart-tab-disabled-major-modes <ENTER> 

and then adding "eshell-mode" to the list.

If you are using a version of Daniel Hackney , there is a new function, turn-off-smart-tab-mode , which you can use instead of (smart-tab-mode -1) in the code above.

0
source

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


All Articles