disable linum-mode in other buffers, like eshell, compilation

384 views
Skip to first unread message

z.cHris

unread,
Jul 13, 2010, 5:25:53 AM7/13/10
to
Hi,

I use linum-mode almost all the time, so i use (global-linum-mode t),
but i don't want to use it in eshell mode, compilation mode, etc. in
which the line number is useless.

And also, when i use linum-mode in eshell or compilation mode, if a
long line is printed, the cursor is paused in first lines, never
scroll screen to the end of that line.

I use
(add-hook 'eshell-mode-hook
'(lambda () (linum-mode nil)))

but can't work, is anyone know how to solve this problem?

Thanks for your time.

br,
Chris

Xah Lee

unread,
Jul 13, 2010, 5:42:16 AM7/13/10
to

if you want to turn it off, you should use 0, not nil. See:

• Emacs: How to Turn a Minor Mode on/off/toggle?
http://xahlee.org/emacs/emacs-tip_mode_on_off_toggle.html

try that see if it address the problem. If that doesn't work, i
suspect it might be a bug, of the inter-relations of the global vs non-
global version...

instead of turning it off for particular modes, possibly more
practical is to turn it on for text related modes.

e.g.

(defun turn-spell-checking-on ()
"Turn speck-mode or flyspell-mode on."
(flyspell-mode 1)
)

(add-hook 'text-mode-hook 'turn-spell-checking-on)

Xah
http://xahlee.org/


z.cHris

unread,
Jul 14, 2010, 12:41:12 AM7/14/10
to
i tried, but it can't work.

i also have tried to use (linum-mode 1) in certain mode like c,
without using the (global-linum-mode t), but i never see linum in c
files.

i think maybe there are some thing wrong in (global-linum-mode t),
because i firstly set it, and later in other mode, disable linum-mode
would be failed.

Xah Lee

unread,
Jul 14, 2010, 12:58:50 AM7/14/10
to

you are right.

i just tried open a new buffer type something to get some lines and
set it to c-mode and turn on linum-mode, and no line num shows.
However, using global-linum-mode shows the lin nums.

must be a bug. Reporting the bug would probably be helpful.

Xah

Reply all
Reply to author
Forward
0 new messages