unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Hyatt <ahyatt@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 53294@debbugs.gnu.org
Subject: bug#53294: 29.0.50; Indirect font changes incorrectly affecting original buffer
Date: Sun, 16 Jan 2022 09:43:16 -0500	[thread overview]
Message-ID: <m2v8yjbv23.fsf@andrews-mbp.lan> (raw)
In-Reply-To: <835yqkyqzw.fsf@gnu.org>


On Sun, Jan 16, 2022 at 11:22 AM Eli Zaretskii <eliz@gnu.org> 
wrote: 

>> From: Andrew Hyatt <ahyatt@gmail.com> Date: Sun, 16 Jan 2022 
>> 00:13:26 -0500  I noticed a bug recently where if I scale up 
>> fonts in an org  capture buffer, it affects the original 
>> buffer, which keeps  getting bigger and bigger every time 
>> org-capture is run.   However, you don't need org to reproduce 
>> this.  Here's a quick way  to reproduce, which works with emacs 
>> -Q:  (require 'face-remap) (defun ash/big-font ()  
>>   "Creates a font that is big enough for about 20 lines of 
>>   text."  (interactive) (let ((text-scale-mode-amount (/ 
>>   (frame-height)  20)))  
>>     (text-scale-mode 1)))  
>>   
>> (defun ash/reproduce-with-indirect-buffer ()  
>>   (interactive) (let ((buf (get-buffer-create "*Orig 
>>   buffer*")))  
>>     (set-buffer buf) (variable-pitch-mode 1) ;; same way org 
>>     mode  creates indirect buffer (set-buffer 
>>     (make-indirect-buffer buf  "*Indirect buffer*" 'clone)) 
>>     (ash/big-font-new) (kill-buffer  (current-buffer))))  
>>  Running ash/reproduce-with-indirect-buffer will increase the 
>> indirect buffer in size each time.  If you look at 
>> face-remapping-alist, it's clear that the original buffer's 
>> value  is being altered by the indirect buffer. 
> 
> I don't think I understand what I should see and pay attention 
> to with this recipe (and it includes several errors that took me 
> some time to fix, before I could run it), but isn't this because 
> you used non-nil CLONE argument to make-indirect-buffer? 


Sorry for any errors, I simplified it a bit before I sent it out 
and perhaps made a few mistakes. What you should see, if you go 
the *Orig Buffer*, is that the font scale keeps increasing. If you 
look at the face-remapping-alist of that buffer, it will be 
growing with duplicate height specs, one for every time you called 
the ash/reproduce-with-indirect-buffer.

Yes, the non-nil CLONE argument is essential to reproduce. But 
that just means the indirect buffer will inherit the state from 
the direct buffer.  It doesn't imply that changes made to the 
indirect buffer's state will affect the original buffer, which is 
what is happening here.





  reply	other threads:[~2022-01-16 14:43 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 [this message]
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
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=m2v8yjbv23.fsf@andrews-mbp.lan \
    --to=ahyatt@gmail.com \
    --cc=53294@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).