[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: |
Keith David Bershatsky |
Subject: |
Re: buffer.c/buffer.h: How to add new buffer-local variables? |
Date: |
Mon, 01 Apr 2019 00:43:42 -0700 |
Thank you, Stefan, for the insight regarding how to handle this particular
issue. Greatly appreciated!
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 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
>
>> 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
- Re: buffer.c/buffer.h: How to add new buffer-local variables?,
Keith David Bershatsky <=