aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/calendar/cal-menu.el27
2 files changed, 20 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fd96e1ae578..ddc59b237bd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -50,6 +50,10 @@
50 (calendar-read-mayan-haab-date, calendar-read-mayan-tzolkin-date) 50 (calendar-read-mayan-haab-date, calendar-read-mayan-tzolkin-date)
51 (calendar-next-calendar-round-date) 51 (calendar-next-calendar-round-date)
52 (calendar-mayan-long-count-common-era): 52 (calendar-mayan-long-count-common-era):
53 * calendar/cal-menu.el (cal-menu-holiday-window-suffix)
54 (cal-menu-x-popup-menu, calendar-mouse-holidays)
55 (calendar-mouse-view-diary-entries, calendar-mouse-print-dates)
56 (calendar-mouse-goto-date):
53 * calendar/cal-move.el (calendar-scroll-left, calendar-scroll-right): 57 * calendar/cal-move.el (calendar-scroll-left, calendar-scroll-right):
54 * calendar/lunar.el (phases-of-moon, lunar-new-moon-on-or-after): 58 * calendar/lunar.el (phases-of-moon, lunar-new-moon-on-or-after):
55 Doc fixes. 59 Doc fixes.
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el
index 2b2efd1cb3a..f458ebec2f7 100644
--- a/lisp/calendar/cal-menu.el
+++ b/lisp/calendar/cal-menu.el
@@ -116,6 +116,7 @@
116 ["Yearly" insert-yearly-hebrew-diary-entry]))) 116 ["Yearly" insert-yearly-hebrew-diary-entry])))
117 117
118(defun cal-menu-holiday-window-suffix () 118(defun cal-menu-holiday-window-suffix ()
119 "Return a string suffix for the \"Window\" entry in `cal-menu-holidays-menu'."
119 (let ((my1 (calendar-increment-month -1)) 120 (let ((my1 (calendar-increment-month -1))
120 (my2 (calendar-increment-month 1))) 121 (my2 (calendar-increment-month 1)))
121 (if (= (cdr my1) (cdr my2)) 122 (if (= (cdr my1) (cdr my2))
@@ -200,8 +201,8 @@
200 ["Backward 1 Year" "4\ev"])) 201 ["Backward 1 Year" "4\ev"]))
201 202
202(defun cal-menu-x-popup-menu (position menu) 203(defun cal-menu-x-popup-menu (position menu)
203 "Like `x-popup-menu', but prints an error message if popup menus are 204 "Like `x-popup-menu', but print an error message if popups are unavailable.
204not available." 205POSITION and MENU are passed to `x-popup-menu'."
205 (if (display-popup-menus-p) 206 (if (display-popup-menus-p)
206 (x-popup-menu position menu) 207 (x-popup-menu position menu)
207 (error "Popup menus are not available on this system"))) 208 (error "Popup menus are not available on this system")))
@@ -251,7 +252,8 @@ ERROR is t, otherwise just returns nil."
251(autoload 'diary-list-entries "diary-lib") 252(autoload 'diary-list-entries "diary-lib")
252 253
253(defun calendar-mouse-holidays (&optional event) 254(defun calendar-mouse-holidays (&optional event)
254 "Pop up menu of holidays for mouse selected date." 255 "Pop up menu of holidays for mouse selected date.
256EVENT is the event that invoked this command."
255 (interactive "e") 257 (interactive "e")
256 (let* ((date (calendar-event-to-date)) 258 (let* ((date (calendar-event-to-date))
257 (l (mapcar 'list (calendar-check-holidays date))) 259 (l (mapcar 'list (calendar-check-holidays date)))
@@ -269,9 +271,9 @@ ERROR is t, otherwise just returns nil."
269 271
270(defun calendar-mouse-view-diary-entries (&optional date diary event) 272(defun calendar-mouse-view-diary-entries (&optional date diary event)
271 "Pop up menu of diary entries for mouse-selected date. 273 "Pop up menu of diary entries for mouse-selected date.
272Use optional DATE and alternative file DIARY. 274Use optional DATE and alternative file DIARY. EVENT is the event
273 275that invoked this command. Shows holidays if `holidays-in-diary-buffer'
274Any holidays are shown if `holidays-in-diary-buffer' is t." 276is non-nil."
275 (interactive "i\ni\ne") 277 (interactive "i\ni\ne")
276 (let* ((date (or date (calendar-event-to-date))) 278 (let* ((date (or date (calendar-event-to-date)))
277 (diary-file (if diary diary diary-file)) 279 (diary-file (if diary diary diary-file))
@@ -418,7 +420,8 @@ The output is in landscape format, one month to a page."
418 (cal-tex-cursor-year-landscape nil))) 420 (cal-tex-cursor-year-landscape nil)))
419 421
420(defun calendar-mouse-print-dates (&optional event) 422(defun calendar-mouse-print-dates (&optional event)
421 "Pop up menu of equivalent dates to mouse selected date." 423 "Pop up menu of equivalent dates to mouse selected date.
424EVENT is the event that invoked this command."
422 (interactive "e") 425 (interactive "e")
423 (let* ((date (calendar-event-to-date)) 426 (let* ((date (calendar-event-to-date))
424 (selection 427 (selection
@@ -476,9 +479,15 @@ The output is in landscape format, one month to a page."
476 (calendar-print-chinese-date))) 479 (calendar-print-chinese-date)))
477 480
478(defun calendar-mouse-goto-date (date) 481(defun calendar-mouse-goto-date (date)
482 "Goto DATE in the buffer specified by `last-input-event'."
479 (set-buffer (window-buffer (posn-window (event-start last-input-event)))) 483 (set-buffer (window-buffer (posn-window (event-start last-input-event))))
480 (calendar-goto-date date)) 484 (calendar-goto-date date))
481 485
486(defun cal-menu-set-date-title (menu)
487 "Convert date of last event to title suitable for MENU."
488 (easy-menu-filter-return
489 menu (calendar-date-string (calendar-event-to-date t) t nil)))
490
482(easy-menu-define cal-menu-context-mouse-menu nil 491(easy-menu-define cal-menu-context-mouse-menu nil
483 "Pop up menu for Mouse-2 for selected date in the calendar window." 492 "Pop up menu for Mouse-2 for selected date in the calendar window."
484 '("foo" :filter cal-menu-set-date-title 493 '("foo" :filter cal-menu-set-date-title
@@ -506,10 +515,6 @@ The output is in landscape format, one month to a page."
506 ["Insert diary entry" calendar-mouse-insert-diary-entry] 515 ["Insert diary entry" calendar-mouse-insert-diary-entry]
507 ["Other diary file entries" calendar-mouse-view-other-diary-entries])) 516 ["Other diary file entries" calendar-mouse-view-other-diary-entries]))
508 517
509(defun cal-menu-set-date-title (menu)
510 (easy-menu-filter-return
511 menu (calendar-date-string (calendar-event-to-date t) t nil)))
512
513(easy-menu-define cal-menu-global-mouse-menu nil 518(easy-menu-define cal-menu-global-mouse-menu nil
514 "Menu bound to a mouse event, not specific to the mouse-click location." 519 "Menu bound to a mouse event, not specific to the mouse-click location."
515 '("Calendar" 520 '("Calendar"