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: Keith David Bershatsky
Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables?
Date: Sun, 31 Mar 2019 09:32:35 -0700

Thank you, Alan.  I was unaware that there are other means of declaring 
buffer-local variables in C.

In a few areas of the code for the features that I am working on, I have 
statements such as:

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

I have been using the existing method in buffer.c/h to define buffer local 
variables for the past three years (while chiseling away at the multiple fake 
cursors feature).  The last proof concept patch applied to an Emacs version 
from 12/13/2018, and I am just about ready to submit a new proof concept patch 
for a current version of Emacs.

If there is a way to increase the maximum number of buffer local variables to 
continue using the same method as is done in buffer.c/h, then I would prefer to 
do that.  If not, then the method you suggested below could be fallback plan.  
Other than personal preference and my existing code that has worked well up 
until recently, there is no pressing reason that it has to be done a certain 
way.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [03-31-2019 05:22:38] <31 Mar 2019 12:22:38 +0000>
> From: Alan Mackenzie <address@hidden>
> 
> You're surely aware that you can add a new local variable in C source by
> declaring it with DEFVAR, then calling Fmake_variable_buffer_local in
> syms_of_foo?  Or something like that (I've forgotten the exact details).
> 
> Is there some pressing reason why the new variable has to be part of
> struct buffer rather than an "ordinary" buffer local?
> 
> It's worth noting that there's nothing in the elisp manual about how to
> create buffer local variables in the C source.
> 
> It may be that there're BL variables in struct buffer that don't really
> need to be there, and could be converted to "ordinary" variables.  I
> think I might have added one or two of these myself, but don't remember.



reply via email to

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