Commit | Line | Data |
---|---|---|
aef1a243 RS |
1 | ;;; cal-menu.el --- calendar functions for menu bar and popup menu support |
2 | ||
c29681e1 | 3 | ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc. |
aef1a243 RS |
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 | ||
59243403 RS |
12 | ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 | ;; it under the terms of the GNU General Public License as published by | |
14 | ;; the Free Software Foundation; either version 2, or (at your option) | |
15 | ;; any later version. | |
16 | ||
aef1a243 | 17 | ;; GNU Emacs is distributed in the hope that it will be useful, |
59243403 RS |
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;; GNU General Public License for more details. | |
21 | ||
22 | ;; You should have received a copy of the GNU General Public License | |
23 | ;; along with GNU Emacs; see the file COPYING. If not, write to | |
24 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
aef1a243 RS |
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 | ||
7c77d665 | 39 | (define-key calendar-mode-map [menu-bar edit] 'undefined) |
bc83970d | 40 | (define-key calendar-mode-map [menu-bar search] 'undefined) |
7c77d665 | 41 | |
89e14386 | 42 | (define-key calendar-mode-map [down-mouse-2] 'calendar-mouse-2-date-menu) |
982f12d0 | 43 | (define-key calendar-mode-map [mouse-2] 'ignore) |
89e14386 RS |
44 | |
45 | (defvar calendar-mouse-3-map (make-sparse-keymap "Calendar")) | |
46 | (define-key calendar-mode-map [down-mouse-3] calendar-mouse-3-map) | |
5c51b72e | 47 | (define-key calendar-mode-map [C-down-mouse-3] calendar-mouse-3-map) |
aef1a243 | 48 | |
48b29ac0 ER |
49 | (define-key calendar-mode-map [menu-bar moon] |
50 | (cons "Moon" (make-sparse-keymap "Moon"))) | |
51 | ||
52 | (define-key calendar-mode-map [menu-bar moon moon] | |
0e520d74 | 53 | '("Lunar Phases" . calendar-phases-of-moon)) |
48b29ac0 | 54 | |
aef1a243 RS |
55 | (define-key calendar-mode-map [menu-bar diary] |
56 | (cons "Diary" (make-sparse-keymap "Diary"))) | |
57 | ||
58 | (define-key calendar-mode-map [menu-bar diary heb] | |
59 | '("Insert Hebrew" . calendar-mouse-insert-hebrew-diary-entry)) | |
60 | (define-key calendar-mode-map [menu-bar diary isl] | |
61 | '("Insert Islamic" . calendar-mouse-insert-islamic-diary-entry)) | |
62 | (define-key calendar-mode-map [menu-bar diary cyc] | |
0e520d74 | 63 | '("Insert Cyclic" . insert-cyclic-diary-entry)) |
aef1a243 | 64 | (define-key calendar-mode-map [menu-bar diary blk] |
0e520d74 | 65 | '("Insert Block" . insert-block-diary-entry)) |
aef1a243 | 66 | (define-key calendar-mode-map [menu-bar diary ann] |
0e520d74 | 67 | '("Insert Anniversary" . insert-anniversary-diary-entry)) |
aef1a243 | 68 | (define-key calendar-mode-map [menu-bar diary yr] |
0e520d74 | 69 | '("Insert Yearly" . insert-yearly-diary-entry)) |
aef1a243 | 70 | (define-key calendar-mode-map [menu-bar diary mon] |
0e520d74 | 71 | '("Insert Monthly" . insert-monthly-diary-entry)) |
aef1a243 | 72 | (define-key calendar-mode-map [menu-bar diary wk] |
0e520d74 | 73 | '("Insert Weekly" . insert-weekly-diary-entry)) |
aef1a243 | 74 | (define-key calendar-mode-map [menu-bar diary ent] |
0e520d74 | 75 | '("Insert Daily". insert-diary-entry)) |
aef1a243 | 76 | (define-key calendar-mode-map [menu-bar diary all] |
0e520d74 | 77 | '("Show All" . show-all-diary-entries)) |
aef1a243 | 78 | (define-key calendar-mode-map [menu-bar diary mark] |
0e520d74 | 79 | '("Mark All" . mark-diary-entries)) |
aef1a243 | 80 | (define-key calendar-mode-map [menu-bar diary view] |
0e520d74 | 81 | '("Cursor Date" . view-diary-entries)) |
95436630 | 82 | (define-key calendar-mode-map [menu-bar diary view] |
0e520d74 | 83 | '("Other File" . view-other-diary-entries)) |
aef1a243 RS |
84 | |
85 | (define-key calendar-mode-map [menu-bar holidays] | |
86 | (cons "Holidays" (make-sparse-keymap "Holidays"))) | |
87 | ||
88 | (define-key calendar-mode-map [menu-bar holidays unmark] | |
89 | '("Unmark" . calendar-unmark)) | |
90 | (define-key calendar-mode-map [menu-bar holidays mark] | |
91 | '("Mark" . mark-calendar-holidays)) | |
92 | (define-key calendar-mode-map [menu-bar holidays 3-mon] | |
0e520d74 | 93 | '("3 Months" . list-calendar-holidays)) |
aef1a243 | 94 | (define-key calendar-mode-map [menu-bar holidays 1-day] |
0e520d74 | 95 | '("One Day" . calendar-cursor-holidays)) |
aef1a243 RS |
96 | |
97 | (define-key calendar-mode-map [menu-bar goto] | |
98 | (cons "Goto" (make-sparse-keymap "Goto"))) | |
99 | ||
100 | (define-key calendar-mode-map [menu-bar goto french] | |
0e520d74 | 101 | '("French Date" . calendar-goto-french-date)) |
aef1a243 | 102 | (define-key calendar-mode-map [menu-bar goto mayan] |
0e520d74 | 103 | (cons "Mayan Date" (make-sparse-keymap "Mayan"))) |
c29681e1 ER |
104 | (define-key calendar-mode-map [menu-bar goto ethiopic] |
105 | '("Ethiopic Date" . calendar-goto-ethiopic-date)) | |
106 | (define-key calendar-mode-map [menu-bar goto coptic] | |
107 | '("Coptic Date" . calendar-goto-coptic-date)) | |
108 | (define-key calendar-mode-map [menu-bar goto chinese] | |
109 | '("Chinese Date" . calendar-goto-chinese-date)) | |
aef1a243 | 110 | (define-key calendar-mode-map [menu-bar goto julian] |
0e520d74 | 111 | '("Julian Date" . calendar-goto-julian-date)) |
aef1a243 | 112 | (define-key calendar-mode-map [menu-bar goto islamic] |
0e520d74 | 113 | '("Islamic Date" . calendar-goto-islamic-date)) |
aef1a243 | 114 | (define-key calendar-mode-map [menu-bar goto hebrew] |
0e520d74 | 115 | '("Hebrew Date" . calendar-goto-hebrew-date)) |
aef1a243 | 116 | (define-key calendar-mode-map [menu-bar goto astro] |
0e520d74 | 117 | '("Astronomical Date" . calendar-goto-astro-day-number)) |
aef1a243 | 118 | (define-key calendar-mode-map [menu-bar goto iso] |
0e520d74 | 119 | '("ISO Date" . calendar-goto-iso-date)) |
aef1a243 | 120 | (define-key calendar-mode-map [menu-bar goto gregorian] |
0e520d74 | 121 | '("Other Date" . calendar-goto-date)) |
aef1a243 | 122 | (define-key calendar-mode-map [menu-bar goto end-of-year] |
0e520d74 | 123 | '("End of Year" . calendar-end-of-year)) |
aef1a243 | 124 | (define-key calendar-mode-map [menu-bar goto beginning-of-year] |
0e520d74 | 125 | '("Beginning of Year" . calendar-beginning-of-year)) |
aef1a243 | 126 | (define-key calendar-mode-map [menu-bar goto end-of-month] |
0e520d74 | 127 | '("End of Month" . calendar-end-of-month)) |
aef1a243 | 128 | (define-key calendar-mode-map [menu-bar goto beginning-of-month] |
0e520d74 | 129 | '("Beginning of Month" . calendar-beginning-of-month)) |
aef1a243 | 130 | (define-key calendar-mode-map [menu-bar goto end-of-week] |
0e520d74 | 131 | '("End of Week" . calendar-end-of-week)) |
aef1a243 | 132 | (define-key calendar-mode-map [menu-bar goto beginning-of-week] |
0e520d74 | 133 | '("Beginning of Week" . calendar-beginning-of-week)) |
aef1a243 | 134 | (define-key calendar-mode-map [menu-bar goto today] |
e8cf82e8 | 135 | '("Today" . calendar-goto-today)) |
aef1a243 RS |
136 | |
137 | ||
138 | (define-key calendar-mode-map [menu-bar goto mayan prev-rnd] | |
139 | '("Previous Round" . calendar-previous-calendar-round-date)) | |
140 | (define-key calendar-mode-map [menu-bar goto mayan nxt-rnd] | |
141 | '("Next Round" . calendar-next-calendar-round-date)) | |
142 | (define-key calendar-mode-map [menu-bar goto mayan prev-haab] | |
143 | '("Previous Haab" . calendar-previous-haab-date)) | |
144 | (define-key calendar-mode-map [menu-bar goto mayan next-haab] | |
145 | '("Next Haab" . calendar-next-haab-date)) | |
146 | (define-key calendar-mode-map [menu-bar goto mayan prev-tzol] | |
147 | '("Previous Tzolkin" . calendar-previous-tzolkin-date)) | |
148 | (define-key calendar-mode-map [menu-bar goto mayan next-tzol] | |
149 | '("Next Tzolkin" . calendar-next-tzolkin-date)) | |
150 | ||
151 | (define-key calendar-mode-map [menu-bar scroll] | |
152 | (cons "Scroll" (make-sparse-keymap "Scroll"))) | |
153 | ||
154 | (define-key calendar-mode-map [menu-bar scroll bk-12] | |
155 | '("Backward 1 Year" . "4\ev")) | |
156 | (define-key calendar-mode-map [menu-bar scroll bk-3] | |
157 | '("Backward 3 Months" . scroll-calendar-right-three-months)) | |
158 | (define-key calendar-mode-map [menu-bar scroll bk-1] | |
159 | '("Backward 1 Month" . scroll-calendar-right)) | |
160 | (define-key calendar-mode-map [menu-bar scroll fwd-12] | |
161 | '("Forward 1 Year" . "4\C-v")) | |
162 | (define-key calendar-mode-map [menu-bar scroll fwd-3] | |
163 | '("Forward 3 Months" . scroll-calendar-left-three-months)) | |
164 | (define-key calendar-mode-map [menu-bar scroll fwd-1] | |
165 | '("Forward 1 Month" . scroll-calendar-left)) | |
166 | ||
167 | (put 'calendar-forward-day 'menu-enable '(calendar-cursor-to-date)) | |
168 | (put 'calendar-backward-day 'menu-enable '(calendar-cursor-to-date)) | |
169 | (put 'calendar-forward-week 'menu-enable '(calendar-cursor-to-date)) | |
170 | (put 'calendar-backward-week 'menu-enable '(calendar-cursor-to-date)) | |
171 | (put 'calendar-forward-month 'menu-enable '(calendar-cursor-to-date)) | |
172 | (put 'calendar-backward-month 'menu-enable '(calendar-cursor-to-date)) | |
173 | (put 'calendar-forward-year 'menu-enable '(calendar-cursor-to-date)) | |
174 | (put 'calendar-backward-year 'menu-enable '(calendar-cursor-to-date)) | |
175 | (put 'calendar-beginning-of-year 'menu-enable '(calendar-cursor-to-date)) | |
176 | (put 'calendar-end-of-year 'menu-enable '(calendar-cursor-to-date)) | |
177 | (put 'calendar-beginning-of-month 'menu-enable '(calendar-cursor-to-date)) | |
178 | (put 'calendar-end-of-month 'menu-enable '(calendar-cursor-to-date)) | |
179 | (put 'calendar-end-of-week 'menu-enable '(calendar-cursor-to-date)) | |
180 | (put 'calendar-beginning-of-week 'menu-enable '(calendar-cursor-to-date)) | |
181 | (put 'calendar-mouse-print-dates 'menu-enable '(calendar-event-to-date)) | |
182 | (put 'calendar-sunrise-sunset 'menu-enable '(calendar-event-to-date)) | |
183 | (put 'calendar-cursor-holidays 'menu-enable '(calendar-cursor-to-date)) | |
184 | (put 'view-diary-entries 'menu-enable '(calendar-cursor-to-date)) | |
95436630 | 185 | (put 'view-other-diary-entries 'menu-enable '(calendar-cursor-to-date)) |
aef1a243 RS |
186 | (put 'calendar-mouse-insert-hebrew-diary-entry |
187 | 'menu-enable | |
188 | '(calendar-cursor-to-date)) | |
189 | (put 'calendar-mouse-insert-islamic-diary-entry | |
190 | 'menu-enable | |
191 | '(calendar-cursor-to-date)) | |
192 | (put 'insert-cyclic-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
193 | (put 'insert-block-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
194 | (put 'insert-anniversary-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
195 | (put 'insert-yearly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
196 | (put 'insert-monthly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
197 | (put 'insert-weekly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
e519449d ER |
198 | (put 'cal-tex-cursor-day 'menu-enable '(calendar-cursor-to-date)) |
199 | (put 'cal-tex-cursor-week 'menu-enable '(calendar-cursor-to-date)) | |
200 | (put 'cal-tex-cursor-week2 'menu-enable '(calendar-cursor-to-date)) | |
bc83970d ER |
201 | (put 'cal-tex-cursor-week-iso 'menu-enable '(calendar-cursor-to-date)) |
202 | (put 'cal-tex-cursor-week-monday 'menu-enable '(calendar-cursor-to-date)) | |
610d0966 | 203 | (put 'cal-tex-cursor-filofax-2week |
bc83970d | 204 | 'menu-enable '(calendar-cursor-to-date)) |
610d0966 | 205 | (put 'cal-tex-cursor-filofax-week 'menu-enable '(calendar-cursor-to-date)) |
e519449d ER |
206 | (put 'cal-tex-cursor-month 'menu-enable '(calendar-cursor-to-date)) |
207 | (put 'cal-tex-cursor-month-landscape 'menu-enable '(calendar-cursor-to-date)) | |
208 | (put 'cal-tex-cursor-year 'menu-enable '(calendar-cursor-to-date)) | |
209 | (put 'cal-tex-cursor-filofax-year 'menu-enable '(calendar-cursor-to-date)) | |
210 | (put 'cal-tex-cursor-year-landscape 'menu-enable '(calendar-cursor-to-date)) | |
aef1a243 | 211 | |
a6ee0a2f ER |
212 | (defun calendar-event-to-date (&optional error) |
213 | "Date of last event. | |
214 | If event is not on a specific date, signals an error if optional parameter | |
215 | ERROR is t, otherwise just returns nil." | |
aef1a243 RS |
216 | (save-excursion |
217 | (goto-char (posn-point (event-start last-input-event))) | |
a6ee0a2f | 218 | (calendar-cursor-to-date error))) |
aef1a243 RS |
219 | |
220 | (defun calendar-mouse-insert-hebrew-diary-entry (event) | |
221 | "Pop up menu to insert a Hebrew-date diary entry." | |
222 | (interactive "e") | |
223 | (let ((hebrew-selection | |
224 | (x-popup-menu | |
225 | event | |
226 | (list "Hebrew insert menu" | |
227 | (list (calendar-hebrew-date-string (calendar-cursor-to-date)) | |
228 | '("One time" . insert-hebrew-diary-entry) | |
229 | '("Monthly" . insert-monthly-hebrew-diary-entry) | |
230 | '("Yearly" . insert-yearly-hebrew-diary-entry)))))) | |
231 | (and hebrew-selection (call-interactively hebrew-selection)))) | |
232 | ||
233 | (defun calendar-mouse-insert-islamic-diary-entry (event) | |
234 | "Pop up menu to insert an Islamic-date diary entry." | |
235 | (interactive "e") | |
236 | (let ((islamic-selection | |
237 | (x-popup-menu | |
238 | event | |
239 | (list "Islamic insert menu" | |
240 | (list (calendar-islamic-date-string (calendar-cursor-to-date)) | |
241 | '("One time" . insert-islamic-diary-entry) | |
242 | '("Monthly" . insert-monthly-islamic-diary-entry) | |
243 | '("Yearly" . insert-yearly-islamic-diary-entry)))))) | |
244 | (and islamic-selection (call-interactively islamic-selection)))) | |
245 | ||
246 | (defun calendar-mouse-sunrise/sunset () | |
247 | "Show sunrise/sunset times for mouse-selected date." | |
248 | (interactive) | |
249 | (save-excursion | |
250 | (calendar-goto-date (calendar-event-to-date)) | |
251 | (calendar-sunrise-sunset))) | |
252 | ||
253 | (defun calendar-mouse-holidays () | |
254 | "Show holidays for mouse-selected date." | |
255 | (interactive) | |
256 | (save-excursion | |
257 | (calendar-goto-date (calendar-event-to-date)) | |
258 | (calendar-cursor-holidays))) | |
259 | ||
260 | (defun calendar-mouse-view-diary-entries () | |
261 | "View diary entries on mouse-selected date." | |
262 | (interactive) | |
263 | (save-excursion | |
264 | (calendar-goto-date (calendar-event-to-date)) | |
265 | (view-diary-entries 1))) | |
266 | ||
95436630 ER |
267 | (defun calendar-mouse-view-other-diary-entries () |
268 | "View diary entries from alternative file on mouse-selected date." | |
269 | (interactive) | |
270 | (save-excursion | |
271 | (calendar-goto-date (calendar-event-to-date)) | |
272 | (call-interactively 'view-other-diary-entries))) | |
273 | ||
d960f279 ER |
274 | (defun calendar-mouse-insert-diary-entry () |
275 | "Insert diary entry for mouse-selected date." | |
276 | (interactive) | |
277 | (save-excursion | |
278 | (calendar-goto-date (calendar-event-to-date)) | |
279 | (insert-diary-entry nil))) | |
280 | ||
b61631a7 RS |
281 | (defun calendar-mouse-set-mark () |
282 | "Mark the date under the cursor." | |
283 | (interactive) | |
284 | (save-excursion | |
285 | (calendar-goto-date (calendar-event-to-date)) | |
286 | (calendar-set-mark nil))) | |
287 | ||
e519449d ER |
288 | (defun cal-tex-mouse-day () |
289 | "Make a buffer with LaTeX commands for the day mouse is on." | |
290 | (interactive) | |
291 | (save-excursion | |
292 | (calendar-goto-date (calendar-event-to-date)) | |
293 | (cal-tex-cursor-day nil))) | |
294 | ||
295 | (defun cal-tex-mouse-week () | |
296 | "One page calendar for week indicated by cursor. | |
297 | Holidays are included if `cal-tex-holidays' is t." | |
298 | (interactive) | |
299 | (save-excursion | |
300 | (calendar-goto-date (calendar-event-to-date)) | |
301 | (cal-tex-cursor-week nil))) | |
302 | ||
303 | (defun cal-tex-mouse-week2 () | |
304 | "Make a buffer with LaTeX commands for the week cursor is on. | |
305 | The printed output will be on two pages." | |
306 | (interactive) | |
307 | (save-excursion | |
308 | (calendar-goto-date (calendar-event-to-date)) | |
309 | (cal-tex-cursor-week2 nil))) | |
310 | ||
bc83970d | 311 | (defun cal-tex-mouse-week-iso () |
e519449d ER |
312 | "One page calendar for week indicated by cursor. |
313 | Holidays are included if `cal-tex-holidays' is t." | |
314 | (interactive) | |
315 | (save-excursion | |
316 | (calendar-goto-date (calendar-event-to-date)) | |
bc83970d | 317 | (cal-tex-cursor-week-iso nil))) |
e519449d | 318 | |
bc83970d | 319 | (defun cal-tex-mouse-week-monday () |
e519449d ER |
320 | "One page calendar for week indicated by cursor." |
321 | (interactive) | |
322 | (save-excursion | |
323 | (calendar-goto-date (calendar-event-to-date)) | |
bc83970d | 324 | (cal-tex-cursor-week-monday nil))) |
e519449d | 325 | |
610d0966 | 326 | (defun cal-tex-mouse-filofax-2week () |
e519449d ER |
327 | "One page Filofax calendar for week indicated by cursor." |
328 | (interactive) | |
329 | (save-excursion | |
330 | (calendar-goto-date (calendar-event-to-date)) | |
610d0966 | 331 | (cal-tex-cursor-filofax-2week nil))) |
e519449d | 332 | |
610d0966 | 333 | (defun cal-tex-mouse-filofax-week () |
e519449d ER |
334 | "Two page Filofax calendar for week indicated by cursor." |
335 | (interactive) | |
336 | (save-excursion | |
337 | (calendar-goto-date (calendar-event-to-date)) | |
610d0966 | 338 | (cal-tex-cursor-filofax-week nil))) |
e519449d ER |
339 | |
340 | (defun cal-tex-mouse-month () | |
341 | "Make a buffer with LaTeX commands for the month cursor is on. | |
342 | Calendar is condensed onto one page." | |
343 | (interactive) | |
344 | (save-excursion | |
345 | (calendar-goto-date (calendar-event-to-date)) | |
346 | (cal-tex-cursor-month nil))) | |
347 | ||
348 | (defun cal-tex-mouse-month-landscape () | |
349 | "Make a buffer with LaTeX commands for the month cursor is on. | |
350 | The output is in landscape format, one month to a page." | |
351 | (interactive) | |
352 | (save-excursion | |
353 | (calendar-goto-date (calendar-event-to-date)) | |
354 | (cal-tex-cursor-month-landscape nil))) | |
355 | ||
356 | (defun cal-tex-mouse-year () | |
357 | "Make a buffer with LaTeX commands for the year cursor is on." | |
358 | (interactive) | |
359 | (save-excursion | |
360 | (calendar-goto-date (calendar-event-to-date)) | |
361 | (cal-tex-cursor-year nil))) | |
362 | ||
363 | (defun cal-tex-mouse-filofax-year () | |
364 | "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on." | |
365 | (interactive) | |
366 | (save-excursion | |
367 | (calendar-goto-date (calendar-event-to-date)) | |
368 | (cal-tex-cursor-filofax-year nil))) | |
369 | ||
370 | (defun cal-tex-mouse-year-landscape () | |
371 | "Make a buffer with LaTeX commands for the year cursor is on." | |
372 | (interactive) | |
373 | (save-excursion | |
374 | (calendar-goto-date (calendar-event-to-date)) | |
375 | (cal-tex-cursor-year-landscape nil))) | |
376 | ||
aef1a243 RS |
377 | (defun calendar-mouse-print-dates () |
378 | "Pop up menu of equivalent dates to mouse selected date." | |
379 | (interactive) | |
c29681e1 ER |
380 | (let ((date (calendar-event-to-date)) |
381 | (selection | |
382 | (x-popup-menu | |
383 | event | |
384 | (list | |
385 | "Date Menu" | |
386 | (append | |
387 | (list | |
388 | (concat (calendar-date-string date) " (Gregorian)") | |
389 | (list (calendar-day-of-year-string date)) | |
390 | (list (format "ISO date: %s" (calendar-iso-date-string date))) | |
391 | (list (format "Julian date: %s" | |
392 | (calendar-julian-date-string date))) | |
393 | (list | |
394 | (format "Astronomical (Julian) day number (after noon UTC): %s" | |
395 | (calendar-astro-date-string date))) | |
396 | (list (format "Hebrew date (before sunset): %s" | |
397 | (calendar-hebrew-date-string date)))) | |
398 | (let ((i (calendar-islamic-date-string date))) | |
399 | (if (not (string-equal i "")) | |
400 | (list (list (format "Islamic date (before sunset): %s" i))))) | |
78627296 ER |
401 | (list |
402 | (list (format "Chinese date: %s" | |
403 | (calendar-chinese-date-string date)))) | |
404 | ; (list '("Chinese date (select to echo Chinese date)" | |
405 | ; . calendar-mouse-chinese-date)) | |
c29681e1 ER |
406 | (let ((c (calendar-coptic-date-string date))) |
407 | (if (not (string-equal c "")) | |
408 | (list (list (format "Coptic date: %s" c))))) | |
409 | (let ((e (calendar-ethiopic-date-string date))) | |
410 | (if (not (string-equal e "")) | |
411 | (list (list (format "Ethiopic date: %s" e))))) | |
412 | (let ((f (calendar-french-date-string date))) | |
413 | (if (not (string-equal f "")) | |
414 | (list (list (format "French Revolutionary date: %s" f))))) | |
415 | (list | |
416 | (list | |
417 | (format "Mayan date: %s" | |
418 | (calendar-mayan-date-string date))))))))) | |
419 | (and selection (call-interactively selection)))) | |
420 | ||
92da8c78 ER |
421 | (defun calendar-mouse-chinese-date () |
422 | "Show Chinese equivalent for mouse-selected date." | |
423 | (interactive) | |
424 | (save-excursion | |
425 | (calendar-goto-date (calendar-event-to-date)) | |
426 | (calendar-print-chinese-date))) | |
aef1a243 | 427 | |
a6ee0a2f ER |
428 | (defun calendar-mouse-2-date-menu (event) |
429 | "Pop up menu for Mouse-2 for selected date in the calendar window." | |
aef1a243 | 430 | (interactive "e") |
a6ee0a2f ER |
431 | (let* ((date (calendar-event-to-date t)) |
432 | (selection | |
433 | (x-popup-menu | |
434 | event | |
610d0966 | 435 | (list (calendar-date-string date t nil) |
a6ee0a2f | 436 | (list |
610d0966 | 437 | "" |
a6ee0a2f ER |
438 | '("Holidays" . calendar-mouse-holidays) |
439 | '("Mark date" . calendar-mouse-set-mark) | |
440 | '("Sunrise/sunset" . calendar-mouse-sunrise/sunset) | |
95436630 | 441 | '("Other calendars" . calendar-mouse-print-dates) |
e519449d | 442 | '("Prepare LaTeX buffer" . calendar-mouse-cal-tex-menu) |
95436630 ER |
443 | '("Diary entries" . calendar-mouse-view-diary-entries) |
444 | '("Insert diary entry" . calendar-mouse-insert-diary-entry) | |
445 | '("Other diary file entries" | |
446 | . calendar-mouse-view-other-diary-entries) | |
447 | ))))) | |
a6ee0a2f ER |
448 | (and selection (call-interactively selection)))) |
449 | ||
e519449d ER |
450 | (defun calendar-mouse-cal-tex-menu (event) |
451 | "Pop up submenu for Mouse-2 for cal-tex commands for selected date in the calendar window." | |
452 | (interactive "e") | |
453 | (let* ((selection | |
454 | (x-popup-menu | |
455 | event | |
610d0966 | 456 | (list (calendar-date-string date t nil) |
e519449d | 457 | (list |
610d0966 | 458 | "" |
e519449d ER |
459 | '("Daily (1 page)" . cal-tex-mouse-day) |
460 | '("Weekly (1 page)" . cal-tex-mouse-week) | |
461 | '("Weekly (2 pages)" . cal-tex-mouse-week2) | |
610d0966 ER |
462 | '("Weekly (other style; 1 page)" . cal-tex-mouse-week-iso) |
463 | '("Weekly (yet another style; 1 page)" . | |
464 | cal-tex-mouse-week-monday) | |
e519449d ER |
465 | '("Monthly" . cal-tex-mouse-month) |
466 | '("Monthly (landscape)" . cal-tex-mouse-month-landscape) | |
467 | '("Yearly" . cal-tex-mouse-year) | |
468 | '("Yearly (landscape)" . cal-tex-mouse-year-landscape) | |
469 | '("Filofax styles" . cal-tex-mouse-filofax) | |
470 | ))))) | |
471 | (and selection (call-interactively selection)))) | |
472 | ||
473 | (defun cal-tex-mouse-filofax (event) | |
474 | "Pop up sub-submenu for Mouse-2 for Filofax cal-tex commands for selected date." | |
475 | (interactive "e") | |
476 | (let* ((selection | |
477 | (x-popup-menu | |
478 | event | |
610d0966 | 479 | (list (calendar-date-string date t nil) |
e519449d | 480 | (list |
610d0966 ER |
481 | "" |
482 | '("Filofax Weekly (2-weeks-at-a-glance)" . | |
483 | cal-tex-mouse-filofax-2week) | |
484 | '("Filofax Weekly (week-at-a-glance)" . | |
485 | cal-tex-mouse-filofax-week) | |
e519449d ER |
486 | '("Filofax Yearly" . cal-tex-mouse-filofax-year) |
487 | ))))) | |
488 | (and selection (call-interactively selection)))) | |
489 | ||
89e14386 RS |
490 | (define-key calendar-mouse-3-map [exit-calendar] |
491 | '("Exit calendar" . exit-calendar)) | |
492 | (define-key calendar-mouse-3-map [show-diary] | |
493 | '("Show diary" . show-all-diary-entries)) | |
494 | (define-key calendar-mouse-3-map [lunar-phases] | |
495 | '("Lunar phases" . calendar-phases-of-moon)) | |
496 | (define-key calendar-mouse-3-map [unmark] | |
497 | '("Unmark" . calendar-unmark)) | |
498 | (define-key calendar-mouse-3-map [mark-holidays] | |
499 | '("Mark holidays" . mark-calendar-holidays)) | |
500 | (define-key calendar-mouse-3-map [list-holidays] | |
501 | '("List holidays" . list-calendar-holidays)) | |
502 | (define-key calendar-mouse-3-map [mark-diary-entries] | |
503 | '("Mark diary entries" . mark-diary-entries)) | |
504 | (define-key calendar-mouse-3-map [scroll-backward] | |
505 | '("Scroll backward" . scroll-calendar-right-three-months)) | |
506 | (define-key calendar-mouse-3-map [scroll-forward] | |
507 | '("Scroll forward" . scroll-calendar-left-three-months)) | |
aef1a243 RS |
508 | |
509 | (run-hooks 'cal-menu-load-hook) | |
510 | ||
511 | (provide 'cal-menu) | |
512 | ||
513 | ;;; cal-menu.el ends here |