4

I have enable smart-tab mode as global minor mode by

(global-smart-tab-mode 1)

and want to disable it in eshell-mode,

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

but It seems not work and I'm sure this hook have been executed. If I manually run (smart-tab-mode -1) in eshell, It is OK.

I don't know why, could someone help me, thanks in advance!

Stefan
  • 27,908
  • 4
  • 53
  • 82
netawater
  • 15,214
  • 4
  • 24
  • 21
  • Duplicate of [automatically disable a global minor mode for a specific major mode](http://stackoverflow.com/questions/6837511/automatically-disable-a-global-minor-mode-for-a-specific-major-mode) – phils Oct 13 '15 at 07:32

2 Answers2

2

I suppose the deactivation of the minor mode in eshell-mode-hook and the activation caused by global-smart-tab-mode are called in the wrong order.

Recent versions of smart-tab.el have 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).

Rörd
  • 6,556
  • 21
  • 27
0

There are different versions of smart-tab.el around - which one do you use? If it's John Anderson's version, you don't need to add a hook, you can simply customize the variable smart-tab-disabled-major-modes by invoking

M-x customize-variable <ENTER> smart-tab-disabled-major-modes <ENTER>

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

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

Thomas
  • 17,016
  • 4
  • 46
  • 70