Mercurial > emacs
annotate lisp/calendar/cal-menu.el @ 12556:fb1b760f6636
(vendor-specific-keysyms):
In Sun keys, f36 was misnamed f35 and f37 misnamed f36.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 17 Jul 1995 22:49:37 +0000 |
parents | f7638ab47de7 |
children | 6c3c9645fbfd |
rev | line source |
---|---|
5701 | 1 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support |
2 | |
3 ;; Copyright (C) 1994 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 | |
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"))) |
5701 | 103 (define-key calendar-mode-map [menu-bar goto julian] |
12033 | 104 '("Julian Date" . calendar-goto-julian-date)) |
5701 | 105 (define-key calendar-mode-map [menu-bar goto islamic] |
12033 | 106 '("Islamic Date" . calendar-goto-islamic-date)) |
5701 | 107 (define-key calendar-mode-map [menu-bar goto hebrew] |
12033 | 108 '("Hebrew Date" . calendar-goto-hebrew-date)) |
5701 | 109 (define-key calendar-mode-map [menu-bar goto astro] |
12033 | 110 '("Astronomical Date" . calendar-goto-astro-day-number)) |
5701 | 111 (define-key calendar-mode-map [menu-bar goto iso] |
12033 | 112 '("ISO Date" . calendar-goto-iso-date)) |
5701 | 113 (define-key calendar-mode-map [menu-bar goto gregorian] |
12033 | 114 '("Other Date" . calendar-goto-date)) |
5701 | 115 (define-key calendar-mode-map [menu-bar goto end-of-year] |
12033 | 116 '("End of Year" . calendar-end-of-year)) |
5701 | 117 (define-key calendar-mode-map [menu-bar goto beginning-of-year] |
12033 | 118 '("Beginning of Year" . calendar-beginning-of-year)) |
5701 | 119 (define-key calendar-mode-map [menu-bar goto end-of-month] |
12033 | 120 '("End of Month" . calendar-end-of-month)) |
5701 | 121 (define-key calendar-mode-map [menu-bar goto beginning-of-month] |
12033 | 122 '("Beginning of Month" . calendar-beginning-of-month)) |
5701 | 123 (define-key calendar-mode-map [menu-bar goto end-of-week] |
12033 | 124 '("End of Week" . calendar-end-of-week)) |
5701 | 125 (define-key calendar-mode-map [menu-bar goto beginning-of-week] |
12033 | 126 '("Beginning of Week" . calendar-beginning-of-week)) |
5701 | 127 (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
|
128 '("Today" . calendar-goto-today)) |
5701 | 129 |
130 | |
131 (define-key calendar-mode-map [menu-bar goto mayan prev-rnd] | |
132 '("Previous Round" . calendar-previous-calendar-round-date)) | |
133 (define-key calendar-mode-map [menu-bar goto mayan nxt-rnd] | |
134 '("Next Round" . calendar-next-calendar-round-date)) | |
135 (define-key calendar-mode-map [menu-bar goto mayan prev-haab] | |
136 '("Previous Haab" . calendar-previous-haab-date)) | |
137 (define-key calendar-mode-map [menu-bar goto mayan next-haab] | |
138 '("Next Haab" . calendar-next-haab-date)) | |
139 (define-key calendar-mode-map [menu-bar goto mayan prev-tzol] | |
140 '("Previous Tzolkin" . calendar-previous-tzolkin-date)) | |
141 (define-key calendar-mode-map [menu-bar goto mayan next-tzol] | |
142 '("Next Tzolkin" . calendar-next-tzolkin-date)) | |
143 | |
144 (define-key calendar-mode-map [menu-bar scroll] | |
145 (cons "Scroll" (make-sparse-keymap "Scroll"))) | |
146 | |
147 (define-key calendar-mode-map [menu-bar scroll bk-12] | |
148 '("Backward 1 Year" . "4\ev")) | |
149 (define-key calendar-mode-map [menu-bar scroll bk-3] | |
150 '("Backward 3 Months" . scroll-calendar-right-three-months)) | |
151 (define-key calendar-mode-map [menu-bar scroll bk-1] | |
152 '("Backward 1 Month" . scroll-calendar-right)) | |
153 (define-key calendar-mode-map [menu-bar scroll fwd-12] | |
154 '("Forward 1 Year" . "4\C-v")) | |
155 (define-key calendar-mode-map [menu-bar scroll fwd-3] | |
156 '("Forward 3 Months" . scroll-calendar-left-three-months)) | |
157 (define-key calendar-mode-map [menu-bar scroll fwd-1] | |
158 '("Forward 1 Month" . scroll-calendar-left)) | |
159 | |
160 (put 'calendar-forward-day 'menu-enable '(calendar-cursor-to-date)) | |
161 (put 'calendar-backward-day 'menu-enable '(calendar-cursor-to-date)) | |
162 (put 'calendar-forward-week 'menu-enable '(calendar-cursor-to-date)) | |
163 (put 'calendar-backward-week 'menu-enable '(calendar-cursor-to-date)) | |
164 (put 'calendar-forward-month 'menu-enable '(calendar-cursor-to-date)) | |
165 (put 'calendar-backward-month 'menu-enable '(calendar-cursor-to-date)) | |
166 (put 'calendar-forward-year 'menu-enable '(calendar-cursor-to-date)) | |
167 (put 'calendar-backward-year 'menu-enable '(calendar-cursor-to-date)) | |
168 (put 'calendar-beginning-of-year 'menu-enable '(calendar-cursor-to-date)) | |
169 (put 'calendar-end-of-year 'menu-enable '(calendar-cursor-to-date)) | |
170 (put 'calendar-beginning-of-month 'menu-enable '(calendar-cursor-to-date)) | |
171 (put 'calendar-end-of-month 'menu-enable '(calendar-cursor-to-date)) | |
172 (put 'calendar-end-of-week 'menu-enable '(calendar-cursor-to-date)) | |
173 (put 'calendar-beginning-of-week 'menu-enable '(calendar-cursor-to-date)) | |
174 (put 'calendar-mouse-print-dates 'menu-enable '(calendar-event-to-date)) | |
175 (put 'calendar-sunrise-sunset 'menu-enable '(calendar-event-to-date)) | |
176 (put 'calendar-cursor-holidays 'menu-enable '(calendar-cursor-to-date)) | |
177 (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
|
178 (put 'view-other-diary-entries 'menu-enable '(calendar-cursor-to-date)) |
5701 | 179 (put 'calendar-mouse-insert-hebrew-diary-entry |
180 'menu-enable | |
181 '(calendar-cursor-to-date)) | |
182 (put 'calendar-mouse-insert-islamic-diary-entry | |
183 'menu-enable | |
184 '(calendar-cursor-to-date)) | |
185 (put 'insert-cyclic-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
186 (put 'insert-block-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
187 (put 'insert-anniversary-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
188 (put 'insert-yearly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
189 (put 'insert-monthly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
190 (put 'insert-weekly-diary-entry 'menu-enable '(calendar-cursor-to-date)) | |
191 | |
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
|
192 (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
|
193 "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
|
194 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
|
195 ERROR is t, otherwise just returns nil." |
5701 | 196 (save-excursion |
197 (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
|
198 (calendar-cursor-to-date error))) |
5701 | 199 |
200 (defun calendar-mouse-insert-hebrew-diary-entry (event) | |
201 "Pop up menu to insert a Hebrew-date diary entry." | |
202 (interactive "e") | |
203 (let ((hebrew-selection | |
204 (x-popup-menu | |
205 event | |
206 (list "Hebrew insert menu" | |
207 (list (calendar-hebrew-date-string (calendar-cursor-to-date)) | |
208 '("One time" . insert-hebrew-diary-entry) | |
209 '("Monthly" . insert-monthly-hebrew-diary-entry) | |
210 '("Yearly" . insert-yearly-hebrew-diary-entry)))))) | |
211 (and hebrew-selection (call-interactively hebrew-selection)))) | |
212 | |
213 (defun calendar-mouse-insert-islamic-diary-entry (event) | |
214 "Pop up menu to insert an Islamic-date diary entry." | |
215 (interactive "e") | |
216 (let ((islamic-selection | |
217 (x-popup-menu | |
218 event | |
219 (list "Islamic insert menu" | |
220 (list (calendar-islamic-date-string (calendar-cursor-to-date)) | |
221 '("One time" . insert-islamic-diary-entry) | |
222 '("Monthly" . insert-monthly-islamic-diary-entry) | |
223 '("Yearly" . insert-yearly-islamic-diary-entry)))))) | |
224 (and islamic-selection (call-interactively islamic-selection)))) | |
225 | |
226 (defun calendar-mouse-sunrise/sunset () | |
227 "Show sunrise/sunset times for mouse-selected date." | |
228 (interactive) | |
229 (save-excursion | |
230 (calendar-goto-date (calendar-event-to-date)) | |
231 (calendar-sunrise-sunset))) | |
232 | |
233 (defun calendar-mouse-holidays () | |
234 "Show holidays for mouse-selected date." | |
235 (interactive) | |
236 (save-excursion | |
237 (calendar-goto-date (calendar-event-to-date)) | |
238 (calendar-cursor-holidays))) | |
239 | |
240 (defun calendar-mouse-view-diary-entries () | |
241 "View diary entries on mouse-selected date." | |
242 (interactive) | |
243 (save-excursion | |
244 (calendar-goto-date (calendar-event-to-date)) | |
245 (view-diary-entries 1))) | |
246 | |
9766
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
247 (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
|
248 "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
|
249 (interactive) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
250 (save-excursion |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
251 (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
|
252 (call-interactively 'view-other-diary-entries))) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
253 |
9710
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
254 (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
|
255 "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
|
256 (interactive) |
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
257 (save-excursion |
b5fb08fb2cb3
Put insertion of diary entry on daily menu.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
8308
diff
changeset
|
258 (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
|
259 (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
|
260 |
7412
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
261 (defun calendar-mouse-set-mark () |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
262 "Mark the date under the cursor." |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
263 (interactive) |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
264 (save-excursion |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
265 (calendar-goto-date (calendar-event-to-date)) |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
266 (calendar-set-mark nil))) |
f067e1a5ceb4
(calendar-mouse-set-mark): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7403
diff
changeset
|
267 |
5701 | 268 (defun calendar-mouse-print-dates () |
269 "Pop up menu of equivalent dates to mouse selected date." | |
270 (interactive) | |
271 (let ((date (calendar-event-to-date))) | |
272 (x-popup-menu | |
273 event | |
274 (list | |
275 "Date Menu" | |
276 (append | |
277 (list | |
278 (concat (calendar-date-string date) " (Gregorian)") | |
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
|
279 (list (calendar-day-of-year-string date)) |
5701 | 280 (list (format "ISO date: %s" (calendar-iso-date-string date))) |
281 (list (format "Julian date: %s" (calendar-julian-date-string date))) | |
282 (list (format "Astronomical (Julian) date (before noon): %s" | |
283 (calendar-astro-date-string date))) | |
284 (list (format "Hebrew date (before sunset): %s" | |
285 (calendar-hebrew-date-string date)))) | |
286 (let ((i (calendar-islamic-date-string date))) | |
287 (if (not (string-equal i "")) | |
7402
494ca99e9517
(calendar-mouse-print-dates): Add missing level of list
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
288 (list (list (format "Islamic date (before sunset): %s" i))))) |
5701 | 289 (let ((f (calendar-french-date-string date))) |
290 (if (not (string-equal f "")) | |
7402
494ca99e9517
(calendar-mouse-print-dates): Add missing level of list
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
291 (list (list (format "French Revolutionary date: %s" f))))) |
5701 | 292 (list |
7402
494ca99e9517
(calendar-mouse-print-dates): Add missing level of list
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
293 (list |
494ca99e9517
(calendar-mouse-print-dates): Add missing level of list
Richard M. Stallman <rms@gnu.org>
parents:
6736
diff
changeset
|
294 (format "Mayan date: %s" (calendar-mayan-date-string date))))))))) |
5701 | 295 |
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
|
296 (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
|
297 "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
|
298 (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
|
299 (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
|
300 (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
|
301 (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
|
302 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
|
303 (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
|
304 (list |
27fdaecd7cb1
(calendar-mode-map): Change binding of Mouse-2. Bind Mouse-3.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
7412
diff
changeset
|
305 (calendar-date-string date t 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
|
306 '("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
|
307 '("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
|
308 '("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
|
309 '("Other calendars" . calendar-mouse-print-dates) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
310 '("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
|
311 '("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
|
312 '("Other diary file entries" |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
313 . calendar-mouse-view-other-diary-entries) |
71c37f31a02d
Bind new function to mouse.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
9734
diff
changeset
|
314 ))))) |
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
|
315 (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
|
316 |
7478
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
317 (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
|
318 '("Exit calendar" . exit-calendar)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
319 (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
|
320 '("Show diary" . show-all-diary-entries)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
321 (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
|
322 '("Lunar phases" . calendar-phases-of-moon)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
323 (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
|
324 '("Unmark" . calendar-unmark)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
325 (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
|
326 '("Mark holidays" . mark-calendar-holidays)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
327 (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
|
328 '("List holidays" . list-calendar-holidays)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
329 (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
|
330 '("Mark diary entries" . mark-diary-entries)) |
57cfbcfdf92a
Rewrite mouse-3 menu as a keymap.
Richard M. Stallman <rms@gnu.org>
parents:
7442
diff
changeset
|
331 (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
|
332 '("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
|
333 (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
|
334 '("Scroll forward" . scroll-calendar-left-three-months)) |
5701 | 335 |
336 (run-hooks 'cal-menu-load-hook) | |
337 | |
338 (provide 'cal-menu) | |
339 | |
340 ;;; cal-menu.el ends here |