Fix mode-line string width in diary view

Bug#78957

* lisp/calendar/calendar.el (calendar-in-read-only-buffer):
Select the buffer window because, for example,
`calendar-set-mode-line' needs it.
This commit is contained in:
Manuel Giraud 2025-07-05 10:56:00 +02:00 committed by Eli Zaretskii
parent 5140e317b7
commit 2846dd8842

View file

@ -1161,17 +1161,20 @@ MON defaults to `displayed-month'. YR defaults to `displayed-year'."
First creates or erases BUFFER as needed. Leaves BUFFER read-only,
with disabled undo. Leaves point at `point-min', displays BUFFER."
(declare (indent 1) (debug t))
`(progn
(set-buffer (get-buffer-create ,buffer))
(or (derived-mode-p 'special-mode) (special-mode))
(setq buffer-read-only nil
buffer-undo-list t)
(erase-buffer)
(display-buffer ,buffer)
,@body
(goto-char (point-min))
(set-buffer-modified-p nil)
(setq buffer-read-only t)))
(let ((window (gensym)))
`(progn
(set-buffer (get-buffer-create ,buffer))
(or (derived-mode-p 'special-mode) (special-mode))
(setq buffer-read-only nil
buffer-undo-list t)
(erase-buffer)
(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))))
;; The following are in-line for speed; they can be called thousands of times
;; when looking up holidays or processing the diary. Here, for example, are