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

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

Re: turning line mode on/off with defun not working


From: Wes James
Subject: Re: turning line mode on/off with defun not working
Date: Fri, 6 Dec 2013 16:05:06 -0700

On Fri, Dec 6, 2013 at 3:35 PM, Emanuel Berg <embe8573@student.uu.se> wrote:

> Emanuel Berg <embe8573@student.uu.se> writes:
>
> > No, that seems not to be local (?). Well, the way I did
> > it with `lines' above, that works, so use that if you
> > want it the way I describe it.
>
> This was a bit confusing:
>
> (line-number-mode 1)
> (line-number-mode 0)
> (set-variable 'line-number-mode t t)
> (set-variable 'line-number-mode nil t)
>
> It would seem like the first two lines work on the
> global scope, only, once you have run either of lines
> three and four, the first two lines seem to work on the
> local instance instead. Well, lines three and four work
> on the *variable*, which they locally set to the given
> value. In lines one and two, I just pass an argument 1
> or 0 to the *function*. I guess the correct place to
> examine this would be that function (so there is a
> mode, a function, *and* a variable with the same name)
> and see if it somehow changes behaviour based on the
> existence of a local instance, *or* if this is deeper
> in the Emacs architecture: it wouldn't be a chock if
> local instances take precedence. Well, perhaps someone
> could tell us (me) straight off?
>
>
 Thanks for the mini tutorial.

I was able to change the line on/off with:

(defun lt()
  "Toggle line numbers on/off"
  (interactive)
  (global-linum-mode)
)

I just do M-x and type "lt" to do line number toggling on and off.

Bye the way, I've seen some code with (defun name "space" ().....)

Should there be a space after the defun name or not for style
recommendation? It seems to work either way:

(defun name ()...)  or (defun name()...)

Thanks again,

-wes


reply via email to

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