GNU bug report logs - #53294
29.0.50; Indirect font changes incorrectly affecting original buffer

Previous Next

Package: emacs;

Reported by: Andrew Hyatt <ahyatt <at> gmail.com>

Date: Sun, 16 Jan 2022 05:14:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Andrew Hyatt <ahyatt <at> gmail.com>, 53294 <at> debbugs.gnu.org
Subject: bug#53294: 29.0.50; Indirect font changes incorrectly affecting original buffer
Date: Sun, 16 Jan 2022 12:11:39 -0500
>> > But "inheriting" the state means the indirect buffer gets the 
>> > copy of the variables of the original buffer, and that is not a 
>> > deep copy, AFAIU. 
>> > Stefan, any comments on this issue? 
>> Sorry, I may have been unclear. I'm not disagreeing - what you 
>> just said is correct. But, because of that, it's a bug for code to 
>> make an indirect buffer, then perform operations on it via setcdr 
>> or setf like things, which then will affect the original buffer's 
>> variables.
> I'm not sure it's a bug.  It could be a "feature", not limited to
> face-remapping-alist, but instead affecting every buffer-local
> variable that is not a simple scalar.

`make-indirect-buffer` can't do the right thing, indeed, because
different variables need different handling.  `clone-buffer` tries to
handle these issues by relying on `clone-buffer-hook` to handle the
various variables on a case-by-case basis, but `make-indirect-buffer`
doesn't come with such a hook.

Some ways we can fix this:

- In `face-remap.el`, refrain from modifying the `face-remapping-alist`
  by side-effects (i.e. avoid `delq`, `setcdr`, and friends).

- Add a `make-indirect-buffer-hook` and arrange for `face-remap.el` to
  add a function there that does a deep enough copy of
  `face-remapping-alist`.

- Remember that indirect buffers are an attractive nuisance and should
  be deprecated (but note that I suspect the same bug affects
  `clone-buffer` because it doesn't make a deep enough copy of
  `face-remapping-alist` either).


        Stefan





This bug report was last modified 3 years and 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.