all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Davis Herring" <herring@lanl.gov>
To: "MON KEY" <monkey@sandpframing.com>
Cc: emacs-devel@gnu.org
Subject: Re: with a fresh emacs "(buffer-local-value fundamental-mode   (current-buffer))" error.
Date: Thu, 9 Apr 2009 08:26:57 -0700 (PDT)	[thread overview]
Message-ID: <33049.128.165.123.18.1239290817.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <d2afcfda0904081931n1f0d48fbo1253c6af08cd4bbc@mail.gmail.com>

>> First, you need to quote your variable names:
> Prob. but in this case, once the variable is set (evaluated) I don't :P
>
> (longlines-mode)
> (buffer-local-value longlines-mode (current-buffer)) => t
> (longlines-mode)
> (buffer-local-value longlines-mode (current-buffer)) => nil

Because you are only using (current-buffer), you are missing something
rather important.  `buffer-local-value' is a function, so its arguments
are evaluated before it is even called.  What you have done is equivalent
to

(buffer-local-value 't (current-buffer))
(buffer-local-value 'nil (current-buffer))

because t and nil are the values that `longlines-mode' has each time you
check.  (Of course, you do not normally quote t and nil, but this is the
formally equivalent thing.)

Since t and nil are constants that are their own values (which is why you
don't quote them!), their value in any buffer is themselves, so you just
get them back from `buffer-local-value'.  If you try doing something like

(longlines-mode)
(buffer-local-value longlines-mode (get-buffer-create "*other*"))
(longlines-mode)
(buffer-local-value longlines-mode (get-buffer-create "*other*"))

you will _still_ get t and then nil, because the other buffer is entirely
irrelevant to the _value_ of `longlines-mode' (which is implicitly derived
from the current buffer).  If instead you try

(longlines-mode)
(buffer-local-value 'longlines-mode (get-buffer-create "*other*"))
(longlines-mode)
(buffer-local-value 'longlines-mode (get-buffer-create "*other*"))

...you will get nil twice, because calling `longlines-mode' in this buffer
doesn't change its value in *other*.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




  parent reply	other threads:[~2009-04-09 15:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 21:58 with a fresh emacs "(buffer-local-value fundamental-mode (current-buffer))" error MON KEY
2009-04-08 22:15 ` Jason Rumney
2009-04-09  2:22   ` MON KEY
2009-04-09  5:12     ` Kevin Rodgers
2009-04-08 22:32 ` Davis Herring
     [not found]   ` <d2afcfda0904081931n1f0d48fbo1253c6af08cd4bbc@mail.gmail.com>
2009-04-09 15:26     ` Davis Herring [this message]
     [not found]       ` <d2afcfda0904091341j6b1194a1ifb522b99535139f9@mail.gmail.com>
2009-04-09 22:42         ` Davis Herring
2009-04-10  3:12           ` MON KEY
2009-04-16 21:49             ` Davis Herring
2009-04-10 16:53           ` MON KEY
2009-04-10 17:38             ` Chong Yidong
2009-04-10 22:10               ` Stefan Monnier
2009-04-16 21:29                 ` Davis Herring

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

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

  git send-email \
    --in-reply-to=33049.128.165.123.18.1239290817.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=emacs-devel@gnu.org \
    --cc=monkey@sandpframing.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.