+2011-11-07 Glenn Morris <rgm@gnu.org>
+
+ * calendar/cal-menu.el (cal-menu-set-date-title):
+ Do nothing if not in a calendar. (Bug#9976)
+
2011-11-07 Stefan Monnier <monnier@iro.umontreal.ca>
* files.el (find-file): Always use selected-window.
;; 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."