;;; cal-menu.el --- calendar functions for menu bar and popup menu support
-;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2012 Free Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
;; Lara Rios <lrios@coewl.cen.uiuc.edu>
;; Maintainer: Glenn Morris <rgm@gnu.org>
;; Keywords: calendar
;; Human-Keywords: calendar, popup menus, menu bar
+;; Package: calendar
;; This file is part of GNU Emacs.
["Insert Anniversary" diary-insert-anniversary-entry]
["Insert Block" diary-insert-block-entry]
["Insert Cyclic" diary-insert-cyclic-entry]
- ("Insert Baha'i"
+ ("Insert Bahá'í"
["One time" diary-bahai-insert-entry]
["Monthly" diary-bahai-insert-monthly-entry]
["Yearly" diary-bahai-insert-yearly-entry])
["Astronomical Date" calendar-astro-goto-day-number]
["Hebrew Date" calendar-hebrew-goto-date]
["Persian Date" calendar-persian-goto-date]
- ["Baha'i Date" calendar-bahai-goto-date]
+ ["Bahá'í Date" calendar-bahai-goto-date]
["Islamic Date" calendar-islamic-goto-date]
["Julian Date" calendar-julian-goto-date]
["Chinese Date" calendar-chinese-goto-date]
(defconst cal-menu-scroll-menu
'("Scroll"
+ ["Scroll Commands" nil :help "Commands that scroll the visible window"]
["Forward 1 Month" calendar-scroll-left]
["Forward 3 Months" calendar-scroll-left-three-months]
["Forward 1 Year" (calendar-scroll-left 12) :keys "4 C-v"]
["Backward 1 Month" calendar-scroll-right]
["Backward 3 Months" calendar-scroll-right-three-months]
- ["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"])
+ ["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"]
+ "--"
+ ["Motion Commands" nil :help "Commands that move point"]
+ ["Forward 1 Day" calendar-forward-day]
+ ["Forward 1 Week" calendar-forward-week]
+ ["Forward 1 Month" calendar-forward-month]
+ ["Forward 1 Year" calendar-forward-year]
+ ["Backward 1 Day" calendar-backward-day]
+ ["Backward 1 Week" calendar-backward-week]
+ ["Backward 1 Month" calendar-backward-month]
+ ["Backward 1 Year" calendar-backward-year])
"Key map for \"Scroll\" menu in the calendar.")
+(declare-function x-popup-menu "menu.c" (position menu))
+
(defmacro cal-menu-x-popup-menu (event title &rest body)
"Call `x-popup-menu' at position EVENT, with TITLE and contents BODY.
Signals an error if popups are unavailable."
(read-file-name "Enter diary file name: " default-directory nil t)
event))
+;; In 22, the equivalent code gave an error when not called on a date,
+;; 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."
- (easy-menu-filter-return
- menu (calendar-date-string (calendar-cursor-to-date t last-input-event)
- t 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 menu for Mouse-2 for selected date in the calendar window."
- '("cal-menu-mouse2" :filter cal-menu-set-date-title
+ "Pop up mouse menu for selected date in the calendar window."
+ '("cal-menu-context-mouse-menu" :filter cal-menu-set-date-title
"--"
["Holidays" calendar-cursor-holidays]
["Mark date" calendar-set-mark]
["Sunrise/sunset" calendar-sunrise-sunset]
["Other calendars" calendar-print-other-dates]
- ;; FIXME there is a bug (#447) with last-nonmenu-event and submenus.
- ;; These currently don't work if called without calendar window selected.
+ ;; There was a bug (#447; fixed) with last-nonmenu-event and submenus.
+ ;; These did not work if called without calendar window selected.
("Prepare LaTeX buffer"
["Daily (1 page)" cal-tex-cursor-day]
- ["Weekly (1 page)" cal-tex-cursor-week]
- ["Weekly (2 pages)" cal-tex-cursor-week2]
- ["Weekly (other style; 1 page)" cal-tex-cursor-week-iso]
- ["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday]
+ ["Weekly (1 page, with hours)" cal-tex-cursor-week]
+ ["Weekly (2 pages, with hours)" cal-tex-cursor-week2]
+ ["Weekly (1 page, no hours)" cal-tex-cursor-week-iso]
+ ["Weekly (1 page, with hours, different style)" cal-tex-cursor-week-monday]
+ ["Weekly (2 pages, no hours)" cal-tex-cursor-week2-summary]
["Monthly" cal-tex-cursor-month]
["Monthly (landscape)" cal-tex-cursor-month-landscape]
["Yearly" cal-tex-cursor-year]
(provide 'cal-menu)
-;; arch-tag: aa81cf73-ce89-48a4-97ec-9ef861e87fe9
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
;;; cal-menu.el ends here