From: "Aurélien Aptel" <aurelien.aptel+emacs@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Alan Mackenzie <acm@muc.de>,
Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: In C code, how do I create and access a (lisp) variable?
Date: Thu, 5 Nov 2015 12:28:09 +0100 [thread overview]
Message-ID: <CA+5B0FN=4=kkXv_RgY1dDskPBv5MjLLY=vWQ6yebzLiYwr6ZuA@mail.gmail.com> (raw)
In-Reply-To: <87y4ed72rr.fsf@igel.home>
On Thu, Nov 5, 2015 at 12:39 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes:
>
>> I think you're supposed to use DEFVAR_PER_BUFFER for definition and
>> BVAR for access.
>
> DEFVAR_PER_BUFFER and BVAR are only for variables that are part of
> struct buffer. An ordinary variable can be made buffer-local even if
> not part of struct buffer.
Correct. A similar question was asked (and answered) in emacs-devel.
Here's the link the archived thread (look for Stephan replies).
https://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00578.html
I'll quote him:
>> (defvar-local undo-buffer-undoably-changed nil
>> "Non-nil means that that the buffer has had a recent undo-able change.
>
> This macroexpands to defvar + make-variable-buffer-local.
>
> In C defvar turns into DEFVAR_LISP, and make-variable-buffer-local turns
> into Fmake_variable_buffer_local.
And
>> Fsetq(Qfontification_functions,Qt)
>
> BTW, one notable difference (other than performance) between
>
> Fset (Qfontification_functions, Qt);
> and
> Vfontification_functions = Qt;
>
> is that the former will obey make-variable-buffer-local while the
> latter won't. So if you want the var to be buffer-local, either use the
> former, or make sure to call Fmake_local_variable explicitly at
> some point.
next prev parent reply other threads:[~2015-11-05 11:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-04 21:04 In C code, how do I create and access a (lisp) variable? Alan Mackenzie
2015-11-04 21:20 ` Aurélien Aptel
2015-11-04 23:39 ` Andreas Schwab
2015-11-05 11:28 ` Aurélien Aptel [this message]
2015-11-05 16:43 ` Alan Mackenzie
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='CA+5B0FN=4=kkXv_RgY1dDskPBv5MjLLY=vWQ6yebzLiYwr6ZuA@mail.gmail.com' \
--to=aurelien.aptel+emacs@gmail.com \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=schwab@linux-m68k.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.
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.