GNU bug report logs -
#78957
31.0.50; Wrong mode-line in fancy diary
Previous Next
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
> 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.
But I doubt that it is a good idea to use 'set-buffer' here and talk
about "Switch to BUFFER" in the first place.
martin
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.