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

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

Re: buffer-local-value confusion


From: Thorsten Jolitz
Subject: Re: buffer-local-value confusion
Date: Wed, 08 Oct 2014 09:29:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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




reply via email to

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