(calendar-cursor-holidays): Handle mouse events.

This commit is contained in:
Glenn Morris
2008-06-26 04:54:37 +00:00
parent cb9069371d
commit 3b7de42e67
2 changed files with 27 additions and 16 deletions

View File

@@ -1,12 +1,10 @@
2008-06-26 Kenichi Handa <handa@m17n.org>
* composite.el (terminal-composition-base-character-p): New
funciton.
(terminal-composition-function): Use
terminal-composition-base-character-p. Include the base character
* composite.el (terminal-composition-base-character-p): New function.
(terminal-composition-function):
Use terminal-composition-base-character-p. Include the base character
in the composition.
(auto-compose-chars): Don't check font-object for terminal
display.
(auto-compose-chars): Don't check font-object for terminal display.
2008-06-26 Glenn Morris <rgm@gnu.org>
@@ -29,6 +27,10 @@
* calendar/cal-menu.el (calendar-mouse-print-dates): Remove function.
(cal-menu-context-mouse-menu): Use calendar-print-other-dates.
* calendar/holidays.el (calendar-cursor-holidays): Handle mouse events.
* calendar/cal-menu.el (calendar-mouse-holidays): Remove function.
(cal-menu-context-mouse-menu): Use calendar-cursor-holidays.
* calendar/cal-move.el (calendar-cursor-to-nearest-date):
Use calendar-column-to-segment, calendar-month-edges, and
the 'date property to handle intermonth text.

View File

@@ -625,25 +625,34 @@ The holidays are those in the list `calendar-holidays'."
'check-calendar-holidays 'calendar-check-holidays "23.1")
;;;###cal-autoload
(defun calendar-cursor-holidays (&optional date)
(defun calendar-cursor-holidays (&optional date event)
"Find holidays for the date specified by the cursor in the calendar window.
Optional DATE is a list (month day year) to use instead of the
cursor position."
(interactive)
cursor position. EVENT specifies a buffer position to use for a date."
(interactive (list nil last-nonmenu-event))
(message "Checking holidays...")
(or date (setq date (calendar-cursor-to-date t)))
(let* ((date-string (calendar-date-string date))
(holiday-list (calendar-check-holidays date))
(holiday-string (mapconcat 'identity holiday-list "; "))
(msg (format "%s: %s" date-string holiday-string)))
(or date (setq date (calendar-cursor-to-date t event)))
(let ((date-string (calendar-date-string date))
(holiday-list (calendar-check-holidays date))
selection msg)
(if (mouse-event-p event)
(and (setq selection (cal-menu-x-popup-menu event
(format "Holidays for %s" date-string)
(if holiday-list
(mapcar 'list holiday-list)
'("None"))))
(call-interactively selection))
(if (not holiday-list)
(message "No holidays known for %s" date-string)
(if (<= (length msg) (frame-width))
(if (<= (length (setq msg
(format "%s: %s" date-string
(mapconcat 'identity holiday-list "; "))))
(frame-width))
(message "%s" msg)
(calendar-in-read-only-buffer holiday-buffer
(calendar-set-mode-line date-string)
(insert (mapconcat 'identity holiday-list "\n")))
(message "Checking holidays...done")))))
(message "Checking holidays...done"))))))
;; FIXME move to calendar?
;;;###cal-autoload