emacs-devel
[Top][All Lists]
Advanced

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

Re: buffer.c/buffer.h: How to add new buffer-local variables?


From: Stefan Monnier
Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables?
Date: Sun, 31 Mar 2019 16:02:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> if (!NILP (BVAR (XBUFFER (w->contents), crosshairs))) ...

Buffer-local variables are appropriate in the `struct buffer` when it's
likely that most buffers will have their own setting for it.

For variables that are likely to be used only in some particular
buffers, or only under some particular circumstances, it can make a lot
more sense to declare them as global variables and then rely on the
Elisp side using `make-local-variable` or `make-variable-buffer-local`,
so you don't pay for that slot in every buffer even tho it's almost
never used.


        Stefan




reply via email to

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