Commit fdbe82c9 authored by Glenn Morris's avatar Glenn Morris
Browse files

(cal-menu-holidays-menu, cal-menu-list-holidays-year)

(cal-menu-list-holidays-following-year, cal-menu-list-holidays-previous-year):
Simplify now that 2nd arg of holiday-list is optional.
(calendar-mouse-holidays): Remove un-needed local `l'.
parent 42550348
...@@ -102,8 +102,7 @@ ...@@ -102,8 +102,7 @@
(push (vector (format "hol-year-%d" i) (push (vector (format "hol-year-%d" i)
`(lambda () `(lambda ()
(interactive) (interactive)
(holiday-list (+ displayed-year ,(- i 5)) (holiday-list (+ displayed-year ,(- i 5))))
(+ displayed-year ,(- i 5))))
:label `(format "For Year %d" :label `(format "For Year %d"
(+ displayed-year ,(- i 5)))) (+ displayed-year ,(- i 5))))
l)) l))
...@@ -162,20 +161,17 @@ POSITION and MENU are passed to `x-popup-menu'." ...@@ -162,20 +161,17 @@ POSITION and MENU are passed to `x-popup-menu'."
(defun cal-menu-list-holidays-year () (defun cal-menu-list-holidays-year ()
"Display a list of the holidays of the selected date's year." "Display a list of the holidays of the selected date's year."
(interactive) (interactive)
(let ((year (extract-calendar-year (calendar-cursor-to-date)))) (holiday-list (extract-calendar-year (calendar-cursor-to-date))))
(holiday-list year year)))
(defun cal-menu-list-holidays-following-year () (defun cal-menu-list-holidays-following-year ()
"Display a list of the holidays of the following year." "Display a list of the holidays of the following year."
(interactive) (interactive)
(let ((year (1+ (extract-calendar-year (calendar-cursor-to-date))))) (holiday-list (1+ (extract-calendar-year (calendar-cursor-to-date)))))
(holiday-list year year)))
(defun cal-menu-list-holidays-previous-year () (defun cal-menu-list-holidays-previous-year ()
"Display a list of the holidays of the previous year." "Display a list of the holidays of the previous year."
(interactive) (interactive)
(let ((year (1- (extract-calendar-year (calendar-cursor-to-date))))) (holiday-list (1- (extract-calendar-year (calendar-cursor-to-date)))))
(holiday-list year year)))
(defun calendar-event-to-date (&optional error) (defun calendar-event-to-date (&optional error)
"Date of last event. "Date of last event.
...@@ -206,22 +202,23 @@ ERROR is non-nil, otherwise just returns nil." ...@@ -206,22 +202,23 @@ ERROR is non-nil, otherwise just returns nil."
(calendar-cursor-holidays))) (calendar-cursor-holidays)))
(autoload 'calendar-check-holidays "holidays") (autoload 'calendar-check-holidays "holidays")
(autoload 'diary-list-entries "diary-lib")
(defun calendar-mouse-holidays (&optional event) (defun calendar-mouse-holidays (&optional event)
"Pop up menu of holidays for mouse selected date. "Pop up menu of holidays for mouse selected date.
EVENT is the event that invoked this command." EVENT is the event that invoked this command."
(interactive "e") (interactive "e")
(let* ((date (calendar-event-to-date)) (let* ((date (calendar-event-to-date))
(l (mapcar 'list (calendar-check-holidays date)))
(title (format "Holidays for %s" (calendar-date-string date))) (title (format "Holidays for %s" (calendar-date-string date)))
(selection (selection
(cal-menu-x-popup-menu (cal-menu-x-popup-menu
event event
(list title (list title
(append (list title) (or l '("None"))))))) (append (list title)
(or (mapcar 'list (calendar-check-holidays date))
'("None")))))))
(and selection (call-interactively selection)))) (and selection (call-interactively selection))))
(autoload 'diary-list-entries "diary-lib")
(defvar holidays-in-diary-buffer) ; only called from calendar.el (defvar holidays-in-diary-buffer) ; only called from calendar.el
(defun calendar-mouse-view-diary-entries (&optional date diary event) (defun calendar-mouse-view-diary-entries (&optional date diary event)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment