1994-01-30 00:30:22 +00:00
|
|
|
;;; cal-menu.el --- calendar functions for menu bar and popup menu support
|
|
|
|
|
2008-03-15 02:57:13 +00:00
|
|
|
;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
2009-01-05 03:18:22 +00:00
|
|
|
;; 2008, 2009 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
|
|
|
|
|
|
|
|
;; 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]
|
2007-07-25 21:58:18 +00:00
|
|
|
("Insert Baha'i"
|
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]
|
2007-09-16 02:20:02 +00:00
|
|
|
["Baha'i 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"
|
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]
|
2008-06-26 03:42:12 +00:00
|
|
|
["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"])
|
|
|
|
"Key map for \"Scroll\" menu in the calendar.")
|
2003-08-17 22:48:54 +00:00
|
|
|
|
2008-08-11 01:23:07 +00:00
|
|
|
(declare-function x-popup-menu "xmenu.c" (position menu))
|
|
|
|
|
(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
|
|
|
|
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."
|
|
|
|
(easy-menu-filter-return
|
(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
|
|
|
menu (calendar-date-string (calendar-cursor-to-date t last-input-event)
|
|
|
|
t 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
|
1994-05-10 22:10:16 +00:00
|
|
|
"Pop up menu for Mouse-2 for selected date in the calendar window."
|
2008-04-08 07:04:17 +00:00
|
|
|
'("cal-menu-mouse2" :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]
|
2008-06-26 04:54:12 +00:00
|
|
|
;; FIXME there is a bug (#447) with last-nonmenu-event and submenus.
|
(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
|
|
|
;; These currently don't 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]
|
|
|
|
["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]
|
|
|
|
["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)
|
|
|
|
|
2005-11-01 19:55:19 +00:00
|
|
|
;; arch-tag: aa81cf73-ce89-48a4-97ec-9ef861e87fe9
|
1994-01-30 00:30:22 +00:00
|
|
|
;;; cal-menu.el ends here
|