From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: buffer-local-value confusion Date: Wed, 08 Oct 2014 09:29:53 +0200 Message-ID: <87y4srqary.fsf@gmail.com> References: <87k34bxf52.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412753455 1876 80.91.229.3 (8 Oct 2014 07:30:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Oct 2014 07:30:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 08 09:30:47 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xblhv-0006mz-B5 for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Oct 2014 09:30:47 +0200 Original-Received: from localhost ([::1]:34672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xblhv-0005qC-04 for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Oct 2014 03:30:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XblhU-0005gU-7R for help-gnu-emacs@gnu.org; Wed, 08 Oct 2014 03:30:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XblhO-0008Ki-2l for help-gnu-emacs@gnu.org; Wed, 08 Oct 2014 03:30:20 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:38309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XblhN-0008KM-Su for help-gnu-emacs@gnu.org; Wed, 08 Oct 2014 03:30:14 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XblhL-00068E-9H for help-gnu-emacs@gnu.org; Wed, 08 Oct 2014 09:30:11 +0200 Original-Received: from g231108194.adsl.alicedsl.de ([92.231.108.194]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Oct 2014 09:30:11 +0200 Original-Received: from tjolitz by g231108194.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Oct 2014 09:30:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231108194.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:JZf9m2JCcy5Q0VFlFzRJqCwvfzk= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100338 Archived-At: Eric Abrahamsen 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