GNU bug report logs - #68893
30.0.50; pixel-fill-region errors when folding message headers in Gnus

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Fri, 2 Feb 2024 15:34:01 UTC

Severity: normal

Merged with 67791, 68884

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#67791: closed (30.0.50; `t' command on Gnus summary buffer
 sometimes causes an error)
Date: Sat, 03 Feb 2024 09:13:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 03 Feb 2024 11:11:54 +0200
with message-id <86bk8x52ud.fsf <at> gnu.org>
and subject line Re: bug#68893: 30.0.50; pixel-fill-region errors when folding message headers in Gnus
has caused the debbugs.gnu.org bug report #68893,
regarding 30.0.50; `t' command on Gnus summary buffer sometimes causes an error
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
68893: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68893
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; `t' command on Gnus summary buffer sometimes causes an error
Date: Tue, 12 Dec 2023 11:15:54 +0900
Because the `gnus-article-treat-fold-headers' function does not
work as expected.  `t' command, i.e. `gnus-summary-toggle-header'
is invoked on the Gnus summary buffer, that runs by default
`gnus-article-treat-fold-headers' by way of `gnus-treat-article'.
It works on the article buffer and folds headers with the help of
the pixel-fill functions.  One of them, `pixel-fill-region' uses
the built-in `window-text-pixel-size' function, that is required
to run on the selected window in which there is the text to
measure the pixel size (since `pixel-fill-region' passes nil to
`window-text-pixel-size' as the 1st argument `WINDOW').
,----
| (window-text-pixel-size &optional WINDOW FROM TO ...)
|
| Return the size of the text of WINDOW's buffer in pixels.
| WINDOW must be a live window and defaults to the selected one.
`----
Therefore, the window should be that of the article.  However,
in that situation the selected one is that of the summary, as
mentioned above.  Because of this, the `window-text-pixel-size'
sometimes returns a funny value and it causes the error like
this:

Debugger entered--Lisp error: (error "The indentation (640) is wider than th...
  signal(error ("The indentation (640) is wider than the fill width (623)"))...
  error("The indentation (%s) is wider than the fill width (%s)" 640 623)...
  (progn (error "The indentation (%s) is wider than the fill width (%s)" ind...
  (if (> indentation pixel-width) (progn (error "The indentation (%s) is wid...
  (let ((indentation (car (window-text-pixel-size nil (line-beginning-positi...
  (save-excursion (goto-char start) (let ((indentation (car (window-text-pix...
  pixel-fill-region(101 181 623)
 [...]
  command-execute(gnus-summary-toggle-header)

Another possible cause might be the recent change (33b6de7a)
made in `window-text-pixel-size', because such an error doesn't
look to cause in Emacs 29.1.90 (the function before the change
might possibly have worked on the current buffer, not the
selected window).

Here is a quick hack:

* lisp/gnus/gnus-art.el (gnus-article-treat-fold-headers): Make sure
the article window is selected while running pixel-fill-region.

--8<---------------cut here---------------start------------->8---
--- gnus-art.el~	2023-12-10 23:22:23.410103300 +0000
+++ gnus-art.el	2023-12-12 02:11:11.364620000 +0000
@@ -2240,7 +2240,9 @@
         (if (not (gnus--variable-pitch-p (get-text-property (point) 'face)))
 	    (mail-header-fold-field)
           (forward-char 1)
-          (pixel-fill-region (point) (point-max) (pixel-fill-width)))
+          (save-window-excursion
+            (set-window-buffer nil (current-buffer))
+            (pixel-fill-region (point) (point-max) (pixel-fill-width))))
 	(goto-char (point-max))))))
 
 (defun gnus-article-treat-suspicious-headers ()
--8<---------------cut here---------------end--------------->8---

In GNU Emacs 30.0.50 (build 1, x86_64-pc-cygwin, GTK+ Version
 3.22.28, cairo version 1.17.4) of 2023-12-12 built on localhost
Windowing system distributor 'The Cygwin/X Project', version 11.0.12101008
Configured using:
 'configure 'CFLAGS=-O0 -g3' --verbose
 --infodir=/usr/local/info/emacs --with-x-toolkit=gtk3
 --with-cairo-xcb --with-imagemagick
 --with-native-compilation=no'


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: No Wayman <iarchivedmywholelife <at> gmail.com>
Cc: stephen.berman <at> gmx.net, 68893-done <at> debbugs.gnu.org
Subject: Re: bug#68893: 30.0.50; pixel-fill-region errors when folding
 message headers in Gnus
Date: Sat, 03 Feb 2024 11:11:54 +0200
> From: No Wayman <iarchivedmywholelife <at> gmail.com>
> Cc: Stephen Berman <stephen.berman <at> gmx.net>,  68893 <at> debbugs.gnu.org
> Date: Fri, 02 Feb 2024 16:37:46 -0500
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > No Wayman, does the above fix the problem for you as well?
> >
> > Thanks.
> 
> Yes. That also fixes the issue.

Thanks, I installed on the emacs-29 branch a somewhat different patch,
which uses save-window-excursion _and_ save-excursion, because we also
need to preserve point position in the current buffer.

Let me know if the change causes any further problem.  For now, I'm
closing this bug.


This bug report was last modified 1 year and 112 days ago.

Previous Next


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