From a769dd157dfa40b365600e043b56172036110254 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 7 Nov 2011 14:00:54 -0500 Subject: [PATCH] Small cal-menu fix for bug#9976 * lisp/calendar/cal-menu.el (cal-menu-set-date-title): Do nothing if not in a calendar. --- lisp/ChangeLog | 5 +++++ lisp/calendar/cal-menu.el | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) 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." -- 2.39.2