1994-01-30 00:30:22 +00:00
|
|
|
;;; cal-menu.el --- calendar functions for menu bar and popup menu support
|
|
|
|
|
2014-01-01 07:43:34 +00:00
|
|
|
;; Copyright (C) 1994-1995, 2001-2014 Free Software Foundation, Inc.
|
1994-01-30 00:30:22 +00:00
|
|
|
|
|
|
|
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
|
2008-03-13 06:29:28 +00:00
|
|
|
;; Lara Rios <lrios@coewl.cen.uiuc.edu>
|
2005-10-08 04:49:48 +00:00
|
|
|
;; Maintainer: Glenn Morris <rgm@gnu.org>
|
1994-01-30 00:30:22 +00:00
|
|
|
;; Keywords: calendar
|
|
|
|
;; Human-Keywords: calendar, popup menus, menu bar
|
2010-08-29 16:17:13 +00:00
|
|
|
;; Package: calendar
|
1994-01-30 00:30:22 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:07:58 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1994-04-07 20:30:18 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:07:58 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
1994-04-07 20:30:18 +00:00
|
|
|
|
1994-01-30 00:30:22 +00:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
1994-04-07 20:30:18 +00:00
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:07:58 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1994-01-30 00:30:22 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2008-04-01 02:42:35 +00:00
|
|
|
;; See calendar.el.
|
1994-01-30 00:30:22 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2008-03-26 03:11:38 +00:00
|
|
|
(require 'calendar)
|
2007-11-27 04:14:33 +00:00
|
|
|
|
2008-06-26 22:29:15 +00:00
|
|
|
(defconst cal-menu-sunmoon-menu
|
|
|
|
'("Sun/Moon"
|
2008-06-27 00:38:43 +00:00
|
|
|
["Lunar Phases" calendar-lunar-phases]
|
2008-06-26 22:29:15 +00:00
|
|
|
["Sunrise/sunset for cursor date" calendar-sunrise-sunset]
|
|
|
|
["Sunrise/sunset for cursor month" calendar-sunrise-sunset-month])
|
|
|
|
"Key map for \"Sun/Moon\" menu in the calendar.")
|
2007-07-25 21:58:18 +00:00
|
|
|
|
|
|
|
(defconst cal-menu-diary-menu
|
|
|
|
'("Diary"
|
2008-04-06 20:54:25 +00:00
|
|
|
["Other File" diary-view-other-diary-entries]
|
2007-07-25 21:58:18 +00:00
|
|
|
["Cursor Date" diary-view-entries]
|
2008-04-06 20:54:25 +00:00
|
|
|
["Mark All" diary-mark-entries]
|
2007-07-25 21:58:18 +00:00
|
|
|
["Show All" diary-show-all-entries]
|
2008-04-06 20:54:25 +00:00
|
|
|
["Insert Diary Entry" diary-insert-entry]
|
|
|
|
["Insert Weekly" diary-insert-weekly-entry]
|
|
|
|
["Insert Monthly" diary-insert-monthly-entry]
|
|
|
|
["Insert Yearly" diary-insert-yearly-entry]
|
|
|
|
["Insert Anniversary" diary-insert-anniversary-entry]
|
|
|
|
["Insert Block" diary-insert-block-entry]
|
|
|
|
["Insert Cyclic" diary-insert-cyclic-entry]
|
2012-02-18 03:08:15 +00:00
|
|
|
("Insert Bahá'í"
|
2007-09-16 02:20:02 +00:00
|
|
|
["One time" diary-bahai-insert-entry]
|
|
|
|
["Monthly" diary-bahai-insert-monthly-entry]
|
|
|
|
["Yearly" diary-bahai-insert-yearly-entry])
|
2007-07-25 21:58:18 +00:00
|
|
|
("Insert Islamic"
|
2008-04-04 07:34:56 +00:00
|
|
|
["One time" diary-islamic-insert-entry]
|
|
|
|
["Monthly" diary-islamic-insert-monthly-entry]
|
|
|
|
["Yearly" diary-islamic-insert-yearly-entry])
|
2007-07-25 21:58:18 +00:00
|
|
|
("Insert Hebrew"
|
2008-04-05 20:59:44 +00:00
|
|
|
["One time" diary-hebrew-insert-entry]
|
2008-04-24 05:44:38 +00:00
|
|
|
["Monthly" diary-hebrew-insert-monthly-entry]
|
2008-06-26 03:42:12 +00:00
|
|
|
["Yearly" diary-hebrew-insert-yearly-entry]))
|
|
|
|
"Key map for \"Diary\" menu in the calendar.")
|
2007-07-25 21:58:18 +00:00
|
|
|
|
|
|
|
(defun cal-menu-holiday-window-suffix ()
|
2008-03-08 21:05:13 +00:00
|
|
|
"Return a string suffix for the \"Window\" entry in `cal-menu-holidays-menu'."
|
2008-04-07 01:59:37 +00:00
|
|
|
(let ((my1 (calendar-increment-month-cons -1))
|
|
|
|
(my2 (calendar-increment-month-cons 1)))
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
;; Mon1-Mon2, Year or Mon1, Year1-Mon2, Year2.
|
|
|
|
(format "%s%s-%s, %d"
|
|
|
|
(calendar-month-name (car my1) 'abbrev)
|
|
|
|
(if (= (cdr my1) (cdr my2))
|
|
|
|
""
|
|
|
|
(format ", %d" (cdr my1)))
|
|
|
|
(calendar-month-name (car my2) 'abbrev)
|
|
|
|
(cdr my2))))
|
2007-07-25 21:58:18 +00:00
|
|
|
|
2008-04-07 01:59:37 +00:00
|
|
|
(defvar displayed-year) ; from calendar-generate
|
2008-03-14 03:18:20 +00:00
|
|
|
|
2007-07-25 21:58:18 +00:00
|
|
|
(defconst cal-menu-holidays-menu
|
|
|
|
`("Holidays"
|
|
|
|
["For Cursor Date -" calendar-cursor-holidays
|
|
|
|
:suffix (calendar-date-string (calendar-cursor-to-date) t t)
|
|
|
|
:visible (calendar-cursor-to-date)]
|
2007-09-14 04:29:10 +00:00
|
|
|
["For Window -" calendar-list-holidays
|
2007-07-25 21:58:18 +00:00
|
|
|
:suffix (cal-menu-holiday-window-suffix)]
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
["For Today -" (calendar-cursor-holidays (calendar-current-date))
|
2007-07-25 21:58:18 +00:00
|
|
|
:suffix (calendar-date-string (calendar-current-date) t t)]
|
|
|
|
"--"
|
|
|
|
,@(let ((l ()))
|
|
|
|
;; Show 11 years--5 before, 5 after year of middle month.
|
2008-01-15 22:36:18 +00:00
|
|
|
;; We used to use :suffix rather than :label and bumped into
|
|
|
|
;; an easymenu bug:
|
2007-11-26 07:28:37 +00:00
|
|
|
;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01813.html
|
2008-01-15 22:36:18 +00:00
|
|
|
;; The bug has since been fixed.
|
2007-07-25 21:58:18 +00:00
|
|
|
(dotimes (i 11)
|
2007-11-26 07:28:37 +00:00
|
|
|
(push (vector (format "hol-year-%d" i)
|
2007-11-25 02:49:38 +00:00
|
|
|
`(lambda ()
|
|
|
|
(interactive)
|
2008-03-28 02:45:39 +00:00
|
|
|
(holiday-list (+ displayed-year ,(- i 5))))
|
2007-11-26 07:28:37 +00:00
|
|
|
:label `(format "For Year %d"
|
|
|
|
(+ displayed-year ,(- i 5))))
|
2007-11-25 02:49:38 +00:00
|
|
|
l))
|
2007-07-25 21:58:18 +00:00
|
|
|
(nreverse l))
|
|
|
|
"--"
|
|
|
|
["Unmark Calendar" calendar-unmark]
|
2008-06-26 03:42:12 +00:00
|
|
|
["Mark Holidays" calendar-mark-holidays])
|
|
|
|
"Key map for \"Holidays\" menu in the calendar.")
|
2007-07-25 21:58:18 +00:00
|
|
|
|
|
|
|
(defconst cal-menu-goto-menu
|
2008-06-26 22:29:15 +00:00
|
|
|
'("Goto"
|
2007-07-25 21:58:18 +00:00
|
|
|
["Today" calendar-goto-today]
|
|
|
|
["Beginning of Week" calendar-beginning-of-week]
|
|
|
|
["End of Week" calendar-end-of-week]
|
|
|
|
["Beginning of Month" calendar-beginning-of-month]
|
|
|
|
["End of Month" calendar-end-of-month]
|
|
|
|
["Beginning of Year" calendar-beginning-of-year]
|
|
|
|
["End of Year" calendar-end-of-year]
|
|
|
|
["Other Date" calendar-goto-date]
|
|
|
|
["Day of Year" calendar-goto-day-of-year]
|
2008-04-04 07:34:56 +00:00
|
|
|
["ISO Week" calendar-iso-goto-week]
|
|
|
|
["ISO Date" calendar-iso-goto-date]
|
|
|
|
["Astronomical Date" calendar-astro-goto-day-number]
|
2008-04-05 20:59:44 +00:00
|
|
|
["Hebrew Date" calendar-hebrew-goto-date]
|
2008-04-04 07:34:56 +00:00
|
|
|
["Persian Date" calendar-persian-goto-date]
|
2012-02-18 03:08:15 +00:00
|
|
|
["Bahá'í Date" calendar-bahai-goto-date]
|
2008-04-04 07:34:56 +00:00
|
|
|
["Islamic Date" calendar-islamic-goto-date]
|
|
|
|
["Julian Date" calendar-julian-goto-date]
|
2008-04-05 20:59:44 +00:00
|
|
|
["Chinese Date" calendar-chinese-goto-date]
|
2008-04-05 19:16:40 +00:00
|
|
|
["Coptic Date" calendar-coptic-goto-date]
|
|
|
|
["Ethiopic Date" calendar-ethiopic-goto-date]
|
2007-07-25 21:58:18 +00:00
|
|
|
("Mayan Date"
|
2008-04-04 07:34:56 +00:00
|
|
|
["Next Tzolkin" calendar-mayan-next-tzolkin-date]
|
|
|
|
["Previous Tzolkin" calendar-mayan-previous-tzolkin-date]
|
|
|
|
["Next Haab" calendar-mayan-next-haab-date]
|
|
|
|
["Previous Haab" calendar-mayan-previous-haab-date]
|
|
|
|
["Next Round" calendar-mayan-next-round-date]
|
|
|
|
["Previous Round" calendar-mayan-previous-round-date])
|
2008-06-26 03:42:12 +00:00
|
|
|
["French Date" calendar-french-goto-date])
|
2008-06-26 22:29:15 +00:00
|
|
|
"Key map for \"Goto\" menu in the calendar.")
|
2007-07-25 21:58:18 +00:00
|
|
|
|
|
|
|
(defconst cal-menu-scroll-menu
|
|
|
|
'("Scroll"
|
2009-09-22 07:15:31 +00:00
|
|
|
["Scroll Commands" nil :help "Commands that scroll the visible window"]
|
2007-07-27 06:15:40 +00:00
|
|
|
["Forward 1 Month" calendar-scroll-left]
|
|
|
|
["Forward 3 Months" calendar-scroll-left-three-months]
|
2008-04-24 05:44:38 +00:00
|
|
|
["Forward 1 Year" (calendar-scroll-left 12) :keys "4 C-v"]
|
2007-07-27 06:15:40 +00:00
|
|
|
["Backward 1 Month" calendar-scroll-right]
|
|
|
|
["Backward 3 Months" calendar-scroll-right-three-months]
|
2009-09-22 07:15:31 +00:00
|
|
|
["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])
|
2008-06-26 03:42:12 +00:00
|
|
|
"Key map for \"Scroll\" menu in the calendar.")
|
2003-08-17 22:48:54 +00:00
|
|
|
|
2009-11-10 08:11:47 +00:00
|
|
|
(declare-function x-popup-menu "menu.c" (position menu))
|
2008-08-11 01:23:07 +00:00
|
|
|
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(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."
|
|
|
|
(declare (indent 2))
|
|
|
|
`(if (display-popup-menus-p)
|
|
|
|
(x-popup-menu ,event (list ,title (append (list ,title) ,@body)))
|
|
|
|
(error "Popup menus are not available on this system")))
|
1998-05-11 17:18:04 +00:00
|
|
|
|
2008-03-28 02:45:39 +00:00
|
|
|
(autoload 'diary-list-entries "diary-lib")
|
2008-06-26 07:16:38 +00:00
|
|
|
;; Autoloaded in diary-lib.
|
|
|
|
(declare-function calendar-check-holidays "holidays" (date))
|
2008-03-07 04:45:09 +00:00
|
|
|
|
2005-11-01 19:55:19 +00:00
|
|
|
(defun calendar-mouse-view-diary-entries (&optional date diary event)
|
2003-08-17 22:48:54 +00:00
|
|
|
"Pop up menu of diary entries for mouse-selected date.
|
2008-03-08 21:05:13 +00:00
|
|
|
Use optional DATE and alternative file DIARY. EVENT is the event
|
2008-04-07 01:59:37 +00:00
|
|
|
that invoked this command. Shows holidays if `diary-show-holidays-flag'
|
2008-03-08 21:05:13 +00:00
|
|
|
is non-nil."
|
2005-11-01 19:55:19 +00:00
|
|
|
(interactive "i\ni\ne")
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(let* ((date (or date (calendar-cursor-to-date nil event)))
|
2008-03-20 04:46:51 +00:00
|
|
|
(diary-file (or diary diary-file))
|
2003-08-17 22:48:54 +00:00
|
|
|
(diary-list-include-blanks nil)
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(diary-entries (mapcar (lambda (x) (split-string (cadr x) "\n"))
|
|
|
|
(diary-list-entries date 1 'list-only)))
|
2008-04-07 01:59:37 +00:00
|
|
|
(holidays (if diary-show-holidays-flag
|
2007-09-14 04:29:10 +00:00
|
|
|
(calendar-check-holidays date)))
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(title (format "Diary entries%s for %s"
|
|
|
|
(if diary (format " from %s" diary) "")
|
2003-08-17 22:48:54 +00:00
|
|
|
(calendar-date-string date)))
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(selection (cal-menu-x-popup-menu event title
|
|
|
|
(mapcar (lambda (x) (list (concat " " x))) holidays)
|
|
|
|
(if holidays
|
|
|
|
(list "--shadow-etched-in" "--shadow-etched-in"))
|
|
|
|
(if diary-entries
|
|
|
|
(mapcar 'list (apply 'append diary-entries))
|
|
|
|
'("None")))))
|
1998-06-09 22:03:14 +00:00
|
|
|
(and selection (call-interactively selection))))
|
1994-01-30 00:30:22 +00:00
|
|
|
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(defun calendar-mouse-view-other-diary-entries (&optional event)
|
1998-06-09 22:03:14 +00:00
|
|
|
"Pop up menu of diary entries from alternative file on mouse-selected date."
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(interactive "e")
|
2003-08-17 22:48:54 +00:00
|
|
|
(calendar-mouse-view-diary-entries
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
(calendar-cursor-to-date nil event)
|
|
|
|
(read-file-name "Enter diary file name: " default-directory nil t)
|
|
|
|
event))
|
1995-10-12 15:28:06 +00:00
|
|
|
|
2009-07-19 00:32:31 +00:00
|
|
|
;; 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)
|
2011-11-07 19:00:54 +00:00
|
|
|
;; This still has issues - bug#9976, so added derived-mode-p call.
|
2008-03-08 21:05:13 +00:00
|
|
|
(defun cal-menu-set-date-title (menu)
|
|
|
|
"Convert date of last event to title suitable for MENU."
|
2011-11-07 19:00:54 +00:00
|
|
|
(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))))
|
2008-03-08 21:05:13 +00:00
|
|
|
|
2007-07-25 21:58:18 +00:00
|
|
|
(easy-menu-define cal-menu-context-mouse-menu nil
|
2009-07-19 00:32:31 +00:00
|
|
|
"Pop up mouse menu for selected date in the calendar window."
|
|
|
|
'("cal-menu-context-mouse-menu" :filter cal-menu-set-date-title
|
2007-07-25 21:58:18 +00:00
|
|
|
"--"
|
2008-06-26 04:54:12 +00:00
|
|
|
["Holidays" calendar-cursor-holidays]
|
2008-06-17 15:42:19 +00:00
|
|
|
["Mark date" calendar-set-mark]
|
|
|
|
["Sunrise/sunset" calendar-sunrise-sunset]
|
2008-06-26 03:42:12 +00:00
|
|
|
["Other calendars" calendar-print-other-dates]
|
2009-07-19 00:32:31 +00:00
|
|
|
;; There was a bug (#447; fixed) with last-nonmenu-event and submenus.
|
|
|
|
;; These did not work if called without calendar window selected.
|
2007-07-25 21:58:18 +00:00
|
|
|
("Prepare LaTeX buffer"
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
["Daily (1 page)" cal-tex-cursor-day]
|
2012-10-06 18:34:23 +00:00
|
|
|
["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]
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
["Monthly" cal-tex-cursor-month]
|
|
|
|
["Monthly (landscape)" cal-tex-cursor-month-landscape]
|
|
|
|
["Yearly" cal-tex-cursor-year]
|
|
|
|
["Yearly (landscape)" cal-tex-cursor-year-landscape]
|
2007-07-25 21:58:18 +00:00
|
|
|
("Filofax styles"
|
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays.
(cal-menu-today-holidays): Remove function.
(cal-menu-holiday-window-suffix): Simplify.
(cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
(cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
Remove unused functions.
(calendar-mouse-view-diary-entries): Use format rather than concat.
(cal-menu-x-popup-menu): Turn it into a macro.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
(cal-menu-event-to-date): Remove function.
(calendar-mouse-holidays, calendar-mouse-view-diary-entries)
(calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
(cal-menu-set-date-title): Use calendar-cursor-to-date rather than
cal-menu-event-to-date.
(calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2)
(calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
(calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
(calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
(calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
(calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
Remove functions.
(cal-menu-context-mouse-menu): Replace the above functions with the
cal-tex versions. Add HTML submenu.
2008-06-18 02:56:39 +00:00
|
|
|
["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily]
|
|
|
|
["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week]
|
|
|
|
["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week]
|
|
|
|
["Filofax Yearly" cal-tex-cursor-filofax-year]))
|
|
|
|
("Write HTML calendar"
|
|
|
|
["For selected month" cal-html-cursor-month]
|
|
|
|
["For selected year" cal-html-cursor-year])
|
2008-06-26 05:02:04 +00:00
|
|
|
["Diary entries" calendar-mouse-view-diary-entries :keys "d"]
|
2008-06-17 15:42:19 +00:00
|
|
|
["Insert diary entry" diary-insert-entry]
|
2008-06-26 05:02:04 +00:00
|
|
|
["Other diary file entries" calendar-mouse-view-other-diary-entries
|
|
|
|
:keys "D"]))
|
2007-07-25 21:58:18 +00:00
|
|
|
|
|
|
|
(easy-menu-define cal-menu-global-mouse-menu nil
|
|
|
|
"Menu bound to a mouse event, not specific to the mouse-click location."
|
|
|
|
'("Calendar"
|
2007-07-27 06:15:40 +00:00
|
|
|
["Scroll forward" calendar-scroll-left-three-months]
|
|
|
|
["Scroll backward" calendar-scroll-right-three-months]
|
2008-04-06 20:54:25 +00:00
|
|
|
["Mark diary entries" diary-mark-entries]
|
2007-09-14 04:29:10 +00:00
|
|
|
["List holidays" calendar-list-holidays]
|
|
|
|
["Mark holidays" calendar-mark-holidays]
|
2007-07-25 21:58:18 +00:00
|
|
|
["Unmark" calendar-unmark]
|
2008-06-27 00:38:43 +00:00
|
|
|
["Lunar phases" calendar-lunar-phases]
|
2008-06-26 22:29:15 +00:00
|
|
|
["Sunrise times for month" calendar-sunrise-sunset-month]
|
2007-07-25 21:58:18 +00:00
|
|
|
["Show diary" diary-show-all-entries]
|
2008-04-08 07:04:17 +00:00
|
|
|
["Exit calendar" calendar-exit]))
|
1994-01-30 00:30:22 +00:00
|
|
|
|
2008-03-20 04:46:51 +00:00
|
|
|
;; Undocumented and probably useless.
|
|
|
|
(defvar cal-menu-load-hook nil
|
|
|
|
"Hook run on loading of the `cal-menu' package.")
|
|
|
|
(make-obsolete-variable 'cal-menu-load-hook
|
|
|
|
"it will be removed in future." "23.1")
|
|
|
|
|
1994-01-30 00:30:22 +00:00
|
|
|
(run-hooks 'cal-menu-load-hook)
|
|
|
|
|
|
|
|
(provide 'cal-menu)
|
|
|
|
|
2012-02-18 03:08:15 +00:00
|
|
|
;; Local Variables:
|
|
|
|
;; coding: utf-8
|
|
|
|
;; End:
|
|
|
|
|
1994-01-30 00:30:22 +00:00
|
|
|
;;; cal-menu.el ends here
|