]> code.delx.au - gnu-emacs/blob - lisp/calendar/cal-menu.el
(cal-menu-x-popup-menu): Fix argument of error call.
[gnu-emacs] / lisp / calendar / cal-menu.el
1 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support
2
3 ;; Copyright (C) 1994, 1995, 2001 Free Software Foundation, Inc.
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
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
17 ;; GNU Emacs is distributed in the hope that it will be useful,
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 the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Commentary:
28
29 ;; This collection of functions implements menu bar and popup menu support for
30 ;; calendar.el.
31
32 ;; Comments, corrections, and improvements should be sent to
33 ;; Edward M. Reingold Department of Computer Science
34 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
35 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
36 ;; Urbana, Illinois 61801
37
38 ;;; Code:
39
40 (eval-when-compile (require 'calendar))
41 (require 'easymenu)
42
43 (define-key calendar-mode-map [menu-bar edit] 'undefined)
44 (define-key calendar-mode-map [menu-bar search] 'undefined)
45
46 (define-key calendar-mode-map [down-mouse-2] 'calendar-mouse-2-date-menu)
47 (define-key calendar-mode-map [mouse-2] 'ignore)
48
49 (defvar calendar-mouse-3-map (make-sparse-keymap "Calendar"))
50 (define-key calendar-mode-map [down-mouse-3] calendar-mouse-3-map)
51 (define-key calendar-mode-map [C-down-mouse-3] calendar-mouse-3-map)
52
53 (define-key calendar-mode-map [menu-bar moon]
54 (cons "Moon" (make-sparse-keymap "Moon")))
55
56 (define-key calendar-mode-map [menu-bar moon moon]
57 '("Lunar Phases" . calendar-phases-of-moon))
58
59 (define-key calendar-mode-map [menu-bar diary]
60 (cons "Diary" (make-sparse-keymap "Diary")))
61
62 (define-key calendar-mode-map [menu-bar diary heb]
63 '("Insert Hebrew" . calendar-mouse-insert-hebrew-diary-entry))
64 (define-key calendar-mode-map [menu-bar diary isl]
65 '("Insert Islamic" . calendar-mouse-insert-islamic-diary-entry))
66 (define-key calendar-mode-map [menu-bar diary cyc]
67 '("Insert Cyclic" . insert-cyclic-diary-entry))
68 (define-key calendar-mode-map [menu-bar diary blk]
69 '("Insert Block" . insert-block-diary-entry))
70 (define-key calendar-mode-map [menu-bar diary ann]
71 '("Insert Anniversary" . insert-anniversary-diary-entry))
72 (define-key calendar-mode-map [menu-bar diary yr]
73 '("Insert Yearly" . insert-yearly-diary-entry))
74 (define-key calendar-mode-map [menu-bar diary mon]
75 '("Insert Monthly" . insert-monthly-diary-entry))
76 (define-key calendar-mode-map [menu-bar diary wk]
77 '("Insert Weekly" . insert-weekly-diary-entry))
78 (define-key calendar-mode-map [menu-bar diary ent]
79 '("Insert Diary Entry" . insert-diary-entry))
80 (define-key calendar-mode-map [menu-bar diary all]
81 '("Show All" . show-all-diary-entries))
82 (define-key calendar-mode-map [menu-bar diary mark]
83 '("Mark All" . mark-diary-entries))
84 (define-key calendar-mode-map [menu-bar diary view]
85 '("Cursor Date" . view-diary-entries))
86 (define-key calendar-mode-map [menu-bar diary view]
87 '("Other File" . view-other-diary-entries))
88
89 (define-key calendar-mode-map [menu-bar Holidays]
90 (cons "Holidays" (make-sparse-keymap "Holidays")))
91
92 (define-key calendar-mode-map [menu-bar goto]
93 (cons "Goto" (make-sparse-keymap "Goto")))
94
95 (define-key calendar-mode-map [menu-bar goto french]
96 '("French Date" . calendar-goto-french-date))
97 (define-key calendar-mode-map [menu-bar goto mayan]
98 (cons "Mayan Date" (make-sparse-keymap "Mayan")))
99 (define-key calendar-mode-map [menu-bar goto ethiopic]
100 '("Ethiopic Date" . calendar-goto-ethiopic-date))
101 (define-key calendar-mode-map [menu-bar goto coptic]
102 '("Coptic Date" . calendar-goto-coptic-date))
103 (define-key calendar-mode-map [menu-bar goto chinese]
104 '("Chinese Date" . calendar-goto-chinese-date))
105 (define-key calendar-mode-map [menu-bar goto julian]
106 '("Julian Date" . calendar-goto-julian-date))
107 (define-key calendar-mode-map [menu-bar goto islamic]
108 '("Islamic Date" . calendar-goto-islamic-date))
109 (define-key calendar-mode-map [menu-bar goto persian]
110 '("Persian Date" . calendar-goto-persian-date))
111 (define-key calendar-mode-map [menu-bar goto hebrew]
112 '("Hebrew Date" . calendar-goto-hebrew-date))
113 (define-key calendar-mode-map [menu-bar goto astro]
114 '("Astronomical Date" . calendar-goto-astro-day-number))
115 (define-key calendar-mode-map [menu-bar goto iso]
116 '("ISO Date" . calendar-goto-iso-date))
117 (define-key calendar-mode-map [menu-bar goto gregorian]
118 '("Other Date" . calendar-goto-date))
119 (define-key calendar-mode-map [menu-bar goto end-of-year]
120 '("End of Year" . calendar-end-of-year))
121 (define-key calendar-mode-map [menu-bar goto beginning-of-year]
122 '("Beginning of Year" . calendar-beginning-of-year))
123 (define-key calendar-mode-map [menu-bar goto end-of-month]
124 '("End of Month" . calendar-end-of-month))
125 (define-key calendar-mode-map [menu-bar goto beginning-of-month]
126 '("Beginning of Month" . calendar-beginning-of-month))
127 (define-key calendar-mode-map [menu-bar goto end-of-week]
128 '("End of Week" . calendar-end-of-week))
129 (define-key calendar-mode-map [menu-bar goto beginning-of-week]
130 '("Beginning of Week" . calendar-beginning-of-week))
131 (define-key calendar-mode-map [menu-bar goto today]
132 '("Today" . calendar-goto-today))
133
134
135 (define-key calendar-mode-map [menu-bar goto mayan prev-rnd]
136 '("Previous Round" . calendar-previous-calendar-round-date))
137 (define-key calendar-mode-map [menu-bar goto mayan nxt-rnd]
138 '("Next Round" . calendar-next-calendar-round-date))
139 (define-key calendar-mode-map [menu-bar goto mayan prev-haab]
140 '("Previous Haab" . calendar-previous-haab-date))
141 (define-key calendar-mode-map [menu-bar goto mayan next-haab]
142 '("Next Haab" . calendar-next-haab-date))
143 (define-key calendar-mode-map [menu-bar goto mayan prev-tzol]
144 '("Previous Tzolkin" . calendar-previous-tzolkin-date))
145 (define-key calendar-mode-map [menu-bar goto mayan next-tzol]
146 '("Next Tzolkin" . calendar-next-tzolkin-date))
147
148 (define-key calendar-mode-map [menu-bar scroll]
149 (cons "Scroll" (make-sparse-keymap "Scroll")))
150
151 (define-key calendar-mode-map [menu-bar scroll bk-12]
152 '("Backward 1 Year" . "4\ev"))
153 (define-key calendar-mode-map [menu-bar scroll bk-3]
154 '("Backward 3 Months" . scroll-calendar-right-three-months))
155 (define-key calendar-mode-map [menu-bar scroll bk-1]
156 '("Backward 1 Month" . scroll-calendar-right))
157 (define-key calendar-mode-map [menu-bar scroll fwd-12]
158 '("Forward 1 Year" . "4\C-v"))
159 (define-key calendar-mode-map [menu-bar scroll fwd-3]
160 '("Forward 3 Months" . scroll-calendar-left-three-months))
161 (define-key calendar-mode-map [menu-bar scroll fwd-1]
162 '("Forward 1 Month" . scroll-calendar-left))
163
164 (defun cal-menu-x-popup-menu (position menu)
165 "Like `x-popup-menu', but prints an error message if popup menus are
166 not available."
167 (if (display-popup-menus-p)
168 (x-popup-menu position menu)
169 (error "Popup menus are not available on this system")))
170
171 (defun cal-menu-list-holidays-year ()
172 "Display a list of the holidays of the selected date's year."
173 (interactive)
174 (let ((year (extract-calendar-year (calendar-cursor-to-date))))
175 (list-holidays year year)))
176
177 (defun cal-menu-list-holidays-following-year ()
178 "Display a list of the holidays of the following year."
179 (interactive)
180 (let ((year (1+ (extract-calendar-year (calendar-cursor-to-date)))))
181 (list-holidays year year)))
182
183 (defun cal-menu-list-holidays-previous-year ()
184 "Display a list of the holidays of the previous year."
185 (interactive)
186 (let ((year (1- (extract-calendar-year (calendar-cursor-to-date)))))
187 (list-holidays year year)))
188
189 (defun cal-menu-update ()
190 ;; Update the holiday part of calendar menu bar for the current display.
191 (condition-case nil
192 (if (eq major-mode 'calendar-mode)
193 (let ((l))
194 (calendar-for-loop;; Show 11 years--5 before, 5 after year of
195 ;; middle month
196 i from (- displayed-year 5) to (+ displayed-year 5) do
197 (setq l (cons (vector (format "For Year %s" i)
198 (list (list 'lambda 'nil '(interactive)
199 (list 'list-holidays i i)))
200 t)
201 l)))
202 (setq l (cons ["Mark Holidays" mark-calendar-holidays t]
203 (cons ["Unmark Calendar" calendar-unmark t]
204 (cons ["--" '("--") t] l))))
205 (easy-menu-change nil "Holidays" (nreverse l))
206 (define-key calendar-mode-map [menu-bar Holidays separator]
207 '("--"))
208 (define-key calendar-mode-map [menu-bar Holidays today]
209 `(,(format "For Today (%s)"
210 (calendar-date-string (calendar-current-date) t t))
211 . cal-menu-today-holidays))
212 (let ((title
213 (let ((m1 displayed-month)
214 (y1 displayed-year)
215 (m2 displayed-month)
216 (y2 displayed-year))
217 (increment-calendar-month m1 y1 -1)
218 (increment-calendar-month m2 y2 1)
219 (if (= y1 y2)
220 (format "%s-%s, %d"
221 (calendar-month-name m1 3)
222 (calendar-month-name m2 3)
223 y2)
224 (format "%s, %d-%s, %d"
225 (calendar-month-name m1 3)
226 y1
227 (calendar-month-name m2 3)
228 y2)))))
229 (define-key calendar-mode-map [menu-bar Holidays 3-month]
230 `(,(format "For Window (%s)" title)
231 . list-calendar-holidays)))
232 (let ((date (calendar-cursor-to-date)))
233 (if date
234 (define-key calendar-mode-map [menu-bar Holidays 1-day]
235 `(,(format "For Cursor Date (%s)"
236 (calendar-date-string date t t))
237 . calendar-cursor-holidays))))))
238 ;; Try to avoid entering infinite beep mode in case of errors.
239 (error (ding))))
240
241 (defun calendar-event-to-date (&optional error)
242 "Date of last event.
243 If event is not on a specific date, signals an error if optional parameter
244 ERROR is t, otherwise just returns nil."
245 (save-excursion
246 (set-buffer (window-buffer (posn-window (event-start last-input-event))))
247 (goto-char (posn-point (event-start last-input-event)))
248 (calendar-cursor-to-date error)))
249
250 (defun calendar-mouse-insert-hebrew-diary-entry (event)
251 "Pop up menu to insert a Hebrew-date diary entry."
252 (interactive "e")
253 (let ((hebrew-selection
254 (cal-menu-x-popup-menu
255 event
256 (list "Hebrew insert menu"
257 (list (calendar-hebrew-date-string (calendar-cursor-to-date))
258 '("One time" . insert-hebrew-diary-entry)
259 '("Monthly" . insert-monthly-hebrew-diary-entry)
260 '("Yearly" . insert-yearly-hebrew-diary-entry))))))
261 (and hebrew-selection (call-interactively hebrew-selection))))
262
263 (defun calendar-mouse-insert-islamic-diary-entry (event)
264 "Pop up menu to insert an Islamic-date diary entry."
265 (interactive "e")
266 (let ((islamic-selection
267 (cal-menu-x-popup-menu
268 event
269 (list "Islamic insert menu"
270 (list (calendar-islamic-date-string (calendar-cursor-to-date))
271 '("One time" . insert-islamic-diary-entry)
272 '("Monthly" . insert-monthly-islamic-diary-entry)
273 '("Yearly" . insert-yearly-islamic-diary-entry))))))
274 (and islamic-selection (call-interactively islamic-selection))))
275
276 (defun calendar-mouse-sunrise/sunset ()
277 "Show sunrise/sunset times for mouse-selected date."
278 (interactive)
279 (save-excursion
280 (calendar-mouse-goto-date (calendar-event-to-date))
281 (calendar-sunrise-sunset)))
282
283 (defun cal-menu-today-holidays ()
284 "Show holidays for today's date."
285 (interactive)
286 (save-excursion
287 (calendar-cursor-to-date (calendar-current-date))
288 (calendar-cursor-holidays)))
289
290 (defun calendar-mouse-holidays ()
291 "Pop up menu of holidays for mouse selected date."
292 (interactive)
293 (let* ((date (calendar-event-to-date))
294 (l (mapcar '(lambda (x) (list x))
295 (check-calendar-holidays date)))
296 (selection
297 (cal-menu-x-popup-menu
298 event
299 (list
300 (format "Holidays for %s" (calendar-date-string date))
301 (append
302 (list (format "Holidays for %s" (calendar-date-string date)))
303 (if l l '("None")))))))
304 (and selection (call-interactively selection))))
305
306 (defun calendar-mouse-view-diary-entries ()
307 "Pop up menu of diary entries for mouse selected date."
308 (interactive)
309 (let* ((date (calendar-event-to-date))
310 (l (mapcar '(lambda (x) (list (car (cdr x))))
311 (let ((diary-list-include-blanks nil)
312 (diary-display-hook 'ignore))
313 (list-diary-entries date 1))))
314 (selection
315 (cal-menu-x-popup-menu
316 event
317 (list
318 (format "Diary entries for %s" (calendar-date-string date))
319 (append
320 (list (format "Diary entries for %s" (calendar-date-string date)))
321 (if l l '("None")))))))
322 (and selection (call-interactively selection))))
323
324 (defun calendar-mouse-view-other-diary-entries ()
325 "Pop up menu of diary entries from alternative file on mouse-selected date."
326 (interactive)
327 (let* ((date (calendar-event-to-date))
328 (diary-list-include-blanks nil)
329 (diary-display-hook 'ignore)
330 (diary-file (read-file-name
331 "Enter diary file name: "
332 default-directory nil t))
333 ; The following doesn't really do the right thing. The problem is
334 ; that a newline in the diary entry does not give a newline in a
335 ; pop-up menu; for that you need a separate list item. When the (car
336 ; (cdr x)) contains newlines, the item should be split into a list of
337 ; items. Too minor and messy to worry about.
338 (l (mapcar '(lambda (x) (list (car (cdr x))))
339 (list-diary-entries date 1)))
340 (selection
341 (cal-menu-x-popup-menu
342 event
343 (list
344 (format "Diary entries from %s for %s"
345 diary-file
346 (calendar-date-string date))
347 (append
348 (list (format "Diary entries from %s for %s"
349 diary-file
350 (calendar-date-string date)))
351 (if l l '("None")))))))
352 (and selection (call-interactively selection))))
353
354 (defun calendar-mouse-insert-diary-entry ()
355 "Insert diary entry for mouse-selected date."
356 (interactive)
357 (save-excursion
358 (calendar-mouse-goto-date (calendar-event-to-date))
359 (insert-diary-entry nil)))
360
361 (defun calendar-mouse-set-mark ()
362 "Mark the date under the cursor."
363 (interactive)
364 (save-excursion
365 (calendar-mouse-goto-date (calendar-event-to-date))
366 (calendar-set-mark nil)))
367
368 (defun cal-tex-mouse-day ()
369 "Make a buffer with LaTeX commands for the day mouse is on."
370 (interactive)
371 (save-excursion
372 (calendar-mouse-goto-date (calendar-event-to-date))
373 (cal-tex-cursor-day nil)))
374
375 (defun cal-tex-mouse-week ()
376 "One page calendar for week indicated by cursor.
377 Holidays are included if `cal-tex-holidays' is t."
378 (interactive)
379 (save-excursion
380 (calendar-mouse-goto-date (calendar-event-to-date))
381 (cal-tex-cursor-week nil)))
382
383 (defun cal-tex-mouse-week2 ()
384 "Make a buffer with LaTeX commands for the week cursor is on.
385 The printed output will be on two pages."
386 (interactive)
387 (save-excursion
388 (calendar-mouse-goto-date (calendar-event-to-date))
389 (cal-tex-cursor-week2 nil)))
390
391 (defun cal-tex-mouse-week-iso ()
392 "One page calendar for week indicated by cursor.
393 Holidays are included if `cal-tex-holidays' is t."
394 (interactive)
395 (save-excursion
396 (calendar-mouse-goto-date (calendar-event-to-date))
397 (cal-tex-cursor-week-iso nil)))
398
399 (defun cal-tex-mouse-week-monday ()
400 "One page calendar for week indicated by cursor."
401 (interactive)
402 (save-excursion
403 (calendar-mouse-goto-date (calendar-event-to-date))
404 (cal-tex-cursor-week-monday nil)))
405
406 (defun cal-tex-mouse-filofax-daily ()
407 "Day-per-page Filofax calendar for week indicated by cursor."
408 (interactive)
409 (save-excursion
410 (calendar-mouse-goto-date (calendar-event-to-date))
411 (cal-tex-cursor-filofax-daily nil)))
412
413 (defun cal-tex-mouse-filofax-2week ()
414 "One page Filofax calendar for week indicated by cursor."
415 (interactive)
416 (save-excursion
417 (calendar-mouse-goto-date (calendar-event-to-date))
418 (cal-tex-cursor-filofax-2week nil)))
419
420 (defun cal-tex-mouse-filofax-week ()
421 "Two page Filofax calendar for week indicated by cursor."
422 (interactive)
423 (save-excursion
424 (calendar-mouse-goto-date (calendar-event-to-date))
425 (cal-tex-cursor-filofax-week nil)))
426
427 (defun cal-tex-mouse-month ()
428 "Make a buffer with LaTeX commands for the month cursor is on.
429 Calendar is condensed onto one page."
430 (interactive)
431 (save-excursion
432 (calendar-mouse-goto-date (calendar-event-to-date))
433 (cal-tex-cursor-month nil)))
434
435 (defun cal-tex-mouse-month-landscape ()
436 "Make a buffer with LaTeX commands for the month cursor is on.
437 The output is in landscape format, one month to a page."
438 (interactive)
439 (save-excursion
440 (calendar-mouse-goto-date (calendar-event-to-date))
441 (cal-tex-cursor-month-landscape nil)))
442
443 (defun cal-tex-mouse-year ()
444 "Make a buffer with LaTeX commands for the year cursor is on."
445 (interactive)
446 (save-excursion
447 (calendar-mouse-goto-date (calendar-event-to-date))
448 (cal-tex-cursor-year nil)))
449
450 (defun cal-tex-mouse-filofax-year ()
451 "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on."
452 (interactive)
453 (save-excursion
454 (calendar-mouse-goto-date (calendar-event-to-date))
455 (cal-tex-cursor-filofax-year nil)))
456
457 (defun cal-tex-mouse-year-landscape ()
458 "Make a buffer with LaTeX commands for the year cursor is on."
459 (interactive)
460 (save-excursion
461 (calendar-mouse-goto-date (calendar-event-to-date))
462 (cal-tex-cursor-year-landscape nil)))
463
464 (defun calendar-mouse-print-dates ()
465 "Pop up menu of equivalent dates to mouse selected date."
466 (interactive)
467 (let ((date (calendar-event-to-date))
468 (selection
469 (cal-menu-x-popup-menu
470 event
471 (list
472 (concat (calendar-date-string date) " (Gregorian)")
473 (append
474 (list
475 (concat (calendar-date-string date) " (Gregorian)")
476 (list (calendar-day-of-year-string date))
477 (list (format "ISO date: %s" (calendar-iso-date-string date)))
478 (list (format "Julian date: %s"
479 (calendar-julian-date-string date)))
480 (list
481 (format "Astronomical (Julian) day number (at noon UTC): %s.0"
482 (calendar-astro-date-string date)))
483 (list
484 (format "Fixed (RD) date: %s"
485 (calendar-absolute-from-gregorian date)))
486 (list (format "Hebrew date (before sunset): %s"
487 (calendar-hebrew-date-string date)))
488 (list (format "Persian date: %s"
489 (calendar-persian-date-string date))))
490 (let ((i (calendar-islamic-date-string date)))
491 (if (not (string-equal i ""))
492 (list (list (format "Islamic date (before sunset): %s" i)))))
493 (list
494 (list (format "Chinese date: %s"
495 (calendar-chinese-date-string date))))
496 ; (list '("Chinese date (select to echo Chinese date)"
497 ; . calendar-mouse-chinese-date))
498 (let ((c (calendar-coptic-date-string date)))
499 (if (not (string-equal c ""))
500 (list (list (format "Coptic date: %s" c)))))
501 (let ((e (calendar-ethiopic-date-string date)))
502 (if (not (string-equal e ""))
503 (list (list (format "Ethiopic date: %s" e)))))
504 (let ((f (calendar-french-date-string date)))
505 (if (not (string-equal f ""))
506 (list (list (format "French Revolutionary date: %s" f)))))
507 (list
508 (list
509 (format "Mayan date: %s"
510 (calendar-mayan-date-string date)))))))))
511 (and selection (call-interactively selection))))
512
513 (defun calendar-mouse-chinese-date ()
514 "Show Chinese equivalent for mouse-selected date."
515 (interactive)
516 (save-excursion
517 (calendar-mouse-goto-date (calendar-event-to-date))
518 (calendar-print-chinese-date)))
519
520 (defun calendar-mouse-goto-date (date)
521 (set-buffer (window-buffer (posn-window (event-start last-input-event))))
522 (calendar-goto-date date))
523
524 (defun calendar-mouse-2-date-menu (event)
525 "Pop up menu for Mouse-2 for selected date in the calendar window."
526 (interactive "e")
527 (let* ((date (calendar-event-to-date t))
528 (selection
529 (cal-menu-x-popup-menu
530 event
531 (list (calendar-date-string date t nil)
532 (list
533 ""
534 '("Holidays" . calendar-mouse-holidays)
535 '("Mark date" . calendar-mouse-set-mark)
536 '("Sunrise/sunset" . calendar-mouse-sunrise/sunset)
537 '("Other calendars" . calendar-mouse-print-dates)
538 '("Prepare LaTeX buffer" . calendar-mouse-cal-tex-menu)
539 '("Diary entries" . calendar-mouse-view-diary-entries)
540 '("Insert diary entry" . calendar-mouse-insert-diary-entry)
541 '("Other diary file entries"
542 . calendar-mouse-view-other-diary-entries)
543 )))))
544 (and selection (call-interactively selection))))
545
546 (defun calendar-mouse-cal-tex-menu (event)
547 "Pop up submenu for Mouse-2 for cal-tex commands for selected date in the calendar window."
548 (interactive "e")
549 (let* ((selection
550 (cal-menu-x-popup-menu
551 event
552 (list (calendar-date-string date t nil)
553 (list
554 ""
555 '("Daily (1 page)" . cal-tex-mouse-day)
556 '("Weekly (1 page)" . cal-tex-mouse-week)
557 '("Weekly (2 pages)" . cal-tex-mouse-week2)
558 '("Weekly (other style; 1 page)" . cal-tex-mouse-week-iso)
559 '("Weekly (yet another style; 1 page)" .
560 cal-tex-mouse-week-monday)
561 '("Monthly" . cal-tex-mouse-month)
562 '("Monthly (landscape)" . cal-tex-mouse-month-landscape)
563 '("Yearly" . cal-tex-mouse-year)
564 '("Yearly (landscape)" . cal-tex-mouse-year-landscape)
565 '("Filofax styles" . cal-tex-mouse-filofax)
566 )))))
567 (and selection (call-interactively selection))))
568
569 (defun cal-tex-mouse-filofax (event)
570 "Pop up sub-submenu for Mouse-2 for Filofax cal-tex commands for selected date."
571 (interactive "e")
572 (let* ((selection
573 (cal-menu-x-popup-menu
574 event
575 (list (calendar-date-string date t nil)
576 (list
577 ""
578 '("Filofax Daily (one-day-per-page)" .
579 cal-tex-mouse-filofax-daily)
580 '("Filofax Weekly (2-weeks-at-a-glance)" .
581 cal-tex-mouse-filofax-2week)
582 '("Filofax Weekly (week-at-a-glance)" .
583 cal-tex-mouse-filofax-week)
584 '("Filofax Yearly" . cal-tex-mouse-filofax-year)
585 )))))
586 (and selection (call-interactively selection))))
587
588 (define-key calendar-mouse-3-map [exit-calendar]
589 '("Exit calendar" . exit-calendar))
590 (define-key calendar-mouse-3-map [show-diary]
591 '("Show diary" . show-all-diary-entries))
592 (define-key calendar-mouse-3-map [lunar-phases]
593 '("Lunar phases" . calendar-phases-of-moon))
594 (define-key calendar-mouse-3-map [unmark]
595 '("Unmark" . calendar-unmark))
596 (define-key calendar-mouse-3-map [mark-holidays]
597 '("Mark holidays" . mark-calendar-holidays))
598 (define-key calendar-mouse-3-map [list-holidays]
599 '("List holidays" . list-calendar-holidays))
600 (define-key calendar-mouse-3-map [mark-diary-entries]
601 '("Mark diary entries" . mark-diary-entries))
602 (define-key calendar-mouse-3-map [scroll-backward]
603 '("Scroll backward" . scroll-calendar-right-three-months))
604 (define-key calendar-mouse-3-map [scroll-forward]
605 '("Scroll forward" . scroll-calendar-left-three-months))
606
607 (run-hooks 'cal-menu-load-hook)
608
609 (provide 'cal-menu)
610
611 ;;; cal-menu.el ends here