mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-26 10:49:33 +00:00
(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.
This commit is contained in:
parent
f1eb28f2ab
commit
df59aa7bc8
@ -1,3 +1,51 @@
|
||||
2008-06-18 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* mouse.el (buffer-face-mode-invoke): Declare.
|
||||
|
||||
* Makefile.in (ELCFILES): Add org/org-id.elc.
|
||||
|
||||
* calendar/holidays.el (calendar-cursor-holidays): Accept optional date.
|
||||
* calendar/cal-menu.el (cal-menu-holidays-menu):
|
||||
Use calendar-cursor-holidays rather than cal-menu-today-holidays.
|
||||
(cal-menu-today-holidays): Remove function.
|
||||
|
||||
* calendar/cal-menu.el (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.
|
||||
|
||||
* calendar/cal-menu.el (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.
|
||||
|
||||
* calendar/cal-menu.el (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/cal-html.el (cal-html-cursor-month, cal-html-cursor-year):
|
||||
Handle mouse events.
|
||||
* calendar/cal-tex.el (cal-tex-cursor-year)
|
||||
(cal-tex-cursor-year-landscape, cal-tex-cursor-filofax-year)
|
||||
(cal-tex-cursor-month-landscape, cal-tex-cursor-month)
|
||||
(cal-tex-cursor-week, cal-tex-cursor-week2, cal-tex-cursor-week-iso)
|
||||
(cal-tex-cursor-week-monday, cal-tex-cursor-filofax-2week)
|
||||
(cal-tex-cursor-filofax-week, cal-tex-cursor-filofax-daily)
|
||||
(cal-tex-cursor-day): Handle mouse events. Rename ARG to N.
|
||||
(cal-tex-cursor-month): Mark N as optional.
|
||||
* calendar/cal-menu.el (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.
|
||||
|
||||
2008-06-17 Nick Roberts <nickrob@snap.net.nz>
|
||||
|
||||
* progmodes/gdb-ui.el (gud-gdba-marker-filter): Don't switch to
|
||||
|
@ -66,16 +66,14 @@
|
||||
"Return a string suffix for the \"Window\" entry in `cal-menu-holidays-menu'."
|
||||
(let ((my1 (calendar-increment-month-cons -1))
|
||||
(my2 (calendar-increment-month-cons 1)))
|
||||
;; Mon1-Mon2, Year or Mon1, Year1-Mon2, Year2.
|
||||
(format "%s%s-%s, %d"
|
||||
(calendar-month-name (car my1) 'abbrev)
|
||||
(if (= (cdr my1) (cdr my2))
|
||||
(format "%s-%s, %d"
|
||||
(calendar-month-name (car my1) 'abbrev)
|
||||
""
|
||||
(format ", %d" (cdr my1)))
|
||||
(calendar-month-name (car my2) 'abbrev)
|
||||
(cdr my2))
|
||||
(format "%s, %d-%s, %d"
|
||||
(calendar-month-name (car my1) 'abbrev)
|
||||
(cdr my1)
|
||||
(calendar-month-name (car my2) 'abbrev)
|
||||
(cdr my2)))))
|
||||
(cdr my2))))
|
||||
|
||||
(defvar displayed-year) ; from calendar-generate
|
||||
|
||||
@ -86,7 +84,7 @@
|
||||
:visible (calendar-cursor-to-date)]
|
||||
["For Window -" calendar-list-holidays
|
||||
:suffix (cal-menu-holiday-window-suffix)]
|
||||
["For Today -" cal-menu-today-holidays
|
||||
["For Today -" (calendar-cursor-holidays (calendar-current-date))
|
||||
:suffix (calendar-date-string (calendar-current-date) t t)]
|
||||
"--"
|
||||
,@(let ((l ()))
|
||||
@ -148,64 +146,25 @@
|
||||
["Backward 3 Months" calendar-scroll-right-three-months]
|
||||
["Backward 1 Year" (calendar-scroll-right 12) :keys "4 M-v"]))
|
||||
|
||||
(defun cal-menu-x-popup-menu (position menu)
|
||||
"Like `x-popup-menu', but print an error message if popups are unavailable.
|
||||
POSITION and MENU are passed to `x-popup-menu'."
|
||||
(if (display-popup-menus-p)
|
||||
(x-popup-menu position menu)
|
||||
(defmacro cal-menu-x-popup-menu (event title &rest body)
|
||||
"Call `x-popup-menu' at position EVENT, with TITLE and contents BODY.
|
||||
Signals an error if popups are unavailable."
|
||||
(declare (indent 2))
|
||||
`(if (display-popup-menus-p)
|
||||
(x-popup-menu ,event (list ,title (append (list ,title) ,@body)))
|
||||
(error "Popup menus are not available on this system")))
|
||||
|
||||
(defun cal-menu-list-holidays-year ()
|
||||
"Display a list of the holidays of the selected date's year."
|
||||
(interactive)
|
||||
(holiday-list (calendar-extract-year (calendar-cursor-to-date))))
|
||||
|
||||
(defun cal-menu-list-holidays-following-year ()
|
||||
"Display a list of the holidays of the following year."
|
||||
(interactive)
|
||||
(holiday-list (1+ (calendar-extract-year (calendar-cursor-to-date)))))
|
||||
|
||||
(defun cal-menu-list-holidays-previous-year ()
|
||||
"Display a list of the holidays of the previous year."
|
||||
(interactive)
|
||||
(holiday-list (1- (calendar-extract-year (calendar-cursor-to-date)))))
|
||||
|
||||
(defun cal-menu-event-to-date (&optional error)
|
||||
"Date of last event.
|
||||
If event is not on a specific date, signals an error if optional parameter
|
||||
ERROR is non-nil, otherwise just returns nil."
|
||||
(with-current-buffer
|
||||
(window-buffer (posn-window (event-start last-input-event)))
|
||||
(goto-char (posn-point (event-start last-input-event)))
|
||||
(calendar-cursor-to-date error)))
|
||||
|
||||
(defun calendar-mouse-goto-date (date)
|
||||
"Go to DATE in the buffer specified by `last-input-event'."
|
||||
(set-buffer (window-buffer (posn-window (event-start last-input-event))))
|
||||
(calendar-goto-date date))
|
||||
|
||||
(defun cal-menu-today-holidays ()
|
||||
"Show holidays for today's date."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-cursor-to-date (calendar-current-date))
|
||||
(calendar-cursor-holidays)))
|
||||
|
||||
(autoload 'calendar-check-holidays "holidays")
|
||||
|
||||
(defun calendar-mouse-holidays (&optional event)
|
||||
"Pop up menu of holidays for mouse selected date.
|
||||
EVENT is the event that invoked this command."
|
||||
(interactive "e")
|
||||
(let* ((date (cal-menu-event-to-date))
|
||||
(let* ((date (calendar-cursor-to-date nil event))
|
||||
(title (format "Holidays for %s" (calendar-date-string date)))
|
||||
(selection
|
||||
(cal-menu-x-popup-menu
|
||||
event
|
||||
(list title
|
||||
(append (list title)
|
||||
(selection (cal-menu-x-popup-menu event title
|
||||
(or (mapcar 'list (calendar-check-holidays date))
|
||||
'("None")))))))
|
||||
'("None")))))
|
||||
(and selection (call-interactively selection))))
|
||||
|
||||
(autoload 'diary-list-entries "diary-lib")
|
||||
@ -217,153 +176,48 @@ Use optional DATE and alternative file DIARY. EVENT is the event
|
||||
that invoked this command. Shows holidays if `diary-show-holidays-flag'
|
||||
is non-nil."
|
||||
(interactive "i\ni\ne")
|
||||
(let* ((date (or date (cal-menu-event-to-date)))
|
||||
(let* ((date (or date (calendar-cursor-to-date nil event)))
|
||||
(diary-file (or diary diary-file))
|
||||
(diary-list-include-blanks nil)
|
||||
(diary-entries
|
||||
(mapcar (lambda (x) (split-string (cadr x) "\n"))
|
||||
(diary-entries (mapcar (lambda (x) (split-string (cadr x) "\n"))
|
||||
(diary-list-entries date 1 'list-only)))
|
||||
(holidays (if diary-show-holidays-flag
|
||||
(calendar-check-holidays date)))
|
||||
(title (concat "Diary entries "
|
||||
(title (format "Diary entries%s for %s"
|
||||
(if diary (format " from %s" diary) "")
|
||||
"for "
|
||||
(calendar-date-string date)))
|
||||
(selection
|
||||
(cal-menu-x-popup-menu
|
||||
event
|
||||
(list title
|
||||
(append
|
||||
(list title)
|
||||
(selection (cal-menu-x-popup-menu event title
|
||||
(mapcar (lambda (x) (list (concat " " x))) holidays)
|
||||
(if holidays
|
||||
(list "--shadow-etched-in" "--shadow-etched-in"))
|
||||
(if diary-entries
|
||||
(mapcar 'list (apply 'append diary-entries))
|
||||
'("None")))))))
|
||||
'("None")))))
|
||||
(and selection (call-interactively selection))))
|
||||
|
||||
(defun calendar-mouse-view-other-diary-entries ()
|
||||
(defun calendar-mouse-view-other-diary-entries (&optional event)
|
||||
"Pop up menu of diary entries from alternative file on mouse-selected date."
|
||||
(interactive)
|
||||
(interactive "e")
|
||||
(calendar-mouse-view-diary-entries
|
||||
(cal-menu-event-to-date)
|
||||
(read-file-name "Enter diary file name: " default-directory nil t)))
|
||||
|
||||
(defun calendar-mouse-tex-day ()
|
||||
"Make a buffer with LaTeX commands for the day mouse is on."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-day nil)))
|
||||
|
||||
(defun calendar-mouse-tex-week ()
|
||||
"One page calendar for week indicated by cursor.
|
||||
Holidays are included if `cal-tex-holidays' is non-nil."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-week nil)))
|
||||
|
||||
(defun calendar-mouse-tex-week2 ()
|
||||
"Make a buffer with LaTeX commands for the week cursor is on.
|
||||
The printed output will be on two pages."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-week2 nil)))
|
||||
|
||||
(defun calendar-mouse-tex-week-iso ()
|
||||
"One page calendar for week indicated by cursor.
|
||||
Holidays are included if `cal-tex-holidays' is non-nil."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-week-iso nil)))
|
||||
|
||||
(defun calendar-mouse-tex-week-monday ()
|
||||
"One page calendar for week indicated by cursor."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-week-monday nil)))
|
||||
|
||||
(defun calendar-mouse-tex-filofax-daily ()
|
||||
"Day-per-page Filofax calendar for week indicated by cursor."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-filofax-daily nil)))
|
||||
|
||||
(defun calendar-mouse-tex-filofax-2week ()
|
||||
"One page Filofax calendar for week indicated by cursor."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-filofax-2week nil)))
|
||||
|
||||
(defun calendar-mouse-tex-filofax-week ()
|
||||
"Two page Filofax calendar for week indicated by cursor."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-filofax-week nil)))
|
||||
|
||||
(defun calendar-mouse-tex-month ()
|
||||
"Make a buffer with LaTeX commands for the month cursor is on.
|
||||
Calendar is condensed onto one page."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-month nil)))
|
||||
|
||||
(defun calendar-mouse-tex-month-landscape ()
|
||||
"Make a buffer with LaTeX commands for the month cursor is on.
|
||||
The output is in landscape format, one month to a page."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-month-landscape nil)))
|
||||
|
||||
(defun calendar-mouse-tex-year ()
|
||||
"Make a buffer with LaTeX commands for the year cursor is on."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-year nil)))
|
||||
|
||||
(defun calendar-mouse-tex-filofax-year ()
|
||||
"Make a buffer with LaTeX commands for Filofax calendar of year cursor is on."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-filofax-year nil)))
|
||||
|
||||
(defun calendar-mouse-tex-year-landscape ()
|
||||
"Make a buffer with LaTeX commands for the year cursor is on."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(calendar-mouse-goto-date (cal-menu-event-to-date))
|
||||
(cal-tex-cursor-year-landscape nil)))
|
||||
(calendar-cursor-to-date nil event)
|
||||
(read-file-name "Enter diary file name: " default-directory nil t)
|
||||
event))
|
||||
|
||||
(defun calendar-mouse-print-dates (&optional event)
|
||||
"Pop up menu of equivalent dates to mouse selected date.
|
||||
EVENT is the event that invoked this command."
|
||||
(interactive "e")
|
||||
(let* ((date (cal-menu-event-to-date))
|
||||
(let* ((date (calendar-cursor-to-date nil event))
|
||||
(title (format "%s (Gregorian)" (calendar-date-string date)))
|
||||
(selection
|
||||
(cal-menu-x-popup-menu
|
||||
event
|
||||
(list title
|
||||
(append (list title)
|
||||
(mapcar 'list (calendar-other-dates date)))))))
|
||||
(selection (cal-menu-x-popup-menu event title
|
||||
(mapcar 'list (calendar-other-dates date)))))
|
||||
(and selection (call-interactively selection))))
|
||||
|
||||
(defun cal-menu-set-date-title (menu)
|
||||
"Convert date of last event to title suitable for MENU."
|
||||
(easy-menu-filter-return
|
||||
menu (calendar-date-string (cal-menu-event-to-date t) t nil)))
|
||||
menu (calendar-date-string (calendar-cursor-to-date t last-input-event)
|
||||
t nil)))
|
||||
|
||||
(easy-menu-define cal-menu-context-mouse-menu nil
|
||||
"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."
|
||||
["Mark date" calendar-set-mark]
|
||||
["Sunrise/sunset" calendar-sunrise-sunset]
|
||||
["Other calendars" calendar-mouse-print-dates]
|
||||
;; FIXME there is a bug with last-nonmenu-event and submenus.
|
||||
;; These currently don't work if called without calendar window selected.
|
||||
("Prepare LaTeX buffer"
|
||||
["Daily (1 page)" calendar-mouse-tex-day]
|
||||
["Weekly (1 page)" calendar-mouse-tex-week]
|
||||
["Weekly (2 pages)" calendar-mouse-tex-week2]
|
||||
["Weekly (other style; 1 page)" calendar-mouse-tex-week-iso]
|
||||
["Weekly (yet another style; 1 page)" calendar-mouse-tex-week-monday]
|
||||
["Monthly" calendar-mouse-tex-month]
|
||||
["Monthly (landscape)" calendar-mouse-tex-month-landscape]
|
||||
["Yearly" calendar-mouse-tex-year]
|
||||
["Yearly (landscape)" calendar-mouse-tex-year-landscape]
|
||||
["Daily (1 page)" cal-tex-cursor-day]
|
||||
["Weekly (1 page)" cal-tex-cursor-week]
|
||||
["Weekly (2 pages)" cal-tex-cursor-week2]
|
||||
["Weekly (other style; 1 page)" cal-tex-cursor-week-iso]
|
||||
["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday]
|
||||
["Monthly" cal-tex-cursor-month]
|
||||
["Monthly (landscape)" cal-tex-cursor-month-landscape]
|
||||
["Yearly" cal-tex-cursor-year]
|
||||
["Yearly (landscape)" cal-tex-cursor-year-landscape]
|
||||
("Filofax styles"
|
||||
["Filofax Daily (one-day-per-page)" calendar-mouse-tex-filofax-daily]
|
||||
["Filofax Weekly (2-weeks-at-a-glance)" calendar-mouse-tex-filofax-2week]
|
||||
["Filofax Weekly (week-at-a-glance)" calendar-mouse-tex-filofax-week]
|
||||
["Filofax Yearly" calendar-mouse-tex-filofax-year]))
|
||||
["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily]
|
||||
["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week]
|
||||
["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week]
|
||||
["Filofax Yearly" cal-tex-cursor-filofax-year]))
|
||||
("Write HTML calendar"
|
||||
["For selected month" cal-html-cursor-month]
|
||||
["For selected year" cal-html-cursor-year])
|
||||
["Diary entries" calendar-mouse-view-diary-entries]
|
||||
["Insert diary entry" diary-insert-entry]
|
||||
["Other diary file entries" calendar-mouse-view-other-diary-entries]))
|
||||
|
Loading…
Reference in New Issue
Block a user