Repair several minor breakages
* lisp/calendar/calendar.el (calendar-event-buffer): New function. (calendar-cursor-to-date, calendar-other-month): * lisp/calendar/holidays.el (calendar-list-holidays) (calendar-mark-holidays): * lisp/calendar/lunar.el (calendar-lunar-phases): Use that function to derive event windows, in case these commands are being called from the menu bar. * lisp/doc-view.el (doc-view-tool-bar-map): Fix typo in help text.
This commit is contained in:
parent
67f79fc802
commit
11116043ae
4 changed files with 19 additions and 9 deletions
|
@ -1554,6 +1554,15 @@ first INDENT characters on the line."
|
|||
(when (window-live-p (get-buffer-window))
|
||||
(set-window-point (get-buffer-window) (point))))))
|
||||
|
||||
(defun calendar-event-buffer (event)
|
||||
"Return the Calendar buffer where EVENT happened.
|
||||
If EVENT's start falls within a window, use that window's buffer.
|
||||
Otherwise, use the selected window of EVENT's frame."
|
||||
(let ((window-or-frame (posn-window (event-start event))))
|
||||
(if (windowp window-or-frame)
|
||||
(window-buffer window-or-frame)
|
||||
(window-buffer (frame-selected-window window-or-frame)))))
|
||||
|
||||
(defvar calendar-mode-map
|
||||
(let ((map (make-keymap)))
|
||||
(suppress-keymap map)
|
||||
|
@ -1916,10 +1925,13 @@ parameter ERROR is non-nil, otherwise just returns nil.
|
|||
If EVENT is non-nil, it's an event indicating the buffer position to
|
||||
use instead of point."
|
||||
(with-current-buffer
|
||||
(if event (window-buffer (posn-window (event-start event)))
|
||||
(if event (calendar-event-buffer event)
|
||||
(current-buffer))
|
||||
(save-excursion
|
||||
(and event (setq event (event-start event))
|
||||
;; (posn-point event) can be `menu-bar' if this command is
|
||||
;; invoked from the menu bar.
|
||||
(integerp (posn-point event))
|
||||
(goto-char (posn-point event)))
|
||||
(let* ((segment (calendar-column-to-segment))
|
||||
(month (% (+ displayed-month (1- segment)) 12)))
|
||||
|
@ -2002,10 +2014,8 @@ handle dates in years BC."
|
|||
EVENT is an event like `last-nonmenu-event'."
|
||||
(interactive (let ((event (list last-nonmenu-event)))
|
||||
(append (calendar-read-date 'noday) event)))
|
||||
(save-selected-window
|
||||
(and event
|
||||
(setq event (event-start event))
|
||||
(select-window (posn-window event)))
|
||||
(with-current-buffer (or (and (not event) (current-buffer))
|
||||
(calendar-event-buffer event))
|
||||
(unless (and (= month displayed-month)
|
||||
(= year displayed-year))
|
||||
(let ((old-date (calendar-cursor-to-date))
|
||||
|
|
|
@ -359,7 +359,7 @@ use instead of point."
|
|||
(interactive (list last-nonmenu-event))
|
||||
;; If called from a menu, with the calendar window not selected.
|
||||
(with-current-buffer
|
||||
(if event (window-buffer (posn-window (event-start event)))
|
||||
(if event (calendar-event-buffer event)
|
||||
(current-buffer))
|
||||
(message "Looking up holidays...")
|
||||
(let ((holiday-list (calendar-holiday-list))
|
||||
|
@ -590,7 +590,7 @@ use instead of point."
|
|||
(interactive (list last-nonmenu-event))
|
||||
;; If called from a menu, with the calendar window not selected.
|
||||
(with-current-buffer
|
||||
(if event (window-buffer (posn-window (event-start event)))
|
||||
(if event (calendar-event-buffer event)
|
||||
(current-buffer))
|
||||
(setq calendar-mark-holidays-flag t)
|
||||
(message "Marking holidays...")
|
||||
|
|
|
@ -226,7 +226,7 @@ use instead of point."
|
|||
(interactive (list last-nonmenu-event))
|
||||
;; If called from a menu, with the calendar window not selected.
|
||||
(with-current-buffer
|
||||
(if event (window-buffer (posn-window (event-start event)))
|
||||
(if event (calendar-event-buffer event)
|
||||
(current-buffer))
|
||||
(message "Computing phases of the moon...")
|
||||
(let ((m1 displayed-month)
|
||||
|
|
|
@ -703,7 +703,7 @@ Typically \"page-%s.png\".")
|
|||
map doc-view-mode-map :vert-only t
|
||||
:enable '(< (doc-view-current-page)
|
||||
(doc-view-last-page-number))
|
||||
:help "Move to the next page.")
|
||||
:help "Move to the last page.")
|
||||
map)
|
||||
"Like the default `tool-bar-map', but with additions for DocView.")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue