aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-06-18 02:56:39 +0000
committerGlenn Morris2008-06-18 02:56:39 +0000
commitdf59aa7bc849c263e99d842d50fbcbb1a5e59a19 (patch)
tree2429e4d2856f32f0d695b58a45ee1a1b66d5f7b8
parentf1eb28f2ab4cb04e140708c7b0c604cecf68309a (diff)
downloademacs-df59aa7bc849c263e99d842d50fbcbb1a5e59a19.tar.gz
emacs-df59aa7bc849c263e99d842d50fbcbb1a5e59a19.zip
(cal-menu-holidays-menu): Use calendar-cursor-holidays rather than
cal-menu-today-holidays. (cal-menu-today-holidays): Remove function. (cal-menu-holiday-window-suffix): Simplify. (cal-menu-list-holidays-year, cal-menu-list-holidays-following-year) (cal-menu-list-holidays-previous-year, calendar-mouse-goto-date): Remove unused functions. (calendar-mouse-view-diary-entries): Use format rather than concat. (cal-menu-x-popup-menu): Turn it into a macro. (calendar-mouse-holidays, calendar-mouse-view-diary-entries) (calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change. (cal-menu-event-to-date): Remove function. (calendar-mouse-holidays, calendar-mouse-view-diary-entries) (calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates) (cal-menu-set-date-title): Use calendar-cursor-to-date rather than cal-menu-event-to-date. (calendar-mouse-tex-day, calendar-mouse-tex-week, calendar-mouse-tex-week2) (calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday) (calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week) (calendar-mouse-tex-filofax-week, calendar-mouse-tex-month) (calendar-mouse-tex-month-landscape, calendar-mouse-tex-year) (calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape): Remove functions. (cal-menu-context-mouse-menu): Replace the above functions with the cal-tex versions. Add HTML submenu.
-rw-r--r--lisp/ChangeLog48
-rw-r--r--lisp/calendar/cal-menu.el261
2 files changed, 108 insertions, 201 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 694aa5ac9dc..3e02738e9b7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,51 @@
12008-06-18 Glenn Morris <rgm@gnu.org>
2
3 * mouse.el (buffer-face-mode-invoke): Declare.
4
5 * Makefile.in (ELCFILES): Add org/org-id.elc.
6
7 * calendar/holidays.el (calendar-cursor-holidays): Accept optional date.
8 * calendar/cal-menu.el (cal-menu-holidays-menu):
9 Use calendar-cursor-holidays rather than cal-menu-today-holidays.
10 (cal-menu-today-holidays): Remove function.
11
12 * calendar/cal-menu.el (cal-menu-holiday-window-suffix): Simplify.
13 (cal-menu-list-holidays-year, cal-menu-list-holidays-following-year)
14 (cal-menu-list-holidays-previous-year, calendar-mouse-goto-date):
15 Remove unused functions.
16 (calendar-mouse-view-diary-entries): Use format rather than concat.
17
18 * calendar/cal-menu.el (cal-menu-x-popup-menu): Turn it into a macro.
19 (calendar-mouse-holidays, calendar-mouse-view-diary-entries)
20 (calendar-mouse-print-dates): Adapt for cal-menu-x-popup-menu change.
21
22 * calendar/cal-menu.el (cal-menu-event-to-date): Remove function.
23 (calendar-mouse-holidays, calendar-mouse-view-diary-entries)
24 (calendar-mouse-view-other-diary-entries, calendar-mouse-print-dates)
25 (cal-menu-set-date-title): Use calendar-cursor-to-date rather than
26 cal-menu-event-to-date.
27
28 * calendar/cal-html.el (cal-html-cursor-month, cal-html-cursor-year):
29 Handle mouse events.
30 * calendar/cal-tex.el (cal-tex-cursor-year)
31 (cal-tex-cursor-year-landscape, cal-tex-cursor-filofax-year)
32 (cal-tex-cursor-month-landscape, cal-tex-cursor-month)
33 (cal-tex-cursor-week, cal-tex-cursor-week2, cal-tex-cursor-week-iso)
34 (cal-tex-cursor-week-monday, cal-tex-cursor-filofax-2week)
35 (cal-tex-cursor-filofax-week, cal-tex-cursor-filofax-daily)
36 (cal-tex-cursor-day): Handle mouse events. Rename ARG to N.
37 (cal-tex-cursor-month): Mark N as optional.
38 * calendar/cal-menu.el (calendar-mouse-tex-day)
39 (calendar-mouse-tex-week, calendar-mouse-tex-week2)
40 (calendar-mouse-tex-week-iso, calendar-mouse-tex-week-monday)
41 (calendar-mouse-tex-filofax-daily, calendar-mouse-tex-filofax-2week)
42 (calendar-mouse-tex-filofax-week, calendar-mouse-tex-month)
43 (calendar-mouse-tex-month-landscape, calendar-mouse-tex-year)
44 (calendar-mouse-tex-filofax-year, calendar-mouse-tex-year-landscape):
45 Remove functions.
46 (cal-menu-context-mouse-menu): Replace the above functions with the
47 cal-tex versions. Add HTML submenu.
48
12008-06-17 Nick Roberts <nickrob@snap.net.nz> 492008-06-17 Nick Roberts <nickrob@snap.net.nz>
2 50
3 * progmodes/gdb-ui.el (gud-gdba-marker-filter): Don't switch to 51 * progmodes/gdb-ui.el (gud-gdba-marker-filter): Don't switch to
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el
index e3aa337ee92..9473ee7fd84 100644
--- a/lisp/calendar/cal-menu.el
+++ b/lisp/calendar/cal-menu.el
@@ -66,16 +66,14 @@
66 "Return a string suffix for the \"Window\" entry in `cal-menu-holidays-menu'." 66 "Return a string suffix for the \"Window\" entry in `cal-menu-holidays-menu'."
67 (let ((my1 (calendar-increment-month-cons -1)) 67 (let ((my1 (calendar-increment-month-cons -1))
68 (my2 (calendar-increment-month-cons 1))) 68 (my2 (calendar-increment-month-cons 1)))
69 (if (= (cdr my1) (cdr my2)) 69 ;; Mon1-Mon2, Year or Mon1, Year1-Mon2, Year2.
70 (format "%s-%s, %d" 70 (format "%s%s-%s, %d"
71 (calendar-month-name (car my1) 'abbrev) 71 (calendar-month-name (car my1) 'abbrev)
72 (calendar-month-name (car my2) 'abbrev) 72 (if (= (cdr my1) (cdr my2))
73 (cdr my2)) 73 ""
74 (format "%s, %d-%s, %d" 74 (format ", %d" (cdr my1)))
75 (calendar-month-name (car my1) 'abbrev) 75 (calendar-month-name (car my2) 'abbrev)
76 (cdr my1) 76 (cdr my2))))
77 (calendar-month-name (car my2) 'abbrev)
78 (cdr my2)))))
79 77
80(defvar displayed-year) ; from calendar-generate 78(defvar displayed-year) ; from calendar-generate
81 79
@@ -86,7 +84,7 @@
86 :visible (calendar-cursor-to-date)] 84 :visible (calendar-cursor-to-date)]
87 ["For Window -" calendar-list-holidays 85 ["For Window -" calendar-list-holidays
88 :suffix (cal-menu-holiday-window-suffix)] 86 :suffix (cal-menu-holiday-window-suffix)]
89 ["For Today -" cal-menu-today-holidays 87 ["For Today -" (calendar-cursor-holidays (calendar-current-date))
90 :suffix (calendar-date-string (calendar-current-date) t t)] 88 :suffix (calendar-date-string (calendar-current-date) t t)]
91 "--" 89 "--"
92 ,@(let ((l ())) 90 ,@(let ((l ()))
@@ -148,48 +146,13 @@
148 ["Backward 3 Months" calendar-scroll-right-three-months] 146 ["Backward 3 Months" calendar-scroll-right-three-months]
149 ["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"])) 147 ["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"]))
150 148
151(defun cal-menu-x-popup-menu (position menu) 149(defmacro cal-menu-x-popup-menu (event title &rest body)
152 "Like `x-popup-menu', but print an error message if popups are unavailable. 150 "Call `x-popup-menu' at position EVENT, with TITLE and contents BODY.
153POSITION and MENU are passed to `x-popup-menu'." 151Signals an error if popups are unavailable."
154 (if (display-popup-menus-p) 152 (declare (indent 2))
155 (x-popup-menu position menu) 153 `(if (display-popup-menus-p)
156 (error "Popup menus are not available on this system"))) 154 (x-popup-menu ,event (list ,title (append (list ,title) ,@body)))
157 155 (error "Popup menus are not available on this system")))
158(defun cal-menu-list-holidays-year ()
159 "Display a list of the holidays of the selected date's year."
160 (interactive)
161 (holiday-list (calendar-extract-year (calendar-cursor-to-date))))
162
163(defun cal-menu-list-holidays-following-year ()
164 "Display a list of the holidays of the following year."
165 (interactive)
166 (holiday-list (1+ (calendar-extract-year (calendar-cursor-to-date)))))
167
168(defun cal-menu-list-holidays-previous-year ()
169 "Display a list of the holidays of the previous year."
170 (interactive)
171 (holiday-list (1- (calendar-extract-year (calendar-cursor-to-date)))))
172
173(defun cal-menu-event-to-date (&optional error)
174 "Date of last event.
175If event is not on a specific date, signals an error if optional parameter
176ERROR is non-nil, otherwise just returns nil."
177 (with-current-buffer
178 (window-buffer (posn-window (event-start last-input-event)))
179 (goto-char (posn-point (event-start last-input-event)))
180 (calendar-cursor-to-date error)))
181
182(defun calendar-mouse-goto-date (date)
183 "Go to DATE in the buffer specified by `last-input-event'."
184 (set-buffer (window-buffer (posn-window (event-start last-input-event))))
185 (calendar-goto-date date))
186
187(defun cal-menu-today-holidays ()
188 "Show holidays for today's date."
189 (interactive)
190 (save-excursion
191 (calendar-cursor-to-date (calendar-current-date))
192 (calendar-cursor-holidays)))
193 156
194(autoload 'calendar-check-holidays "holidays") 157(autoload 'calendar-check-holidays "holidays")
195 158
@@ -197,15 +160,11 @@ ERROR is non-nil, otherwise just returns nil."
197 "Pop up menu of holidays for mouse selected date. 160 "Pop up menu of holidays for mouse selected date.
198EVENT is the event that invoked this command." 161EVENT is the event that invoked this command."
199 (interactive "e") 162 (interactive "e")
200 (let* ((date (cal-menu-event-to-date)) 163 (let* ((date (calendar-cursor-to-date nil event))
201 (title (format "Holidays for %s" (calendar-date-string date))) 164 (title (format "Holidays for %s" (calendar-date-string date)))
202 (selection 165 (selection (cal-menu-x-popup-menu event title
203 (cal-menu-x-popup-menu 166 (or (mapcar 'list (calendar-check-holidays date))
204 event 167 '("None")))))
205 (list title
206 (append (list title)
207 (or (mapcar 'list (calendar-check-holidays date))
208 '("None")))))))
209 (and selection (call-interactively selection)))) 168 (and selection (call-interactively selection))))
210 169
211(autoload 'diary-list-entries "diary-lib") 170(autoload 'diary-list-entries "diary-lib")
@@ -217,153 +176,48 @@ Use optional DATE and alternative file DIARY. EVENT is the event
217that invoked this command. Shows holidays if `diary-show-holidays-flag' 176that invoked this command. Shows holidays if `diary-show-holidays-flag'
218is non-nil." 177is non-nil."
219 (interactive "i\ni\ne") 178 (interactive "i\ni\ne")
220 (let* ((date (or date (cal-menu-event-to-date))) 179 (let* ((date (or date (calendar-cursor-to-date nil event)))
221 (diary-file (or diary diary-file)) 180 (diary-file (or diary diary-file))
222 (diary-list-include-blanks nil) 181 (diary-list-include-blanks nil)
223 (diary-entries 182 (diary-entries (mapcar (lambda (x) (split-string (cadr x) "\n"))
224 (mapcar (lambda (x) (split-string (cadr x) "\n")) 183 (diary-list-entries date 1 'list-only)))
225 (diary-list-entries date 1 'list-only)))
226 (holidays (if diary-show-holidays-flag 184 (holidays (if diary-show-holidays-flag
227 (calendar-check-holidays date))) 185 (calendar-check-holidays date)))
228 (title (concat "Diary entries " 186 (title (format "Diary entries%s for %s"
229 (if diary (format "from %s " diary) "") 187 (if diary (format " from %s" diary) "")
230 "for "
231 (calendar-date-string date))) 188 (calendar-date-string date)))
232 (selection 189 (selection (cal-menu-x-popup-menu event title
233 (cal-menu-x-popup-menu 190 (mapcar (lambda (x) (list (concat " " x))) holidays)
234 event 191 (if holidays
235 (list title 192 (list "--shadow-etched-in" "--shadow-etched-in"))
236 (append 193 (if diary-entries
237 (list title) 194 (mapcar 'list (apply 'append diary-entries))
238 (mapcar (lambda (x) (list (concat " " x))) holidays) 195 '("None")))))
239 (if holidays
240 (list "--shadow-etched-in" "--shadow-etched-in"))
241 (if diary-entries
242 (mapcar 'list (apply 'append diary-entries))
243 '("None")))))))
244 (and selection (call-interactively selection)))) 196 (and selection (call-interactively selection))))
245 197
246(defun calendar-mouse-view-other-diary-entries () 198(defun calendar-mouse-view-other-diary-entries (&optional event)
247 "Pop up menu of diary entries from alternative file on mouse-selected date." 199 "Pop up menu of diary entries from alternative file on mouse-selected date."
248 (interactive) 200 (interactive "e")
249 (calendar-mouse-view-diary-entries 201 (calendar-mouse-view-diary-entries
250 (cal-menu-event-to-date) 202 (calendar-cursor-to-date nil event)
251 (read-file-name "Enter diary file name: " default-directory nil t))) 203 (read-file-name "Enter diary file name: " default-directory nil t)
252 204 event))
253(defun calendar-mouse-tex-day ()
254 "Make a buffer with LaTeX commands for the day mouse is on."
255 (interactive)
256 (save-excursion
257 (calendar-mouse-goto-date (cal-menu-event-to-date))
258 (cal-tex-cursor-day nil)))
259
260(defun calendar-mouse-tex-week ()
261 "One page calendar for week indicated by cursor.
262Holidays are included if `cal-tex-holidays' is non-nil."
263 (interactive)
264 (save-excursion
265 (calendar-mouse-goto-date (cal-menu-event-to-date))
266 (cal-tex-cursor-week nil)))
267
268(defun calendar-mouse-tex-week2 ()
269 "Make a buffer with LaTeX commands for the week cursor is on.
270The printed output will be on two pages."
271 (interactive)
272 (save-excursion
273 (calendar-mouse-goto-date (cal-menu-event-to-date))
274 (cal-tex-cursor-week2 nil)))
275
276(defun calendar-mouse-tex-week-iso ()
277 "One page calendar for week indicated by cursor.
278Holidays are included if `cal-tex-holidays' is non-nil."
279 (interactive)
280 (save-excursion
281 (calendar-mouse-goto-date (cal-menu-event-to-date))
282 (cal-tex-cursor-week-iso nil)))
283
284(defun calendar-mouse-tex-week-monday ()
285 "One page calendar for week indicated by cursor."
286 (interactive)
287 (save-excursion
288 (calendar-mouse-goto-date (cal-menu-event-to-date))
289 (cal-tex-cursor-week-monday nil)))
290
291(defun calendar-mouse-tex-filofax-daily ()
292 "Day-per-page Filofax calendar for week indicated by cursor."
293 (interactive)
294 (save-excursion
295 (calendar-mouse-goto-date (cal-menu-event-to-date))
296 (cal-tex-cursor-filofax-daily nil)))
297
298(defun calendar-mouse-tex-filofax-2week ()
299 "One page Filofax calendar for week indicated by cursor."
300 (interactive)
301 (save-excursion
302 (calendar-mouse-goto-date (cal-menu-event-to-date))
303 (cal-tex-cursor-filofax-2week nil)))
304
305(defun calendar-mouse-tex-filofax-week ()
306 "Two page Filofax calendar for week indicated by cursor."
307 (interactive)
308 (save-excursion
309 (calendar-mouse-goto-date (cal-menu-event-to-date))
310 (cal-tex-cursor-filofax-week nil)))
311
312(defun calendar-mouse-tex-month ()
313 "Make a buffer with LaTeX commands for the month cursor is on.
314Calendar is condensed onto one page."
315 (interactive)
316 (save-excursion
317 (calendar-mouse-goto-date (cal-menu-event-to-date))
318 (cal-tex-cursor-month nil)))
319
320(defun calendar-mouse-tex-month-landscape ()
321 "Make a buffer with LaTeX commands for the month cursor is on.
322The output is in landscape format, one month to a page."
323 (interactive)
324 (save-excursion
325 (calendar-mouse-goto-date (cal-menu-event-to-date))
326 (cal-tex-cursor-month-landscape nil)))
327
328(defun calendar-mouse-tex-year ()
329 "Make a buffer with LaTeX commands for the year cursor is on."
330 (interactive)
331 (save-excursion
332 (calendar-mouse-goto-date (cal-menu-event-to-date))
333 (cal-tex-cursor-year nil)))
334
335(defun calendar-mouse-tex-filofax-year ()
336 "Make a buffer with LaTeX commands for Filofax calendar of year cursor is on."
337 (interactive)
338 (save-excursion
339 (calendar-mouse-goto-date (cal-menu-event-to-date))
340 (cal-tex-cursor-filofax-year nil)))
341
342(defun calendar-mouse-tex-year-landscape ()
343 "Make a buffer with LaTeX commands for the year cursor is on."
344 (interactive)
345 (save-excursion
346 (calendar-mouse-goto-date (cal-menu-event-to-date))
347 (cal-tex-cursor-year-landscape nil)))
348 205
349(defun calendar-mouse-print-dates (&optional event) 206(defun calendar-mouse-print-dates (&optional event)
350 "Pop up menu of equivalent dates to mouse selected date. 207 "Pop up menu of equivalent dates to mouse selected date.
351EVENT is the event that invoked this command." 208EVENT is the event that invoked this command."
352 (interactive "e") 209 (interactive "e")
353 (let* ((date (cal-menu-event-to-date)) 210 (let* ((date (calendar-cursor-to-date nil event))
354 (title (format "%s (Gregorian)" (calendar-date-string date))) 211 (title (format "%s (Gregorian)" (calendar-date-string date)))
355 (selection 212 (selection (cal-menu-x-popup-menu event title
356 (cal-menu-x-popup-menu 213 (mapcar 'list (calendar-other-dates date)))))
357 event
358 (list title
359 (append (list title)
360 (mapcar 'list (calendar-other-dates date)))))))
361 (and selection (call-interactively selection)))) 214 (and selection (call-interactively selection))))
362 215
363(defun cal-menu-set-date-title (menu) 216(defun cal-menu-set-date-title (menu)
364 "Convert date of last event to title suitable for MENU." 217 "Convert date of last event to title suitable for MENU."
365 (easy-menu-filter-return 218 (easy-menu-filter-return
366 menu (calendar-date-string (cal-menu-event-to-date t) t nil))) 219 menu (calendar-date-string (calendar-cursor-to-date t last-input-event)
220 t nil)))
367 221
368(easy-menu-define cal-menu-context-mouse-menu nil 222(easy-menu-define cal-menu-context-mouse-menu nil
369 "Pop up menu for Mouse-2 for selected date in the calendar window." 223 "Pop up menu for Mouse-2 for selected date in the calendar window."
@@ -373,21 +227,26 @@ EVENT is the event that invoked this command."
373 ["Mark date" calendar-set-mark] 227 ["Mark date" calendar-set-mark]
374 ["Sunrise/sunset" calendar-sunrise-sunset] 228 ["Sunrise/sunset" calendar-sunrise-sunset]
375 ["Other calendars" calendar-mouse-print-dates] 229 ["Other calendars" calendar-mouse-print-dates]
230 ;; FIXME there is a bug with last-nonmenu-event and submenus.
231 ;; These currently don't work if called without calendar window selected.
376 ("Prepare LaTeX buffer" 232 ("Prepare LaTeX buffer"
377 ["Daily (1 page)" calendar-mouse-tex-day] 233 ["Daily (1 page)" cal-tex-cursor-day]
378 ["Weekly (1 page)" calendar-mouse-tex-week] 234 ["Weekly (1 page)" cal-tex-cursor-week]
379 ["Weekly (2 pages)" calendar-mouse-tex-week2] 235 ["Weekly (2 pages)" cal-tex-cursor-week2]
380 ["Weekly (other style; 1 page)" calendar-mouse-tex-week-iso] 236 ["Weekly (other style; 1 page)" cal-tex-cursor-week-iso]
381 ["Weekly (yet another style; 1 page)" calendar-mouse-tex-week-monday] 237 ["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday]
382 ["Monthly" calendar-mouse-tex-month] 238 ["Monthly" cal-tex-cursor-month]
383 ["Monthly (landscape)" calendar-mouse-tex-month-landscape] 239 ["Monthly (landscape)" cal-tex-cursor-month-landscape]
384 ["Yearly" calendar-mouse-tex-year] 240 ["Yearly" cal-tex-cursor-year]
385 ["Yearly (landscape)" calendar-mouse-tex-year-landscape] 241 ["Yearly (landscape)" cal-tex-cursor-year-landscape]
386 ("Filofax styles" 242 ("Filofax styles"
387 ["Filofax Daily (one-day-per-page)" calendar-mouse-tex-filofax-daily] 243 ["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily]
388 ["Filofax Weekly (2-weeks-at-a-glance)" calendar-mouse-tex-filofax-2week] 244 ["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week]
389 ["Filofax Weekly (week-at-a-glance)" calendar-mouse-tex-filofax-week] 245 ["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week]
390 ["Filofax Yearly" calendar-mouse-tex-filofax-year])) 246 ["Filofax Yearly" cal-tex-cursor-filofax-year]))
247 ("Write HTML calendar"
248 ["For selected month" cal-html-cursor-month]
249 ["For selected year" cal-html-cursor-year])
391 ["Diary entries" calendar-mouse-view-diary-entries] 250 ["Diary entries" calendar-mouse-view-diary-entries]
392 ["Insert diary entry" diary-insert-entry] 251 ["Insert diary entry" diary-insert-entry]
393 ["Other diary file entries" calendar-mouse-view-other-diary-entries])) 252 ["Other diary file entries" calendar-mouse-view-other-diary-entries]))