unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Wes James <comptekki@gmail.com>
To: Emanuel Berg <embe8573@student.uu.se>
Cc: help-gnu-emacs@gnu.org
Subject: Re: turning line mode on/off with defun not working
Date: Fri, 6 Dec 2013 16:05:06 -0700	[thread overview]
Message-ID: <CAFjCMHvTiBN1Ge=udH4sA+a3v8zow_stiMTaqgQdWAU+wm1yog@mail.gmail.com> (raw)
In-Reply-To: <8738m5sj39.fsf@nl106-137-194.student.uu.se>

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	other threads:[~2013-12-06 23:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.8198.1386264536.10748.help-gnu-emacs@gnu.org>
2013-12-06 18:35 ` turning line mode on/off with defun not working Emanuel Berg
2013-12-06 19:21   ` Wes James
     [not found]   ` <mailman.8418.1386360511.10748.help-gnu-emacs@gnu.org>
2013-12-06 21:35     ` Emanuel Berg
2013-12-06 21:42       ` Emanuel Berg
2013-12-06 22:35         ` Emanuel Berg
2013-12-06 23:05           ` Wes James [this message]
2013-12-06 23:16             ` Emanuel Berg
2013-12-07  9:06               ` PJ Weisberg
     [not found]               ` <mailman.8440.1386407185.10748.help-gnu-emacs@gnu.org>
2013-12-07 13:28                 ` Emanuel Berg
2013-12-05 18:42 Wes James
2013-12-05 18:48 ` Drew Adams
2013-12-05 19:00   ` Wes James
  -- strict thread matches above, loose matches on Subject: below --
2013-12-05 17:28 Wes James
2013-12-05 17:31 ` Drew Adams
2013-12-05 17:54   ` Wes James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFjCMHvTiBN1Ge=udH4sA+a3v8zow_stiMTaqgQdWAU+wm1yog@mail.gmail.com' \
    --to=comptekki@gmail.com \
    --cc=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).