emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 16/16] Remove usage of buffer_local_flags


From: Eli Zaretskii
Subject: Re: [PATCH v2 16/16] Remove usage of buffer_local_flags
Date: Tue, 01 Dec 2020 20:05:07 +0200

> From: Spencer Baugh <sbaugh@catern.com>
> Date: Sat, 21 Nov 2020 21:34:45 -0500
> Cc: Spencer Baugh <sbaugh@catern.com>, Arnold Noronha <arnold@tdrhq.com>,
>  Stefan Monnier <monnier@iro.umontreal.ca>, Dmitry Gutov <dgutov@yandex.ru>
> 
> Previously, we used the buffer_local_flags structure to track which
> fields in buffer_defaults contain usable defaults, as well as the
> index into local_flags to use for each struct buffer field.
> 
> After the immediate previous commit, we don't need the index into
> local_flags anymore.  So all we need is to know whether the fields in
> buffer_defaults contain usable defaults.  We can do that by just
> setting unusable and unused buffer_defaults fields to Qunbound. Then
> we can delete buffer_local_flags.
> 
> In these changes, we delete buffer_local_flags and ensure that
> buffer_defaults is initialized appropriately for this new usage.

Looks like some of the previous patches made changes in parts that are
being deleted here.  Let's skip such unnecessary intermediate steps,
okay?

> +   Slots in this structure which are set to Qunbound are permanently
> +   buffer-local. */

I thought the value of _any_ buffer-local variable starts Qunbound,
no?  Why only permanently buffer-local ones?

> +  int offset;
> +  FOR_EACH_PER_BUFFER_OBJECT_AT (offset)
> +    {
> +      /* These are initialized before us. */
> +      if (!(offset == PER_BUFFER_VAR_OFFSET (syntax_table)
> +            || offset == PER_BUFFER_VAR_OFFSET (category_table)))
> +        set_per_buffer_default (offset, Qunbound);
> +    }
> +  set_per_buffer_default (PER_BUFFER_VAR_OFFSET (undo_list), Qunbound);

This again special-cases 2 variables, something I'd like to avoid.

> -  bset_undo_list (&buffer_defaults, Qnil);
> -  bset_mark_active (&buffer_defaults, Qnil);
> -  bset_file_format (&buffer_defaults, Qnil);
> -  bset_auto_save_file_format (&buffer_defaults, Qt);
> -  set_buffer_overlays_before (&buffer_defaults, NULL);
> -  set_buffer_overlays_after (&buffer_defaults, NULL);
> -  buffer_defaults.overlay_center = BEG;

Why are these being removed?

> -  bset_enable_multibyte_characters (&buffer_defaults, Qt);
>    bset_buffer_file_coding_system (&buffer_defaults, Qnil);
>    XSETFASTINT (BVAR_DIRECT (&buffer_defaults, fill_column), 70);
>    XSETFASTINT (BVAR_DIRECT (&buffer_defaults, left_margin), 0);
>    bset_cache_long_scans (&buffer_defaults, Qt);
> -  bset_file_truename (&buffer_defaults, Qnil);

And these?

> -  bset_display_time (&buffer_defaults, Qnil);

And this one?

> @@ -1478,7 +1426,7 @@ set_per_buffer_value (struct buffer *b, int offset, 
> Lisp_Object value)
>  INLINE bool
>  BUFFER_DEFAULT_VALUE_P (int offset)
>  {
> -  return PER_BUFFER_IDX (offset) > 0;
> +  return !EQ (per_buffer_default (offset), Qunbound);

Another function call where previously we just called a simple macro.

Thanks.



reply via email to

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