* buffer-local-value confusion
@ 2014-10-08 6:13 Eric Abrahamsen
2014-10-08 7:29 ` Thorsten Jolitz
0 siblings, 1 reply; 4+ messages in thread
From: Eric Abrahamsen @ 2014-10-08 6:13 UTC (permalink / raw
To: help-gnu-emacs
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...
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: buffer-local-value confusion
[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
0 siblings, 1 reply; 4+ messages in thread
From: Marco Wahl @ 2014-10-08 7:27 UTC (permalink / raw
To: help-gnu-emacs
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> (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
Missing quote? E.g.
(buffer-local-value
'nngnorb-attachment-file-list
(get-buffer nnir-tmp-buffer))
HTH, Marco
--
http://www.wahlzone.de
PGP: 0x0A3AE6F2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: buffer-local-value confusion
2014-10-08 6:13 Eric Abrahamsen
@ 2014-10-08 7:29 ` Thorsten Jolitz
0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2014-10-08 7:29 UTC (permalink / raw
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: buffer-local-value confusion
2014-10-08 7:27 ` buffer-local-value confusion Marco Wahl
@ 2014-10-08 7:34 ` Eric Abrahamsen
0 siblings, 0 replies; 4+ messages in thread
From: Eric Abrahamsen @ 2014-10-08 7:34 UTC (permalink / raw
To: help-gnu-emacs
Marco Wahl <marcowahlsoft@gmail.com> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> (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
>
> Missing quote? E.g.
>
> (buffer-local-value
> 'nngnorb-attachment-file-list
> (get-buffer nnir-tmp-buffer))
Dangit, that was it! That's the first time I've run into a
quoted/not-quoted mistake that didn't result in an error, so that didn't
even occur to me.
Thanks!
Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-08 7:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.10699.1412748865.1147.help-gnu-emacs@gnu.org>
2014-10-08 7:27 ` buffer-local-value confusion Marco Wahl
2014-10-08 7:34 ` Eric Abrahamsen
2014-10-08 6:13 Eric Abrahamsen
2014-10-08 7:29 ` Thorsten Jolitz
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.