From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: buffer-local-value confusion
Date: Wed, 08 Oct 2014 09:29:53 +0200 [thread overview]
Message-ID: <87y4srqary.fsf@gmail.com> (raw)
In-Reply-To: 87k34bxf52.fsf@ericabrahamsen.net
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> I have defined a buffer-local variable like this:
>
> (defvar nngnorb-attachment-file-list nil)
> (make-variable-buffer-local 'nngnorb-attachment-file-list)
>
> I'm first setting a value for it in the buffer referred to by
> nnir-tmp-buffer, then trying to copy that buffer-local value to a
> different buffer. Here's what I'm seeing, which confuses me:
>
> (with-current-buffer (get-buffer nnir-tmp-buffer)
> nngnorb-attachment-file-list) --> proper, populated value
>
> (buffer-local-value
> nngnorb-attachment-file-list
> (get-buffer nnir-tmp-buffer)) --> nil
>
> I thought this was the whole point of buffer-local-value? Am I doing it
> wrong?
>
> On the other hand, using with-current-buffer is almost precisely the
> same number of characters as buffer-local-value, so maybe there's no
> point in insisting on the latter...
you might want to look at
,----[ C-h f org-get-local-variables RET ]
| org-get-local-variables is a compiled Lisp function in `org.el'.
|
| (org-get-local-variables)
|
| Return a list of all local variables in an Org mode buffer.
|
| [back]
`----
,----[ C-h f org-clone-local-variables RET ]
| org-clone-local-variables is a compiled Lisp function in `org.el'.
|
| (org-clone-local-variables FROM-BUFFER &optional REGEXP)
|
| Clone local variables from FROM-BUFFER.
| Optional argument REGEXP selects variables to clone.
|
| [back]
`----
and orgstruct++ in general, because it does exactly that - create an tmp
Org buffer and then transfer the buffer local environment temporarily to
the source-code buffer where an Org cmd is run.
--
cheers,
Thorsten
next prev parent reply other threads:[~2014-10-08 7:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 6:13 buffer-local-value confusion Eric Abrahamsen
2014-10-08 7:29 ` Thorsten Jolitz [this message]
[not found] <mailman.10699.1412748865.1147.help-gnu-emacs@gnu.org>
2014-10-08 7:27 ` Marco Wahl
2014-10-08 7:34 ` Eric Abrahamsen
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=87y4srqary.fsf@gmail.com \
--to=tjolitz@gmail.com \
--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).