GNU bug report logs - #78957
31.0.50; Wrong mode-line in fancy diary

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Fri, 4 Jul 2025 19:16:02 UTC

Severity: normal

Found in version 31.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: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Eli Zaretskii <eliz <at> gnu.org>, stephen.berman <at> gmx.net, 78957 <at> debbugs.gnu.org
Subject: bug#78957: 31.0.50; Wrong mode-line in fancy diary
Date: Fri, 11 Jul 2025 13:44:20 +0200
martin rudalics <rudalics <at> gmx.at> writes:

>  > Martin, any comments to the patch, with emphasis on its safety?
>
> If the patch is this one
>
> diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
> index 917624c489e..8b7aa71db93 100644
> --- a/lisp/calendar/calendar.el
> +++ b/lisp/calendar/calendar.el
> @@ -1168,8 +1168,9 @@ calendar-in-read-only-buffer
>              buffer-undo-list t)
>        (erase-buffer)
>        (display-buffer ,buffer)
> -     ,@body
> -     (goto-char (point-min))
> +     (with-selected-window (get-buffer-window ,buffer)
> +       ,@body
> +       (goto-char (point-min)))
>        (set-buffer-modified-p nil)
>        (setq buffer-read-only t)))
> Switch to BUFFER
> then I would write it as
>
> diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
> index 917624c489e..67764eb0b26 100644
> --- a/lisp/calendar/calendar.el
> +++ b/lisp/calendar/calendar.el
> @@ -1167,9 +1167,11 @@ calendar-in-read-only-buffer
>        (setq buffer-read-only nil
>              buffer-undo-list t)
>        (erase-buffer)
> -     (display-buffer ,buffer)
> -     ,@body
> -     (goto-char (point-min))
> +     (let ((window (display-buffer ,buffer)))
> +       (when window
> +	 (with-selected-window window
> +	   ,@body
> +	   (goto-char (point-min)))))
>        (set-buffer-modified-p nil)
>        (setq buffer-read-only t)))
>
> which selects the correct window if there is one.

So, there is something I missed with both patches.  After a complete
rebuild of Emacs with the patch, the misalignment in the mode-line is
still there.  But if afterward, I `load-file' "calendar.el" and then
"diary-lib.el", the misalignment is fixed.  What am I missing?

> But I doubt that it is a good idea to use 'set-buffer' here and talk
> about "Switch to BUFFER" in the first place.

Yes, we'd have to modify the docstring.
-- 
Manuel Giraud




This bug report was last modified 13 days ago.

Previous Next


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