From: Glenn Morris Date: Mon, 7 Nov 2011 19:00:54 +0000 (-0500) Subject: Small cal-menu fix for bug#9976 X-Git-Tag: emacs-pretest-24.0.92~121^2~28 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a769dd157dfa40b365600e043b56172036110254;p=emacs.git Small cal-menu fix for bug#9976 * lisp/calendar/cal-menu.el (cal-menu-set-date-title): Do nothing if not in a calendar. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff61568a8f2..2802116dee4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-11-07 Glenn Morris + + * calendar/cal-menu.el (cal-menu-set-date-title): + Do nothing if not in a calendar. (Bug#9976) + 2011-11-07 Stefan Monnier * files.el (find-file): Always use selected-window. diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el index 3ebb7edab3f..d8de171c0a1 100644 --- a/lisp/calendar/cal-menu.el +++ b/lisp/calendar/cal-menu.el @@ -215,13 +215,15 @@ is non-nil." ;; but easymenu does not seem to allow this (?). ;; The ignore-errors is because `documentation' can end up calling ;; this in a non-calendar buffer where displayed-month is unbound. (Bug#3862) +;; This still has issues - bug#9976, so added derived-mode-p call. (defun cal-menu-set-date-title (menu) "Convert date of last event to title suitable for MENU." - (let ((date (ignore-errors (calendar-cursor-to-date nil last-input-event)))) - (if date - (easy-menu-filter-return menu (calendar-date-string date t nil)) - (message "Not on a date!") - nil))) + (when (derived-mode-p 'calendar-mode) + (let ((date (ignore-errors (calendar-cursor-to-date nil last-input-event)))) + (if date + (easy-menu-filter-return menu (calendar-date-string date t nil)) + (message "Not on a date!") + nil)))) (easy-menu-define cal-menu-context-mouse-menu nil "Pop up mouse menu for selected date in the calendar window."