unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Andrew Hyatt <ahyatt@gmail.com>, 53294@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	[thread overview]
Message-ID: <jwv1r17hase.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83ilujy9fi.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 16 Jan 2022 17:41:53 +0200")

>> > 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






  reply	other threads:[~2022-01-16 17:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16  5:13 bug#53294: 29.0.50; Indirect font changes incorrectly affecting original buffer Andrew Hyatt
2022-01-16  9:22 ` Eli Zaretskii
2022-01-16 14:43   ` Andrew Hyatt
2022-01-16 15:00     ` Eli Zaretskii
2022-01-16 15:28       ` Andrew Hyatt
2022-01-16 15:41         ` Eli Zaretskii
2022-01-16 17:11           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-01-16 18:16             ` Eli Zaretskii
2022-01-16 21:41               ` Andrew Hyatt
2022-01-17 21:47               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-18  2:24                 ` Andrew Hyatt
2022-01-18  2:47                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-19  2:37                     ` Andrew Hyatt
2022-01-19  3:42                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-20 13:42                         ` Lars Ingebrigtsen
2022-02-16 17:41 ` Anders Johansson
2022-02-17 11:41   ` Lars Ingebrigtsen
2022-02-17 13:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv1r17hase.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=53294@debbugs.gnu.org \
    --cc=ahyatt@gmail.com \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).