help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Does emacs have a line numbering feature?


From: Drew Adams
Subject: RE: Does emacs have a line numbering feature?
Date: Sun, 9 Sep 2007 15:58:54 -0700

> >>> (setq line-number-mode t)
> >>> (setq column-number-mode t)
> >> Yeah, I already had that in, and it works.  However, if I do something
> >> similar for linum-mode, it seems to just ignore it.
> >
> > Yes, because setting a minor mode variable to activate it is the wrong
> > thing to do.  It might work sometimes, but generally you should either
> > customize the variable or use the minor mode function.  So the code
> > above should better be
> >
> >   (line-number-mode 1)
> >   (column-number-mode 1)
> >
> > because by convention a minor mode is turned on if the argument is
> > positive.
> >
>
> Okay... I tried that, too, for linum-mode, and it doesn't work.  Am I
> missing something obvious or am I an idiot?  :-P

Linum mode is a local minor mode: turning it on does so only for the current
buffer.

Are you using Emacs 22? If so, then you can define a different command,
`global-linum-mode', as follows (after loading linum.el):

(define-globalized-minor-mode global-linum-mode
   linum-mode (lambda nil (linum-mode 1)))

Then just put this in your .emacs: (global-linum-mode 1).

You can toggle line numbering in all buffers at once using command
`global-linum-mode'. Even the minibuffer is affected, which might not be
what you want.

You might ask Markus to add this command to the library.

If you don't have Emacs 22, then you will probably need to turn on the
(local) mode in each buffer, using a hook.

HTH.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]