[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48264: [PATCH v3 07/15] Add BVAR_OR_DEFAULT macro as a stub
From: |
Spencer Baugh |
Subject: |
bug#48264: [PATCH v3 07/15] Add BVAR_OR_DEFAULT macro as a stub |
Date: |
Fri, 07 May 2021 09:05:26 -0400 |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Spencer Baugh <sbaugh@catern.com>
>> Date: Thu, 6 May 2021 17:33:38 -0400
>> Cc: Spencer Baugh <sbaugh@catern.com>
>>
>> For buffer variables without a default, we still use BVAR. For any
>> buffer variable with a default, we use BVAR_OR_DEFAULT. A later
>> commit will statically enforce this.
>
> This part says they are the same:
>
>> --- a/src/buffer.h
>> +++ b/src/buffer.h
>> @@ -284,6 +284,8 @@ struct buffer_text
>>
>> #define BVAR(buf, field) ((buf)->field ## _)
>>
>> +#define BVAR_OR_DEFAULT(buf, field) BVAR (buf, field)
>
> What am I missing here?
The commit message is accurate - we indeed use BVAR for buffer variables
without a default, and BVAR_OR_DEFAULT for buffer variables with a
default.
It's just that in this commit, those two behave identically. The
immediate next commit makes them different.
I split it up in this way because this commit is the result of a big
tree-wide sed, no actual meaningful change; I think it's much easier to
understand the next commit when the two are kept separate.
> Also, I have a question: suppose we have a variable that is defined
> with DEFVAR_LISP, and then some Lisp calls make-variable-buffer-local:
> how will that work with these two macros when the C code needs to
> access the buffer-local value?
Nothing in these changes affect variables that are made into
buffer-locals from Lisp code; these changes only affect variables
built-in to Emacs that were defined with DEFVAR_PER_BUFFER. So that
will just work the same as it does today - accesses to such variables
don't go through BVAR today.
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, (continued)
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Eli Zaretskii, 2021/05/07
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Eli Zaretskii, 2021/05/07
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Eli Zaretskii, 2021/05/08
- bug#48264: [PATCH v3 12/15] Set buffer_defaults fields without a default to Qunbound, Spencer Baugh, 2021/05/08
bug#48264: [PATCH v3 09/15] Remove unnecessary Qunbound check, Spencer Baugh, 2021/05/06
bug#48264: [PATCH v3 07/15] Add BVAR_OR_DEFAULT macro as a stub, Spencer Baugh, 2021/05/06
bug#48264: [PATCH v3 10/15] Get rid of buffer_permanent_local_flags array, Spencer Baugh, 2021/05/06
bug#48264: [PATCH v3 11/15] Delete SET_PER_BUFFER_VALUE_P and buffer local_flags field, Spencer Baugh, 2021/05/06
bug#48264: [PATCH v3 13/15] Assert that PER_BUFFER_IDX for Lisp variables is not 0, Spencer Baugh, 2021/05/06
bug#48264: [PATCH v3 14/15] Remove PER_BUFFER_IDX and buffer_local_flags, Spencer Baugh, 2021/05/06
bug#48264: [PATCH v3 15/15] Add and use BVAR_FIELD macros, Spencer Baugh, 2021/05/06