Mercurial > emacs
annotate lisp/calendar/cal-menu.el @ 13054:b2df0396fae2
(rmail-file-p): Function moved to mail-utils.el
and renamed to mail-file-babyl-p.
(rmail-output, rmail-output-to-rmail-file): Use new name.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 21 Sep 1995 20:20:11 +0000 |
parents | 6c3c9645fbfd |
children | 30ee606ce331 |
rev | line source |
---|---|
5701 | 1 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support |
2 | |
13047
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
3 ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc. |
5701 | 4 |
5 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | |
6 ;; Lara Rios <lrios@coewl.cen.uiuc.edu> | |
7 ;; Keywords: calendar | |
8 ;; Human-Keywords: calendar, popup menus, menu bar | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
15 ;; any later version. |
5701 | 16 |
6736
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
17 ;; 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
|
18 ;; 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
|
19 ;; 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
|
20 ;; 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
|
21 |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to |
3e1323443b1a
Fix copying conditions for current GPL version.
Richard M. Stallman <rms@gnu.org>
parents:
5701
diff
changeset
|
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
5701 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; This collection of functions implements menu bar and popup menu support for | |
29 ;; calendar.el. | |
30 | |
31 ;; Comments, corrections, and improvements should be sent to | |
32 ;; Edward M. Reingold Department of Computer Science | |
33 ;; (217) 333-6733 University of Illinois at Urbana-Champaign | |
34 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue | |
35 ;; Urbana, Illinois 61801 | |
36 | |
37 ;;; Code: | |
38 | |
9999
8187800943e7
Get rid of edit menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9766
diff
changeset
|
39 (define-key calendar-mode-map [menu-bar edit] 'undefined) |
8187800943e7
Get rid of edit menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9766
diff
changeset
|
40 |
7478
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
41 (define-key calendar-mode-map [down-mouse-2] 'calendar-mouse-2-date-menu) |
7713
44a712d8ba03
(calendar-mode-map): Define mouse-2 as ignore.
Richard M. Stallman <rms@gnu.org>
parents:
7576
diff
changeset
|
42 (define-key calendar-mode-map [mouse-2] 'ignore) |
7478
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
43 |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
44 (defvar calendar-mouse-3-map (make-sparse-keymap "Calendar")) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
45 (define-key calendar-mode-map [down-mouse-3] calendar-mouse-3-map) |
9734
051c27bcbc22
(calendar-mode-map): Define c-down-mouse-3 like down-mouse-3.
Richard M. Stallman <rms@gnu.org>
parents:
9710
diff
changeset
|
46 (define-key calendar-mode-map [C-down-mouse-3] calendar-mouse-3-map) |
5701 | 47 |
7887
a5e6f7045bc0
(calendar-mode-map): Change moon menu bar to pop up a menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7886
diff
changeset
|
48 (define-key calendar-mode-map [menu-bar moon] |
a5e6f7045bc0
(calendar-mode-map): Change moon menu bar to pop up a menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7886
diff
changeset
|
49 (cons "Moon" (make-sparse-keymap "Moon"))) |
a5e6f7045bc0
(calendar-mode-map): Change moon menu bar to pop up a menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7886
diff
changeset
|
50 |
a5e6f7045bc0
(calendar-mode-map): Change moon menu bar to pop up a menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7886
diff
changeset
|
51 (define-key calendar-mode-map [menu-bar moon moon] |
12033 | 52 '("Lunar Phases" . calendar-phases-of-moon)) |
7887
a5e6f7045bc0
(calendar-mode-map): Change moon menu bar to pop up a menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7886
diff
changeset
|
53 |
5701 | 54 (define-key calendar-mode-map [menu-bar diary] |
55 (cons "Diary" (make-sparse-keymap "Diary"))) | |
56 | |
57 (define-key calendar-mode-map [menu-bar diary heb] | |
58 '("Insert Hebrew" . calendar-mouse-insert-hebrew-diary-entry)) | |
59 (define-key calendar-mode-map [menu-bar diary isl] | |
60 '("Insert Islamic" . calendar-mouse-insert-islamic-diary-entry)) | |
61 (define-key calendar-mode-map [menu-bar diary cyc] | |
12033 | 62 '("Insert Cyclic" . insert-cyclic-diary-entry)) |
5701 | 63 (define-key calendar-mode-map [menu-bar diary blk] |
12033 | 64 '("Insert Block" . insert-block-diary-entry)) |
5701 | 65 (define-key calendar-mode-map [menu-bar diary ann] |
12033 | 66 '("Insert Anniversary" . insert-anniversary-diary-entry)) |
5701 | 67 (define-key calendar-mode-map [menu-bar diary yr] |
12033 | 68 '("Insert Yearly" . insert-yearly-diary-entry)) |
5701 | 69 (define-key calendar-mode-map [menu-bar diary mon] |
12033 | 70 '("Insert Monthly" . insert-monthly-diary-entry)) |
5701 | 71 (define-key calendar-mode-map [menu-bar diary wk] |
12033 | 72 '("Insert Weekly" . insert-weekly-diary-entry)) |
5701 | 73 (define-key calendar-mode-map [menu-bar diary ent] |
12033 | 74 '("Insert Daily". insert-diary-entry)) |
5701 | 75 (define-key calendar-mode-map [menu-bar diary all] |
12033 | 76 '("Show All" . show-all-diary-entries)) |
5701 | 77 (define-key calendar-mode-map [menu-bar diary mark] |
12033 | 78 '("Mark All" . mark-diary-entries)) |
5701 | 79 (define-key calendar-mode-map [menu-bar diary view] |
12033 | 80 '("Cursor Date" . view-diary-entries)) |
9766
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
81 (define-key calendar-mode-map [menu-bar diary view] |
12033 | 82 '("Other File" . view-other-diary-entries)) |
5701 | 83 |
84 (define-key calendar-mode-map [menu-bar holidays] | |
85 (cons "Holidays" (make-sparse-keymap "Holidays"))) | |
86 | |
87 (define-key calendar-mode-map [menu-bar holidays unmark] | |
88 '("Unmark" . calendar-unmark)) | |
89 (define-key calendar-mode-map [menu-bar holidays mark] | |
90 '("Mark" . mark-calendar-holidays)) | |
91 (define-key calendar-mode-map [menu-bar holidays 3-mon] | |
12033 | 92 '("3 Months" . list-calendar-holidays)) |
5701 | 93 (define-key calendar-mode-map [menu-bar holidays 1-day] |
12033 | 94 '("One Day" . calendar-cursor-holidays)) |
5701 | 95 |
96 (define-key calendar-mode-map [menu-bar goto] | |
97 (cons "Goto" (make-sparse-keymap "Goto"))) | |
98 | |
99 (define-key calendar-mode-map [menu-bar goto french] | |
12033 | 100 '("French Date" . calendar-goto-french-date)) |
5701 | 101 (define-key calendar-mode-map [menu-bar goto mayan] |
12033 | 102 (cons "Mayan Date" (make-sparse-keymap "Mayan"))) |
13047
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
103 (define-key calendar-mode-map [menu-bar goto ethiopic] |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
104 '("Ethiopic Date" . calendar-goto-ethiopic-date)) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
105 (define-key calendar-mode-map [menu-bar goto coptic] |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
106 '("Coptic Date" . calendar-goto-coptic-date)) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
107 (define-key calendar-mode-map [menu-bar goto chinese] |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
108 '("Chinese Date" . calendar-goto-chinese-date)) |
5701 | 109 (define-key calendar-mode-map [menu-bar goto julian] |
12033 | 110 '("Julian Date" . calendar-goto-julian-date)) |
5701 | 111 (define-key calendar-mode-map [menu-bar goto islamic] |
12033 | 112 '("Islamic Date" . calendar-goto-islamic-date)) |
5701 | 113 (define-key calendar-mode-map [menu-bar goto hebrew] |
12033 | 114 '("Hebrew Date" . calendar-goto-hebrew-date)) |
5701 | 115 (define-key calendar-mode-map [menu-bar goto astro] |
12033 | 116 '("Astronomical Date" . calendar-goto-astro-day-number)) |
5701 | 117 (define-key calendar-mode-map [menu-bar goto iso] |
12033 | 118 '("ISO Date" . calendar-goto-iso-date)) |
5701 | 119 (define-key calendar-mode-map [menu-bar goto gregorian] |
12033 | 120 '("Other Date" . calendar-goto-date)) |
5701 | 121 (define-key calendar-mode-map [menu-bar goto end-of-year] |
12033 | 122 '("End of Year" . calendar-end-of-year)) |
5701 | 123 (define-key calendar-mode-map [menu-bar goto beginning-of-year] |
12033 | 124 '("Beginning of Year" . calendar-beginning-of-year)) |
5701 | 125 (define-key calendar-mode-map [menu-bar goto end-of-month] |
12033 | 126 '("End of Month" . calendar-end-of-month)) |
5701 | 127 (define-key calendar-mode-map [menu-bar goto beginning-of-month] |
12033 | 128 '("Beginning of Month" . calendar-beginning-of-month)) |
5701 | 129 (define-key calendar-mode-map [menu-bar goto end-of-week] |
12033 | 130 '("End of Week" . calendar-end-of-week)) |
5701 | 131 (define-key calendar-mode-map [menu-bar goto beginning-of-week] |
12033 | 132 '("Beginning of Week" . calendar-beginning-of-week)) |
5701 | 133 (define-key calendar-mode-map [menu-bar goto today] |
8308
9c9cbb121c37
Change reference from renamed calendar-current-month to calendar-goto-today.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7887
diff
changeset
|
134 '("Today" . calendar-goto-today)) |
5701 | 135 |
136 | |
137 (define-key calendar-mode-map [menu-bar goto mayan prev-rnd] | |
138 '("Previous Round" . calendar-previous-calendar-round-date)) | |
139 (define-key calendar-mode-map [menu-bar goto mayan nxt-rnd] | |
140 '("Next Round" . calendar-next-calendar-round-date)) | |
141 (define-key calendar-mode-map [menu-bar goto mayan prev-haab] | |
142 '("Previous Haab" . calendar-previous-haab-date)) | |
143 (define-key calendar-mode-map [menu-bar goto mayan next-haab] | |
144 '("Next Haab" . calendar-next-haab-date)) | |
145 (define-key calendar-mode-map [menu-bar goto mayan prev-tzol] | |
146 '("Previous Tzolkin" . calendar-previous-tzolkin-date)) | |
147 (define-key calendar-mode-map [menu-bar goto mayan next-tzol] | |
148 '("Next Tzolkin" . calendar-next-tzolkin-date)) | |
149 | |
150 (define-key calendar-mode-map [menu-bar scroll] | |
151 (cons "Scroll" (make-sparse-keymap "Scroll"))) | |
152 | |
153 (define-key calendar-mode-map [menu-bar scroll bk-12] | |
154 '("Backward 1 Year" . "4\ev")) | |
155 (define-key calendar-mode-map [menu-bar scroll bk-3] | |
156 '("Backward 3 Months" . scroll-calendar-right-three-months)) | |
157 (define-key calendar-mode-map [menu-bar scroll bk-1] | |
158 '("Backward 1 Month" . scroll-calendar-right)) | |
159 (define-key calendar-mode-map [menu-bar scroll fwd-12] | |
160 '("Forward 1 Year" . "4\C-v")) | |
161 (define-key calendar-mode-map [menu-bar scroll fwd-3] | |
162 '("Forward 3 Months" . scroll-calendar-left-three-months)) | |
163 (define-key calendar-mode-map [menu-bar scroll fwd-1] | |
164 '("Forward 1 Month" . scroll-calendar-left)) | |
165 | |
166 (put 'calendar-forward-day 'menu-enable '(calendar-cursor-to-date)) | |
167 (put 'calendar-backward-day 'menu-enable '(calendar-cursor-to-date)) | |
168 (put 'calendar-forward-week 'menu-enable '(calendar-cursor-to-date)) | |
169 (put 'calendar-backward-week 'menu-enable '(calendar-cursor-to-date)) | |
170 (put 'calendar-forward-month 'menu-enable '(calendar-cursor-to-date)) | |
171 (put 'calendar-backward-month 'menu-enable '(calendar-cursor-to-date)) | |
172 (put 'calendar-forward-year 'menu-enable '(calendar-cursor-to-date)) | |
173 (put 'calendar-backward-year 'menu-enable '(calendar-cursor-to-date)) | |
174 (put 'calendar-beginning-of-year 'menu-enable '(calendar-cursor-to-date)) | |
175 (put 'calendar-end-of-year 'menu-enable '(calendar-cursor-to-date)) | |
176 (put 'calendar-beginning-of-month 'menu-enable '(calendar-cursor-to-date)) | |
177 (put 'calendar-end-of-month 'menu-enable '(calendar-cursor-to-date)) | |
178 (put 'calendar-end-of-week 'menu-enable '(calendar-cursor-to-date)) | |
179 (put 'calendar-beginning-of-week 'menu-enable '(calendar-cursor-to-date)) | |
180 (put 'calendar-mouse-print-dates 'menu-enable '(calendar-event-to-date)) | |
181 (put 'calendar-sunrise-sunset 'menu-enable '(calendar-event-to-date)) | |
182 (put 'calendar-cursor-holidays 'menu-enable '(calendar-cursor-to-date)) | |
183 (put 'view-diary-entries 'menu-enable '(calendar-cursor-to-date)) | |
9766
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
184 (put 'view-other-diary-entries 'menu-enable '(calendar-cursor-to-date)) |
5701 | 185 (put 'calendar-mouse-insert-hebrew-diary-entry |
186 'menu-enable | |
187 '(calendar-cursor-to-date)) | |
188 (put 'calendar-mouse-insert-islamic-diary-entry | |
189 'menu-enable | |
190 '(calendar-cursor-to-date)) | |
191 (put 'insert-cyclic-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
192 (put 'insert-block-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
193 (put 'insert-anniversary-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
194 (put 'insert-yearly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
195 (put 'insert-monthly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
196 (put 'insert-weekly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
197 | |
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
|
198 (defun calendar-event-to-date (&optional error) |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
199 "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
|
200 If event is not on a specific date, signals an error if optional parameter |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
201 ERROR is t, otherwise just returns nil." |
5701 | 202 (save-excursion |
203 (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
|
204 (calendar-cursor-to-date error))) |
5701 | 205 |
206 (defun calendar-mouse-insert-hebrew-diary-entry (event) | |
207 "Pop up menu to insert a Hebrew-date diary entry." | |
208 (interactive "e") | |
209 (let ((hebrew-selection | |
210 (x-popup-menu | |
211 event | |
212 (list "Hebrew insert menu" | |
213 (list (calendar-hebrew-date-string (calendar-cursor-to-date)) | |
214 '("One time" . insert-hebrew-diary-entry) | |
215 '("Monthly" . insert-monthly-hebrew-diary-entry) | |
216 '("Yearly" . insert-yearly-hebrew-diary-entry)))))) | |
217 (and hebrew-selection (call-interactively hebrew-selection)))) | |
218 | |
219 (defun calendar-mouse-insert-islamic-diary-entry (event) | |
220 "Pop up menu to insert an Islamic-date diary entry." | |
221 (interactive "e") | |
222 (let ((islamic-selection | |
223 (x-popup-menu | |
224 event | |
225 (list "Islamic insert menu" | |
226 (list (calendar-islamic-date-string (calendar-cursor-to-date)) | |
227 '("One time" . insert-islamic-diary-entry) | |
228 '("Monthly" . insert-monthly-islamic-diary-entry) | |
229 '("Yearly" . insert-yearly-islamic-diary-entry)))))) | |
230 (and islamic-selection (call-interactively islamic-selection)))) | |
231 | |
232 (defun calendar-mouse-sunrise/sunset () | |
233 "Show sunrise/sunset times for mouse-selected date." | |
234 (interactive) | |
235 (save-excursion | |
236 (calendar-goto-date (calendar-event-to-date)) | |
237 (calendar-sunrise-sunset))) | |
238 | |
239 (defun calendar-mouse-holidays () | |
240 "Show holidays for mouse-selected date." | |
241 (interactive) | |
242 (save-excursion | |
243 (calendar-goto-date (calendar-event-to-date)) | |
244 (calendar-cursor-holidays))) | |
245 | |
246 (defun calendar-mouse-view-diary-entries () | |
247 "View diary entries on mouse-selected date." | |
248 (interactive) | |
249 (save-excursion | |
250 (calendar-goto-date (calendar-event-to-date)) | |
251 (view-diary-entries 1))) | |
252 | |
9766
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
253 (defun calendar-mouse-view-other-diary-entries () |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
254 "View diary entries from alternative file on mouse-selected date." |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
255 (interactive) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
256 (save-excursion |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
257 (calendar-goto-date (calendar-event-to-date)) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
258 (call-interactively 'view-other-diary-entries))) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
259 |
9710
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
260 (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
|
261 "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
|
262 (interactive) |
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
263 (save-excursion |
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
264 (calendar-goto-date (calendar-event-to-date)) |
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
265 (insert-diary-entry nil))) |
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
266 |
7412
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
267 (defun calendar-mouse-set-mark () |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
268 "Mark the date under the cursor." |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
269 (interactive) |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
270 (save-excursion |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
271 (calendar-goto-date (calendar-event-to-date)) |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
272 (calendar-set-mark nil))) |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
273 |
5701 | 274 (defun calendar-mouse-print-dates () |
275 "Pop up menu of equivalent dates to mouse selected date." | |
276 (interactive) | |
13047
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
277 (let ((date (calendar-event-to-date)) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
278 (selection |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
279 (x-popup-menu |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
280 event |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
281 (list |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
282 "Date Menu" |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
283 (append |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
284 (list |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
285 (concat (calendar-date-string date) " (Gregorian)") |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
286 (list (calendar-day-of-year-string date)) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
287 (list (format "ISO date: %s" (calendar-iso-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
288 (list (format "Julian date: %s" |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
289 (calendar-julian-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
290 (list |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
291 (format "Astronomical (Julian) day number (after noon UTC): %s" |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
292 (calendar-astro-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
293 (list (format "Hebrew date (before sunset): %s" |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
294 (calendar-hebrew-date-string date)))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
295 (let ((i (calendar-islamic-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
296 (if (not (string-equal i "")) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
297 (list (list (format "Islamic date (before sunset): %s" i))))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
298 ; too slow to leave this in all the time! |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
299 ; (list |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
300 ; (list (format "Chinese date: %s" (calendar-chinese-date-string date)))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
301 ; so instead, |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
302 (list '("Chinese date (select to echo Chinese date)" |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
303 . calendar-print-chinese-date)) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
304 (let ((c (calendar-coptic-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
305 (if (not (string-equal c "")) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
306 (list (list (format "Coptic date: %s" c))))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
307 (let ((e (calendar-ethiopic-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
308 (if (not (string-equal e "")) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
309 (list (list (format "Ethiopic date: %s" e))))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
310 (let ((f (calendar-french-date-string date))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
311 (if (not (string-equal f "")) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
312 (list (list (format "French Revolutionary date: %s" f))))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
313 (list |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
314 (list |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
315 (format "Mayan date: %s" |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
316 (calendar-mayan-date-string date))))))))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
317 (and selection (call-interactively selection)))) |
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
318 |
5701 | 319 |
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
|
320 (defun calendar-mouse-2-date-menu (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
|
321 "Pop up menu for Mouse-2 for selected date in the calendar window." |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
322 (interactive "e") |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
323 (let* ((date (calendar-event-to-date t)) |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
324 (selection |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
325 (x-popup-menu |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
326 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
|
327 (list "Menu" |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
328 (list |
13047
6c3c9645fbfd
Added new calendars to menus and made minor fixes.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12033
diff
changeset
|
329 (calendar-date-string date t 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
|
330 '("Holidays" . calendar-mouse-holidays) |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
331 '("Mark date" . calendar-mouse-set-mark) |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
332 '("Sunrise/sunset" . calendar-mouse-sunrise/sunset) |
9766
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
333 '("Other calendars" . calendar-mouse-print-dates) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
334 '("Diary entries" . calendar-mouse-view-diary-entries) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
335 '("Insert diary entry" . calendar-mouse-insert-diary-entry) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
336 '("Other diary file entries" |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
337 . calendar-mouse-view-other-diary-entries) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
338 ))))) |
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
|
339 (and selection (call-interactively selection)))) |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
340 |
7478
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
341 (define-key calendar-mouse-3-map [exit-calendar] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
342 '("Exit calendar" . exit-calendar)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
343 (define-key calendar-mouse-3-map [show-diary] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
344 '("Show diary" . show-all-diary-entries)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
345 (define-key calendar-mouse-3-map [lunar-phases] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
346 '("Lunar phases" . calendar-phases-of-moon)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
347 (define-key calendar-mouse-3-map [unmark] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
348 '("Unmark" . calendar-unmark)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
349 (define-key calendar-mouse-3-map [mark-holidays] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
350 '("Mark holidays" . mark-calendar-holidays)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
351 (define-key calendar-mouse-3-map [list-holidays] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
352 '("List holidays" . list-calendar-holidays)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
353 (define-key calendar-mouse-3-map [mark-diary-entries] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
354 '("Mark diary entries" . mark-diary-entries)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
355 (define-key calendar-mouse-3-map [scroll-backward] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
356 '("Scroll backward" . scroll-calendar-right-three-months)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
357 (define-key calendar-mouse-3-map [scroll-forward] |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
358 '("Scroll forward" . scroll-calendar-left-three-months)) |
5701 | 359 |
360 (run-hooks 'cal-menu-load-hook) | |
361 | |
362 (provide 'cal-menu) | |
363 | |
364 ;;; cal-menu.el ends here |