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


Message #11 received at 53294 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Hyatt <ahyatt <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 53294 <at> debbugs.gnu.org
Subject: Re: bug#53294: 29.0.50; Indirect font changes incorrectly affecting
 original buffer
Date: Sun, 16 Jan 2022 09:43:16 -0500
On Sun, Jan 16, 2022 at 11:22 AM Eli Zaretskii <eliz <at> gnu.org> 
wrote: 

>> From: Andrew Hyatt <ahyatt <at> 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.




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

Previous Next


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