annotate lisp/calendar/cal-menu.el @ 95401:67b3c5e7b37e

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Thu, 29 May 2008 23:00:20 +0000
parents e49abd957e81
children ea54c6f7a388
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
92962
b3d9a4a54d89 (cal-menu-goto-menu): Use "Go To".
Glenn Morris <rgm@gnu.org>
parents: 92907
diff changeset
3 ;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
b3d9a4a54d89 (cal-menu-goto-menu): Use "Go To".
Glenn Morris <rgm@gnu.org>
parents: 92907
diff changeset
4 ;; 2008 Free Software Foundation, Inc.
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
92854
5ddbb514b6c5 Whitespace only.
Glenn Morris <rgm@gnu.org>
parents: 92647
diff changeset
7 ;; Lara Rios <lrios@coewl.cen.uiuc.edu>
65919
5c09efcfc1d9 Update maintainer email address.
Glenn Morris <rgm@gnu.org>
parents: 65876
diff changeset
8 ;; Maintainer: Glenn Morris <rgm@gnu.org>
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; Keywords: calendar
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; Human-Keywords: calendar, popup menus, menu bar
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
94653
e49abd957e81 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94313
diff changeset
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
6736
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
94653
e49abd957e81 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94313
diff changeset
16 ;; the Free Software Foundation, either version 3 of the License, or
e49abd957e81 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94313
diff changeset
17 ;; (at your option) any later version.
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
6736
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
22 ;; GNU General Public License for more details.
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
23
3e1323443b1a Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents: 5701
diff changeset
24 ;; You should have received a copy of the GNU General Public License
94653
e49abd957e81 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94313
diff changeset
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
93485
bbd30b42485a (Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93328
diff changeset
29 ;; See calendar.el.
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; Code:
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
93224
e800589311a9 Require calendar rather than declaring functions.
Glenn Morris <rgm@gnu.org>
parents: 93092
diff changeset
33 (require 'calendar)
86491
341f1d128c8b Comment.
Glenn Morris <rgm@gnu.org>
parents: 86445
diff changeset
34
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
35 (defconst cal-menu-moon-menu
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
36 '("Moon"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
37 ["Lunar Phases" calendar-phases-of-moon]))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
39 (defconst cal-menu-diary-menu
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
40 '("Diary"
93793
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
41 ["Other File" diary-view-other-diary-entries]
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
42 ["Cursor Date" diary-view-entries]
93793
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
43 ["Mark All" diary-mark-entries]
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
44 ["Show All" diary-show-all-entries]
93793
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
45 ["Insert Diary Entry" diary-insert-entry]
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
46 ["Insert Weekly" diary-insert-weekly-entry]
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
47 ["Insert Monthly" diary-insert-monthly-entry]
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
48 ["Insert Yearly" diary-insert-yearly-entry]
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
49 ["Insert Anniversary" diary-insert-anniversary-entry]
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
50 ["Insert Block" diary-insert-block-entry]
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
51 ["Insert Cyclic" diary-insert-cyclic-entry]
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
52 ("Insert Baha'i"
84592
a2988c19b72c (cal-menu-diary-menu, cal-menu-goto-menu):
Glenn Morris <rgm@gnu.org>
parents: 84553
diff changeset
53 ["One time" diary-bahai-insert-entry]
a2988c19b72c (cal-menu-diary-menu, cal-menu-goto-menu):
Glenn Morris <rgm@gnu.org>
parents: 84553
diff changeset
54 ["Monthly" diary-bahai-insert-monthly-entry]
a2988c19b72c (cal-menu-diary-menu, cal-menu-goto-menu):
Glenn Morris <rgm@gnu.org>
parents: 84553
diff changeset
55 ["Yearly" diary-bahai-insert-yearly-entry])
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
56 ("Insert Islamic"
93649
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
57 ["One time" diary-islamic-insert-entry]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
58 ["Monthly" diary-islamic-insert-monthly-entry]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
59 ["Yearly" diary-islamic-insert-yearly-entry])
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
60 ("Insert Hebrew"
93742
370289920262 Update for chinese and hebrew name changes.
Glenn Morris <rgm@gnu.org>
parents: 93718
diff changeset
61 ["One time" diary-hebrew-insert-entry]
94313
17765ebde76c (cal-menu-diary-menu): Fix typo.
Glenn Morris <rgm@gnu.org>
parents: 93843
diff changeset
62 ["Monthly" diary-hebrew-insert-monthly-entry]
93742
370289920262 Update for chinese and hebrew name changes.
Glenn Morris <rgm@gnu.org>
parents: 93718
diff changeset
63 ["Yearly" diary-hebrew-insert-yearly-entry])))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
65 (defun cal-menu-holiday-window-suffix ()
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
66 "Return a string suffix for the \"Window\" entry in `cal-menu-holidays-menu'."
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
67 (let ((my1 (calendar-increment-month-cons -1))
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
68 (my2 (calendar-increment-month-cons 1)))
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
69 (if (= (cdr my1) (cdr my2))
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
70 (format "%s-%s, %d"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
71 (calendar-month-name (car my1) 'abbrev)
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
72 (calendar-month-name (car my2) 'abbrev)
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
73 (cdr my2))
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
74 (format "%s, %d-%s, %d"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
75 (calendar-month-name (car my1) 'abbrev)
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
76 (cdr my1)
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
77 (calendar-month-name (car my2) 'abbrev)
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
78 (cdr my2)))))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
80 (defvar displayed-year) ; from calendar-generate
92907
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
81
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
82 (defconst cal-menu-holidays-menu
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
83 `("Holidays"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
84 ["For Cursor Date -" calendar-cursor-holidays
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
85 :suffix (calendar-date-string (calendar-cursor-to-date) t t)
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
86 :visible (calendar-cursor-to-date)]
84553
383791965ba9 Rename all list-calendar-holidays callers to calendar-list-holidays,
Glenn Morris <rgm@gnu.org>
parents: 82202
diff changeset
87 ["For Window -" calendar-list-holidays
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
88 :suffix (cal-menu-holiday-window-suffix)]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
89 ["For Today -" cal-menu-today-holidays
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
90 :suffix (calendar-date-string (calendar-current-date) t t)]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
91 "--"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
92 ,@(let ((l ()))
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
93 ;; Show 11 years--5 before, 5 after year of middle month.
87769
d62f6920cb4d (cal-menu-holidays-menu): Comment update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
94 ;; We used to use :suffix rather than :label and bumped into
d62f6920cb4d (cal-menu-holidays-menu): Comment update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
95 ;; an easymenu bug:
86445
8385b57c5ce6 (cal-menu-holidays-menu): Use :label rather than :suffix.
Glenn Morris <rgm@gnu.org>
parents: 86430
diff changeset
96 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01813.html
87769
d62f6920cb4d (cal-menu-holidays-menu): Comment update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
97 ;; The bug has since been fixed.
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
98 (dotimes (i 11)
86445
8385b57c5ce6 (cal-menu-holidays-menu): Use :label rather than :suffix.
Glenn Morris <rgm@gnu.org>
parents: 86430
diff changeset
99 (push (vector (format "hol-year-%d" i)
86430
4c73f7497804 Revert previous commit, made without ChangeLog entry.
Glenn Morris <rgm@gnu.org>
parents: 86414
diff changeset
100 `(lambda ()
4c73f7497804 Revert previous commit, made without ChangeLog entry.
Glenn Morris <rgm@gnu.org>
parents: 86414
diff changeset
101 (interactive)
93328
15b0834c93df (cal-menu-holidays-menu, cal-menu-list-holidays-year)
Glenn Morris <rgm@gnu.org>
parents: 93224
diff changeset
102 (holiday-list (+ displayed-year ,(- i 5))))
86445
8385b57c5ce6 (cal-menu-holidays-menu): Use :label rather than :suffix.
Glenn Morris <rgm@gnu.org>
parents: 86430
diff changeset
103 :label `(format "For Year %d"
8385b57c5ce6 (cal-menu-holidays-menu): Use :label rather than :suffix.
Glenn Morris <rgm@gnu.org>
parents: 86430
diff changeset
104 (+ displayed-year ,(- i 5))))
86430
4c73f7497804 Revert previous commit, made without ChangeLog entry.
Glenn Morris <rgm@gnu.org>
parents: 86414
diff changeset
105 l))
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
106 (nreverse l))
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
107 "--"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
108 ["Unmark Calendar" calendar-unmark]
93485
bbd30b42485a (Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents: 93328
diff changeset
109 ["Mark Holidays" calendar-mark-holidays]))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
111 (defconst cal-menu-goto-menu
92962
b3d9a4a54d89 (cal-menu-goto-menu): Use "Go To".
Glenn Morris <rgm@gnu.org>
parents: 92907
diff changeset
112 '("Go To"
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
113 ["Today" calendar-goto-today]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
114 ["Beginning of Week" calendar-beginning-of-week]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
115 ["End of Week" calendar-end-of-week]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
116 ["Beginning of Month" calendar-beginning-of-month]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
117 ["End of Month" calendar-end-of-month]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
118 ["Beginning of Year" calendar-beginning-of-year]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
119 ["End of Year" calendar-end-of-year]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
120 ["Other Date" calendar-goto-date]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
121 ["Day of Year" calendar-goto-day-of-year]
93649
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
122 ["ISO Week" calendar-iso-goto-week]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
123 ["ISO Date" calendar-iso-goto-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
124 ["Astronomical Date" calendar-astro-goto-day-number]
93742
370289920262 Update for chinese and hebrew name changes.
Glenn Morris <rgm@gnu.org>
parents: 93718
diff changeset
125 ["Hebrew Date" calendar-hebrew-goto-date]
93649
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
126 ["Persian Date" calendar-persian-goto-date]
84592
a2988c19b72c (cal-menu-diary-menu, cal-menu-goto-menu):
Glenn Morris <rgm@gnu.org>
parents: 84553
diff changeset
127 ["Baha'i Date" calendar-bahai-goto-date]
93649
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
128 ["Islamic Date" calendar-islamic-goto-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
129 ["Julian Date" calendar-julian-goto-date]
93742
370289920262 Update for chinese and hebrew name changes.
Glenn Morris <rgm@gnu.org>
parents: 93718
diff changeset
130 ["Chinese Date" calendar-chinese-goto-date]
93718
2b79fd9755d7 Update for coptic and french name changes.
Glenn Morris <rgm@gnu.org>
parents: 93649
diff changeset
131 ["Coptic Date" calendar-coptic-goto-date]
2b79fd9755d7 Update for coptic and french name changes.
Glenn Morris <rgm@gnu.org>
parents: 93649
diff changeset
132 ["Ethiopic Date" calendar-ethiopic-goto-date]
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
133 ("Mayan Date"
93649
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
134 ["Next Tzolkin" calendar-mayan-next-tzolkin-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
135 ["Previous Tzolkin" calendar-mayan-previous-tzolkin-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
136 ["Next Haab" calendar-mayan-next-haab-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
137 ["Previous Haab" calendar-mayan-previous-haab-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
138 ["Next Round" calendar-mayan-next-round-date]
498835e424c8 Update for iso, islamic, julian, mayan, persian name changes.
Glenn Morris <rgm@gnu.org>
parents: 93485
diff changeset
139 ["Previous Round" calendar-mayan-previous-round-date])
93718
2b79fd9755d7 Update for coptic and french name changes.
Glenn Morris <rgm@gnu.org>
parents: 93649
diff changeset
140 ["French Date" calendar-french-goto-date]))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
142 (defconst cal-menu-scroll-menu
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
143 '("Scroll"
82149
2914fd1abc3e (cal-menu-scroll-menu, cal-menu-global-mouse-menu): Use new names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
144 ["Forward 1 Month" calendar-scroll-left]
2914fd1abc3e (cal-menu-scroll-menu, cal-menu-global-mouse-menu): Use new names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
145 ["Forward 3 Months" calendar-scroll-left-three-months]
94313
17765ebde76c (cal-menu-diary-menu): Fix typo.
Glenn Morris <rgm@gnu.org>
parents: 93843
diff changeset
146 ["Forward 1 Year" (calendar-scroll-left 12) :keys "4 C-v"]
82149
2914fd1abc3e (cal-menu-scroll-menu, cal-menu-global-mouse-menu): Use new names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
147 ["Backward 1 Month" calendar-scroll-right]
2914fd1abc3e (cal-menu-scroll-menu, cal-menu-global-mouse-menu): Use new names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
148 ["Backward 3 Months" calendar-scroll-right-three-months]
94313
17765ebde76c (cal-menu-diary-menu): Fix typo.
Glenn Morris <rgm@gnu.org>
parents: 93843
diff changeset
149 ["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"]))
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
150
39524
291264d596e9 (cal-menu-x-popup-menu): New function,
Eli Zaretskii <eliz@gnu.org>
parents: 39133
diff changeset
151 (defun cal-menu-x-popup-menu (position menu)
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
152 "Like `x-popup-menu', but print an error message if popups are unavailable.
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
153 POSITION and MENU are passed to `x-popup-menu'."
39524
291264d596e9 (cal-menu-x-popup-menu): New function,
Eli Zaretskii <eliz@gnu.org>
parents: 39133
diff changeset
154 (if (display-popup-menus-p)
291264d596e9 (cal-menu-x-popup-menu): New function,
Eli Zaretskii <eliz@gnu.org>
parents: 39133
diff changeset
155 (x-popup-menu position menu)
45058
5413ef3a62a3 (cal-menu-x-popup-menu): Fix argument of error call.
Pavel Janík <Pavel@Janik.cz>
parents: 43195
diff changeset
156 (error "Popup menus are not available on this system")))
39524
291264d596e9 (cal-menu-x-popup-menu): New function,
Eli Zaretskii <eliz@gnu.org>
parents: 39133
diff changeset
157
17667
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
158 (defun cal-menu-list-holidays-year ()
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
159 "Display a list of the holidays of the selected date's year."
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
160 (interactive)
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
161 (holiday-list (calendar-extract-year (calendar-cursor-to-date))))
17667
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
162
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
163 (defun cal-menu-list-holidays-following-year ()
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
164 "Display a list of the holidays of the following year."
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
165 (interactive)
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
166 (holiday-list (1+ (calendar-extract-year (calendar-cursor-to-date)))))
17667
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
167
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
168 (defun cal-menu-list-holidays-previous-year ()
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
169 "Display a list of the holidays of the previous year."
fd527e9aa377 (cal-menu-list-holidays-following-year)
Richard M. Stallman <rms@gnu.org>
parents: 17553
diff changeset
170 (interactive)
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
171 (holiday-list (1- (calendar-extract-year (calendar-cursor-to-date)))))
22027
aca7f8a34a9e Made holiday button on menu bar related to current calendar display.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 20424
diff changeset
172
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
173 (defun cal-menu-event-to-date (&optional error)
7442
27fdaecd7cb1 (calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 7412
diff changeset
174 "Date of last event.
27fdaecd7cb1 (calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 7412
diff changeset
175 If event is not on a specific date, signals an error if optional parameter
92907
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
176 ERROR is non-nil, otherwise just returns nil."
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
177 (with-current-buffer
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
178 (window-buffer (posn-window (event-start last-input-event)))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 (goto-char (posn-point (event-start last-input-event)))
7442
27fdaecd7cb1 (calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 7412
diff changeset
180 (calendar-cursor-to-date error)))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181
92907
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
182 (defun calendar-mouse-goto-date (date)
92962
b3d9a4a54d89 (cal-menu-goto-menu): Use "Go To".
Glenn Morris <rgm@gnu.org>
parents: 92907
diff changeset
183 "Go to DATE in the buffer specified by `last-input-event'."
92907
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
184 (set-buffer (window-buffer (posn-window (event-start last-input-event))))
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
185 (calendar-goto-date date))
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
186
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (defun calendar-mouse-sunrise/sunset ()
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 "Show sunrise/sunset times for mouse-selected date."
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (interactive)
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
191 (calendar-mouse-goto-date (cal-menu-event-to-date))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (calendar-sunrise-sunset)))
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193
22031
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
194 (defun cal-menu-today-holidays ()
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
195 "Show holidays for today's date."
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
196 (interactive)
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
197 (save-excursion
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
198 (calendar-cursor-to-date (calendar-current-date))
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
199 (calendar-cursor-holidays)))
879df83433a1 Minor fix to earlier changes today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22027
diff changeset
200
84553
383791965ba9 Rename all list-calendar-holidays callers to calendar-list-holidays,
Glenn Morris <rgm@gnu.org>
parents: 82202
diff changeset
201 (autoload 'calendar-check-holidays "holidays")
65510
24f7082aa7af Don't require easymenu, since we don't use it.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65145
diff changeset
202
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
203 (defun calendar-mouse-holidays (&optional event)
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
204 "Pop up menu of holidays for mouse selected date.
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
205 EVENT is the event that invoked this command."
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
206 (interactive "e")
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
207 (let* ((date (cal-menu-event-to-date))
93092
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
208 (title (format "Holidays for %s" (calendar-date-string date)))
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
209 (selection
39524
291264d596e9 (cal-menu-x-popup-menu): New function,
Eli Zaretskii <eliz@gnu.org>
parents: 39133
diff changeset
210 (cal-menu-x-popup-menu
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
211 event
93092
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
212 (list title
93328
15b0834c93df (cal-menu-holidays-menu, cal-menu-list-holidays-year)
Glenn Morris <rgm@gnu.org>
parents: 93224
diff changeset
213 (append (list title)
15b0834c93df (cal-menu-holidays-menu, cal-menu-list-holidays-year)
Glenn Morris <rgm@gnu.org>
parents: 93224
diff changeset
214 (or (mapcar 'list (calendar-check-holidays date))
15b0834c93df (cal-menu-holidays-menu, cal-menu-list-holidays-year)
Glenn Morris <rgm@gnu.org>
parents: 93224
diff changeset
215 '("None")))))))
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
216 (and selection (call-interactively selection))))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217
93328
15b0834c93df (cal-menu-holidays-menu, cal-menu-list-holidays-year)
Glenn Morris <rgm@gnu.org>
parents: 93224
diff changeset
218 (autoload 'diary-list-entries "diary-lib")
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
219 (defvar diary-show-holidays-flag) ; only called from calendar.el
92549
389da10cb238 (holidays-in-diary-buffer): Declare for compiler.
Glenn Morris <rgm@gnu.org>
parents: 87769
diff changeset
220
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
221 (defun calendar-mouse-view-diary-entries (&optional date diary event)
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
222 "Pop up menu of diary entries for mouse-selected date.
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
223 Use optional DATE and alternative file DIARY. EVENT is the event
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
224 that invoked this command. Shows holidays if `diary-show-holidays-flag'
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
225 is non-nil."
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
226 (interactive "i\ni\ne")
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
227 (let* ((date (or date (cal-menu-event-to-date)))
93092
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
228 (diary-file (or diary diary-file))
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
229 (diary-list-include-blanks nil)
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
230 (diary-display-hook 'ignore)
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
231 (diary-entries
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
232 (mapcar (lambda (x) (split-string (cadr x) "\n"))
65876
33868a8b76d1 (calendar-mouse-view-diary-entries): Use the new arg to diary-list-entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65510
diff changeset
233 (diary-list-entries date 1 'list-only)))
93809
3ff2b47de8f2 Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents: 93793
diff changeset
234 (holidays (if diary-show-holidays-flag
84553
383791965ba9 Rename all list-calendar-holidays callers to calendar-list-holidays,
Glenn Morris <rgm@gnu.org>
parents: 82202
diff changeset
235 (calendar-check-holidays date)))
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
236 (title (concat "Diary entries "
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
237 (if diary (format "from %s " diary) "")
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
238 "for "
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
239 (calendar-date-string date)))
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
240 (selection
39524
291264d596e9 (cal-menu-x-popup-menu): New function,
Eli Zaretskii <eliz@gnu.org>
parents: 39133
diff changeset
241 (cal-menu-x-popup-menu
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
242 event
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
243 (list title
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
244 (append
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
245 (list title)
65510
24f7082aa7af Don't require easymenu, since we don't use it.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65145
diff changeset
246 (mapcar (lambda (x) (list (concat " " x))) holidays)
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
247 (if holidays
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
248 (list "--shadow-etched-in" "--shadow-etched-in"))
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
249 (if diary-entries
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
250 (mapcar 'list (apply 'append diary-entries))
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
251 '("None")))))))
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
252 (and selection (call-interactively selection))))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
9766
71c37f31a02d Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 9734
diff changeset
254 (defun calendar-mouse-view-other-diary-entries ()
22413
be2f536a1358 Rewrote calendar-mouse-holidays, calendar-mouse-view-diary-entries,
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22365
diff changeset
255 "Pop up menu of diary entries from alternative file on mouse-selected date."
9766
71c37f31a02d Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 9734
diff changeset
256 (interactive)
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
257 (calendar-mouse-view-diary-entries
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
258 (cal-menu-event-to-date)
52230
75388c0f3104 Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents: 52116
diff changeset
259 (read-file-name "Enter diary file name: " default-directory nil t)))
9766
71c37f31a02d Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 9734
diff changeset
260
9710
b5fb08fb2cb3 Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 8308
diff changeset
261 (defun calendar-mouse-insert-diary-entry ()
b5fb08fb2cb3 Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 8308
diff changeset
262 "Insert diary entry for mouse-selected date."
b5fb08fb2cb3 Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 8308
diff changeset
263 (interactive)
b5fb08fb2cb3 Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 8308
diff changeset
264 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
265 (calendar-mouse-goto-date (cal-menu-event-to-date))
93793
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
266 (diary-insert-entry nil)))
9710
b5fb08fb2cb3 Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 8308
diff changeset
267
7412
f067e1a5ceb4 (calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7403
diff changeset
268 (defun calendar-mouse-set-mark ()
f067e1a5ceb4 (calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7403
diff changeset
269 "Mark the date under the cursor."
f067e1a5ceb4 (calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7403
diff changeset
270 (interactive)
f067e1a5ceb4 (calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7403
diff changeset
271 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
272 (calendar-mouse-goto-date (cal-menu-event-to-date))
7412
f067e1a5ceb4 (calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7403
diff changeset
273 (calendar-set-mark nil)))
f067e1a5ceb4 (calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents: 7403
diff changeset
274
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
275 (defun calendar-mouse-tex-day ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
276 "Make a buffer with LaTeX commands for the day mouse is on."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
277 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
278 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
279 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
280 (cal-tex-cursor-day nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
281
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
282 (defun calendar-mouse-tex-week ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
283 "One page calendar for week indicated by cursor.
92907
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
284 Holidays are included if `cal-tex-holidays' is non-nil."
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
285 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
286 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
287 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
288 (cal-tex-cursor-week nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
289
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
290 (defun calendar-mouse-tex-week2 ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
291 "Make a buffer with LaTeX commands for the week cursor is on.
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
292 The printed output will be on two pages."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
293 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
294 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
295 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
296 (cal-tex-cursor-week2 nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
297
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
298 (defun calendar-mouse-tex-week-iso ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
299 "One page calendar for week indicated by cursor.
92907
d89709effe07 (displayed-year): Move declaration where needed.
Glenn Morris <rgm@gnu.org>
parents: 92854
diff changeset
300 Holidays are included if `cal-tex-holidays' is non-nil."
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
301 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
302 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
303 (calendar-mouse-goto-date (cal-menu-event-to-date))
13689
a04244ec8530 Repair function names from rms error in modifying!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13285
diff changeset
304 (cal-tex-cursor-week-iso nil)))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
305
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
306 (defun calendar-mouse-tex-week-monday ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
307 "One page calendar for week indicated by cursor."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
308 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
309 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
310 (calendar-mouse-goto-date (cal-menu-event-to-date))
13689
a04244ec8530 Repair function names from rms error in modifying!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13285
diff changeset
311 (cal-tex-cursor-week-monday nil)))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
312
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
313 (defun calendar-mouse-tex-filofax-daily ()
19975
927a8710de05 (cal-tex-mouse-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19950
diff changeset
314 "Day-per-page Filofax calendar for week indicated by cursor."
927a8710de05 (cal-tex-mouse-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19950
diff changeset
315 (interactive)
927a8710de05 (cal-tex-mouse-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19950
diff changeset
316 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
317 (calendar-mouse-goto-date (cal-menu-event-to-date))
19975
927a8710de05 (cal-tex-mouse-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19950
diff changeset
318 (cal-tex-cursor-filofax-daily nil)))
927a8710de05 (cal-tex-mouse-filofax-daily): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19950
diff changeset
319
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
320 (defun calendar-mouse-tex-filofax-2week ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
321 "One page Filofax calendar for week indicated by cursor."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
322 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
323 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
324 (calendar-mouse-goto-date (cal-menu-event-to-date))
13690
8a3ceaf9bfee More repairs of wrong function names in menus!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13689
diff changeset
325 (cal-tex-cursor-filofax-2week nil)))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
326
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
327 (defun calendar-mouse-tex-filofax-week ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
328 "Two page Filofax calendar for week indicated by cursor."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
329 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
330 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
331 (calendar-mouse-goto-date (cal-menu-event-to-date))
13690
8a3ceaf9bfee More repairs of wrong function names in menus!
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13689
diff changeset
332 (cal-tex-cursor-filofax-week nil)))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
333
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
334 (defun calendar-mouse-tex-month ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
335 "Make a buffer with LaTeX commands for the month cursor is on.
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
336 Calendar is condensed onto one page."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
337 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
338 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
339 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
340 (cal-tex-cursor-month nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
341
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
342 (defun calendar-mouse-tex-month-landscape ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
343 "Make a buffer with LaTeX commands for the month cursor is on.
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
344 The output is in landscape format, one month to a page."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
345 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
346 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
347 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
348 (cal-tex-cursor-month-landscape nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
349
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
350 (defun calendar-mouse-tex-year ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
351 "Make a buffer with LaTeX commands for the year cursor is on."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
352 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
353 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
354 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
355 (cal-tex-cursor-year nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
356
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
357 (defun calendar-mouse-tex-filofax-year ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
358 "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
359 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
360 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
361 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
362 (cal-tex-cursor-filofax-year nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
363
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
364 (defun calendar-mouse-tex-year-landscape ()
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
365 "Make a buffer with LaTeX commands for the year cursor is on."
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
366 (interactive)
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
367 (save-excursion
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
368 (calendar-mouse-goto-date (cal-menu-event-to-date))
13194
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
369 (cal-tex-cursor-year-landscape nil)))
7e90c5fce35f Added menu items for cal-tex.el (a new file).
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 13063
diff changeset
370
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
371 (defun calendar-mouse-print-dates (&optional event)
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
372 "Pop up menu of equivalent dates to mouse selected date.
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
373 EVENT is the event that invoked this command."
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
374 (interactive "e")
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
375 (let* ((date (cal-menu-event-to-date))
93092
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
376 (title (format "%s (Gregorian)" (calendar-date-string date)))
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
377 (selection
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
378 (cal-menu-x-popup-menu
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
379 event
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
380 (list title
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
381 (append (list title)
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
382 (mapcar 'list (calendar-other-dates date)))))))
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
383 (and selection (call-interactively selection))))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
385 (defun cal-menu-set-date-title (menu)
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
386 "Convert date of last event to title suitable for MENU."
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
387 (easy-menu-filter-return
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
388 menu (calendar-date-string (cal-menu-event-to-date t) t nil)))
92647
8b4648ec6f76 (cal-menu-holiday-window-suffix)
Glenn Morris <rgm@gnu.org>
parents: 92549
diff changeset
389
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
390 (easy-menu-define cal-menu-context-mouse-menu nil
7442
27fdaecd7cb1 (calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 7412
diff changeset
391 "Pop up menu for Mouse-2 for selected date in the calendar window."
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
392 '("cal-menu-mouse2" :filter cal-menu-set-date-title
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
393 "--"
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
394 ["Holidays" calendar-mouse-holidays]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
395 ["Mark date" calendar-mouse-set-mark]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
396 ["Sunrise/sunset" calendar-mouse-sunrise/sunset]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
397 ["Other calendars" calendar-mouse-print-dates]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
398 ("Prepare LaTeX buffer"
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
399 ["Daily (1 page)" calendar-mouse-tex-day]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
400 ["Weekly (1 page)" calendar-mouse-tex-week]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
401 ["Weekly (2 pages)" calendar-mouse-tex-week2]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
402 ["Weekly (other style; 1 page)" calendar-mouse-tex-week-iso]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
403 ["Weekly (yet another style; 1 page)" calendar-mouse-tex-week-monday]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
404 ["Monthly" calendar-mouse-tex-month]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
405 ["Monthly (landscape)" calendar-mouse-tex-month-landscape]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
406 ["Yearly" calendar-mouse-tex-year]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
407 ["Yearly (landscape)" calendar-mouse-tex-year-landscape]
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
408 ("Filofax styles"
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
409 ["Filofax Daily (one-day-per-page)" calendar-mouse-tex-filofax-daily]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
410 ["Filofax Weekly (2-weeks-at-a-glance)" calendar-mouse-tex-filofax-2week]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
411 ["Filofax Weekly (week-at-a-glance)" calendar-mouse-tex-filofax-week]
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
412 ["Filofax Yearly" calendar-mouse-tex-filofax-year]))
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
413 ["Diary entries" calendar-mouse-view-diary-entries]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
414 ["Insert diary entry" calendar-mouse-insert-diary-entry]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
415 ["Other diary file entries" calendar-mouse-view-other-diary-entries]))
7442
27fdaecd7cb1 (calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 7412
diff changeset
416
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
417 (easy-menu-define cal-menu-global-mouse-menu nil
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
418 "Menu bound to a mouse event, not specific to the mouse-click location."
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
419 '("Calendar"
82149
2914fd1abc3e (cal-menu-scroll-menu, cal-menu-global-mouse-menu): Use new names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
420 ["Scroll forward" calendar-scroll-left-three-months]
2914fd1abc3e (cal-menu-scroll-menu, cal-menu-global-mouse-menu): Use new names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
421 ["Scroll backward" calendar-scroll-right-three-months]
93793
5c3eedca8e41 Update for diary-lib name changes.
Glenn Morris <rgm@gnu.org>
parents: 93742
diff changeset
422 ["Mark diary entries" diary-mark-entries]
84553
383791965ba9 Rename all list-calendar-holidays callers to calendar-list-holidays,
Glenn Morris <rgm@gnu.org>
parents: 82202
diff changeset
423 ["List holidays" calendar-list-holidays]
383791965ba9 Rename all list-calendar-holidays callers to calendar-list-holidays,
Glenn Morris <rgm@gnu.org>
parents: 82202
diff changeset
424 ["Mark holidays" calendar-mark-holidays]
82117
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
425 ["Unmark" calendar-unmark]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
426 ["Lunar phases" calendar-phases-of-moon]
8410b0ff0e7a Break dependency on calendar.el (i.e. do not modify calendar-mode-map),
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
427 ["Show diary" diary-show-all-entries]
93843
61357badb5fa (cal-menu-event-to-date): Rename calendar-event-to-date. Update callers.
Glenn Morris <rgm@gnu.org>
parents: 93809
diff changeset
428 ["Exit calendar" calendar-exit]))
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429
93092
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
430 ;; Undocumented and probably useless.
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
431 (defvar cal-menu-load-hook nil
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
432 "Hook run on loading of the `cal-menu' package.")
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
433 (make-obsolete-variable 'cal-menu-load-hook
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
434 "it will be removed in future." "23.1")
6c0dbddcd03a (calendar-other-dates): Declare it, and removes the declarations it replaces.
Glenn Morris <rgm@gnu.org>
parents: 92962
diff changeset
435
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (run-hooks 'cal-menu-load-hook)
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 (provide 'cal-menu)
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439
66617
ed95f221960d (date, event): Don't declare as dynamic-var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 65919
diff changeset
440 ;; arch-tag: aa81cf73-ce89-48a4-97ec-9ef861e87fe9
5701
b2f1e7bb5d00 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 ;;; cal-menu.el ends here