aidylewis aidylewis - 1 year ago 122
Bash Question

Disable line-numbers in Emacs multi-term

I have global line numbers set in Emacs 24.5, but I wondered if it was possible to disable line-numbers only in a multi-term shell?

Answer Source

I don't know anything about multi-term, but if that's using term underneath then the following will do the trick:

(add-hook 'term-mode-hook 'my-inhibit-global-linum-mode)

(defun my-inhibit-global-linum-mode ()
  "Counter-act `global-linum-mode'."
  (add-hook 'after-change-major-mode-hook
            (lambda () (linum-mode 0))
            :append :local))

This simply turns the buffer-local mode off again after it's been turned on. See also automatically disable a global minor mode for a specific major mode for more information and alternative approaches.