diff options
| author | Glenn Morris | 2009-07-19 00:32:31 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-07-19 00:32:31 +0000 |
| commit | a71b84cd1b5a3f52a7cd327c2dbb065ddfbf56ff (patch) | |
| tree | a9f5369e87a6848cf06eee8e3cbe60c60367ee36 | |
| parent | fecbcdcbcd696db4899d3637c92fb509df441790 (diff) | |
| download | emacs-a71b84cd1b5a3f52a7cd327c2dbb065ddfbf56ff.tar.gz emacs-a71b84cd1b5a3f52a7cd327c2dbb065ddfbf56ff.zip | |
(cal-menu-set-date-title): Handle calls from non-calendar buffers (Bug#3862).
Restore "not on a date" message.
(cal-menu-context-mouse-menu): Doc fix.
| -rw-r--r-- | lisp/calendar/cal-menu.el | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el index a308e127ac6..d60daaafc1c 100644 --- a/lisp/calendar/cal-menu.el +++ b/lisp/calendar/cal-menu.el | |||
| @@ -200,22 +200,28 @@ is non-nil." | |||
| 200 | (read-file-name "Enter diary file name: " default-directory nil t) | 200 | (read-file-name "Enter diary file name: " default-directory nil t) |
| 201 | event)) | 201 | event)) |
| 202 | 202 | ||
| 203 | ;; In 22, the equivalent code gave an error when not called on a date, | ||
| 204 | ;; but easymenu does not seem to allow this (?). | ||
| 205 | ;; The ignore-errors is because `documentation' can end up calling | ||
| 206 | ;; this in a non-calendar buffer where displayed-month is unbound. (Bug#3862) | ||
| 203 | (defun cal-menu-set-date-title (menu) | 207 | (defun cal-menu-set-date-title (menu) |
| 204 | "Convert date of last event to title suitable for MENU." | 208 | "Convert date of last event to title suitable for MENU." |
| 205 | (easy-menu-filter-return | 209 | (let ((date (ignore-errors (calendar-cursor-to-date nil last-input-event)))) |
| 206 | menu (calendar-date-string (calendar-cursor-to-date t last-input-event) | 210 | (if date |
| 207 | t nil))) | 211 | (easy-menu-filter-return menu (calendar-date-string date t nil)) |
| 212 | (message "Not on a date!") | ||
| 213 | nil))) | ||
| 208 | 214 | ||
| 209 | (easy-menu-define cal-menu-context-mouse-menu nil | 215 | (easy-menu-define cal-menu-context-mouse-menu nil |
| 210 | "Pop up menu for Mouse-2 for selected date in the calendar window." | 216 | "Pop up mouse menu for selected date in the calendar window." |
| 211 | '("cal-menu-mouse2" :filter cal-menu-set-date-title | 217 | '("cal-menu-context-mouse-menu" :filter cal-menu-set-date-title |
| 212 | "--" | 218 | "--" |
| 213 | ["Holidays" calendar-cursor-holidays] | 219 | ["Holidays" calendar-cursor-holidays] |
| 214 | ["Mark date" calendar-set-mark] | 220 | ["Mark date" calendar-set-mark] |
| 215 | ["Sunrise/sunset" calendar-sunrise-sunset] | 221 | ["Sunrise/sunset" calendar-sunrise-sunset] |
| 216 | ["Other calendars" calendar-print-other-dates] | 222 | ["Other calendars" calendar-print-other-dates] |
| 217 | ;; FIXME there is a bug (#447) with last-nonmenu-event and submenus. | 223 | ;; There was a bug (#447; fixed) with last-nonmenu-event and submenus. |
| 218 | ;; These currently don't work if called without calendar window selected. | 224 | ;; These did not work if called without calendar window selected. |
| 219 | ("Prepare LaTeX buffer" | 225 | ("Prepare LaTeX buffer" |
| 220 | ["Daily (1 page)" cal-tex-cursor-day] | 226 | ["Daily (1 page)" cal-tex-cursor-day] |
| 221 | ["Weekly (1 page)" cal-tex-cursor-week] | 227 | ["Weekly (1 page)" cal-tex-cursor-week] |