bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#48264: [PATCH v3 08/15] Set non-buffer-local BVARs to Qunbound


From: Spencer Baugh
Subject: bug#48264: [PATCH v3 08/15] Set non-buffer-local BVARs to Qunbound
Date: Fri, 07 May 2021 08:54:33 -0400

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@catern.com>
>> Date: Thu,  6 May 2021 17:33:39 -0400
>> Cc: Spencer Baugh <sbaugh@catern.com>
>> 
>> --- a/src/buffer.c
>> +++ b/src/buffer.c
>> @@ -54,8 +54,7 @@ along with GNU Emacs.  If not, see 
>> <https://www.gnu.org/licenses/>.  */
>>     defined with DEFVAR_PER_BUFFER, that have special slots in each buffer.
>>     The default value occupies the same slot in this structure
>>     as an individual buffer's value occupies in that buffer.
>> -   Setting the default value also goes through the alist of buffers
>> -   and stores into each buffer that does not say it has a local value.  */
>> +*/
>
> This is a spurious change, please undo it.
>
>> @@ -1107,8 +1109,7 @@ BUFFER_CHECK_INDIRECTION (struct buffer *b)
>>     that have special slots in each buffer.
>>     The default value occupies the same slot in this structure
>>     as an individual buffer's value occupies in that buffer.
>> -   Setting the default value also goes through the alist of buffers
>> -   and stores into each buffer that does not say it has a local value.  */
>> +*/
>
> Likewise.

Not sure what you mean about this being a spurious change - the comment
is no longer accurate, setting the default value no longer does that as
of this commit.

>> +INLINE Lisp_Object
>> +bvar_get (struct buffer *b, ptrdiff_t offset)
>    ^^^^^^^^
> How about calling this buffer_local_value instead? or maybe
> bvar_get_value?

Sure, any name works for me, although buffer_local_value already exists
(and does something different).  I can call it bvar_get_value though.

>> @@ -1511,7 +1519,7 @@ KILL_PER_BUFFER_VALUE (struct buffer *b, int offset)
>>  {
>>    int idx = PER_BUFFER_IDX (offset);
>>    SET_PER_BUFFER_VALUE_P (b, idx, 0);
>> -  set_per_buffer_value (b, offset, per_buffer_default (offset));
>> +  set_per_buffer_value (b, offset, Qunbound);
>>  }
>
> Hmm... I'm probably missing something here: what about per-buffer
> variables that do have default values? how's that implemented in this
> new implementation?

If a variable that does have a default value, then setting the
per-buffer variable to Qunbound will cause BVAR_OR_DEFAULT and bvar_get
to return the default value.

If the variable doesn't have a default value, then it's permanently
buffer-local and it was always unsafe to call KILL_PER_BUFFER_VALUE on
it - but fortunately, we never do that.





reply via email to

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