diff options
| author | Stefan Monnier | 2008-06-17 15:42:19 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-06-17 15:42:19 +0000 |
| commit | 10979c74669477d58347a20ebec04a7a2fd902b1 (patch) | |
| tree | 55cad205dec27f51098cca7c573268a0c71d18b4 | |
| parent | de7a9afaf3ed4b9e62986fe6687c6bf1a7e86638 (diff) | |
| download | emacs-10979c74669477d58347a20ebec04a7a2fd902b1.tar.gz emacs-10979c74669477d58347a20ebec04a7a2fd902b1.zip | |
* calendar/calendar.el (calendar-cursor-to-date): Add argument `event'.
(calendar-set-mark):
* calendar/diary-lib.el (diary-insert-entry):
* calendar/solar.el (calendar-sunrise-sunset): Use it.
* calendar/cal-menu.el (calendar-mouse-sunrise/sunset)
(calendar-mouse-insert-diary-entry, calendar-mouse-set-mark): Delete.
(cal-menu-context-mouse-menu): Use calendar-set-mark, diary-insert-entry,
and calendar-sunrise-sunset instead, to get proper key-shortcuts.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/calendar/cal-menu.el | 27 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 27 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 7 | ||||
| -rw-r--r-- | lisp/calendar/solar.el | 6 |
5 files changed, 36 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9bbe43f47d7..7e270cea3d7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | 2008-06-17 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-06-17 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * calendar/calendar.el (calendar-cursor-to-date): Add argument `event'. | ||
| 4 | (calendar-set-mark): | ||
| 5 | * calendar/diary-lib.el (diary-insert-entry): | ||
| 6 | * calendar/solar.el (calendar-sunrise-sunset): Use it. | ||
| 7 | * calendar/cal-menu.el (calendar-mouse-sunrise/sunset) | ||
| 8 | (calendar-mouse-insert-diary-entry, calendar-mouse-set-mark): Delete. | ||
| 9 | (cal-menu-context-mouse-menu): Use calendar-set-mark, | ||
| 10 | diary-insert-entry, and calendar-sunrise-sunset instead. | ||
| 11 | |||
| 3 | * vc.el (vc-deduce-fileset): Add arg `only-files'. | 12 | * vc.el (vc-deduce-fileset): Add arg `only-files'. |
| 4 | (vc-next-action): Pass the new arg. | 13 | (vc-next-action): Pass the new arg. |
| 5 | (vc-register): Don't use `only-files'. | 14 | (vc-register): Don't use `only-files'. |
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el index 18fa06fc584..e3aa337ee92 100644 --- a/lisp/calendar/cal-menu.el +++ b/lisp/calendar/cal-menu.el | |||
| @@ -184,13 +184,6 @@ ERROR is non-nil, otherwise just returns nil." | |||
| 184 | (set-buffer (window-buffer (posn-window (event-start last-input-event)))) | 184 | (set-buffer (window-buffer (posn-window (event-start last-input-event)))) |
| 185 | (calendar-goto-date date)) | 185 | (calendar-goto-date date)) |
| 186 | 186 | ||
| 187 | (defun calendar-mouse-sunrise/sunset () | ||
| 188 | "Show sunrise/sunset times for mouse-selected date." | ||
| 189 | (interactive) | ||
| 190 | (save-excursion | ||
| 191 | (calendar-mouse-goto-date (cal-menu-event-to-date)) | ||
| 192 | (calendar-sunrise-sunset))) | ||
| 193 | |||
| 194 | (defun cal-menu-today-holidays () | 187 | (defun cal-menu-today-holidays () |
| 195 | "Show holidays for today's date." | 188 | "Show holidays for today's date." |
| 196 | (interactive) | 189 | (interactive) |
| @@ -257,20 +250,6 @@ is non-nil." | |||
| 257 | (cal-menu-event-to-date) | 250 | (cal-menu-event-to-date) |
| 258 | (read-file-name "Enter diary file name: " default-directory nil t))) | 251 | (read-file-name "Enter diary file name: " default-directory nil t))) |
| 259 | 252 | ||
| 260 | (defun calendar-mouse-insert-diary-entry () | ||
| 261 | "Insert diary entry for mouse-selected date." | ||
| 262 | (interactive) | ||
| 263 | (save-excursion | ||
| 264 | (calendar-mouse-goto-date (cal-menu-event-to-date)) | ||
| 265 | (diary-insert-entry nil))) | ||
| 266 | |||
| 267 | (defun calendar-mouse-set-mark () | ||
| 268 | "Mark the date under the cursor." | ||
| 269 | (interactive) | ||
| 270 | (save-excursion | ||
| 271 | (calendar-mouse-goto-date (cal-menu-event-to-date)) | ||
| 272 | (calendar-set-mark nil))) | ||
| 273 | |||
| 274 | (defun calendar-mouse-tex-day () | 253 | (defun calendar-mouse-tex-day () |
| 275 | "Make a buffer with LaTeX commands for the day mouse is on." | 254 | "Make a buffer with LaTeX commands for the day mouse is on." |
| 276 | (interactive) | 255 | (interactive) |
| @@ -391,8 +370,8 @@ EVENT is the event that invoked this command." | |||
| 391 | '("cal-menu-mouse2" :filter cal-menu-set-date-title | 370 | '("cal-menu-mouse2" :filter cal-menu-set-date-title |
| 392 | "--" | 371 | "--" |
| 393 | ["Holidays" calendar-mouse-holidays] | 372 | ["Holidays" calendar-mouse-holidays] |
| 394 | ["Mark date" calendar-mouse-set-mark] | 373 | ["Mark date" calendar-set-mark] |
| 395 | ["Sunrise/sunset" calendar-mouse-sunrise/sunset] | 374 | ["Sunrise/sunset" calendar-sunrise-sunset] |
| 396 | ["Other calendars" calendar-mouse-print-dates] | 375 | ["Other calendars" calendar-mouse-print-dates] |
| 397 | ("Prepare LaTeX buffer" | 376 | ("Prepare LaTeX buffer" |
| 398 | ["Daily (1 page)" calendar-mouse-tex-day] | 377 | ["Daily (1 page)" calendar-mouse-tex-day] |
| @@ -410,7 +389,7 @@ EVENT is the event that invoked this command." | |||
| 410 | ["Filofax Weekly (week-at-a-glance)" calendar-mouse-tex-filofax-week] | 389 | ["Filofax Weekly (week-at-a-glance)" calendar-mouse-tex-filofax-week] |
| 411 | ["Filofax Yearly" calendar-mouse-tex-filofax-year])) | 390 | ["Filofax Yearly" calendar-mouse-tex-filofax-year])) |
| 412 | ["Diary entries" calendar-mouse-view-diary-entries] | 391 | ["Diary entries" calendar-mouse-view-diary-entries] |
| 413 | ["Insert diary entry" calendar-mouse-insert-diary-entry] | 392 | ["Insert diary entry" diary-insert-entry] |
| 414 | ["Other diary file entries" calendar-mouse-view-other-diary-entries])) | 393 | ["Other diary file entries" calendar-mouse-view-other-diary-entries])) |
| 415 | 394 | ||
| 416 | (easy-menu-define cal-menu-global-mouse-menu nil | 395 | (easy-menu-define cal-menu-global-mouse-menu nil |
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 4336dc117f5..e43132fd4e1 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -1571,10 +1571,17 @@ the STRINGS are just concatenated and the result truncated." | |||
| 1571 | (let ((now (decode-time))) | 1571 | (let ((now (decode-time))) |
| 1572 | (list (nth 4 now) (nth 3 now) (nth 5 now)))) | 1572 | (list (nth 4 now) (nth 3 now) (nth 5 now)))) |
| 1573 | 1573 | ||
| 1574 | (defun calendar-cursor-to-date (&optional error) | 1574 | (defun calendar-cursor-to-date (&optional error event) |
| 1575 | "Return a list (month day year) of current cursor position. | 1575 | "Return a list (month day year) of current cursor position. |
| 1576 | If cursor is not on a specific date, signals an error if optional parameter | 1576 | If cursor is not on a specific date, signals an error if optional parameter |
| 1577 | ERROR is non-nil, otherwise just returns nil." | 1577 | ERROR is non-nil, otherwise just returns nil. |
| 1578 | If EVENT is non-nil, it's an event indicating the buffer position to | ||
| 1579 | use instead of point." | ||
| 1580 | (with-current-buffer | ||
| 1581 | (if event (window-buffer (posn-window (event-start event))) | ||
| 1582 | (current-buffer)) | ||
| 1583 | (save-excursion | ||
| 1584 | (if event (goto-char (posn-point (event-start event)))) | ||
| 1578 | (let* ((segment (/ (current-column) 25)) | 1585 | (let* ((segment (/ (current-column) 25)) |
| 1579 | (month (% (+ displayed-month segment -1) 12)) | 1586 | (month (% (+ displayed-month segment -1) 12)) |
| 1580 | (month (if (zerop month) 12 month)) | 1587 | (month (if (zerop month) 12 month)) |
| @@ -1583,15 +1590,14 @@ ERROR is non-nil, otherwise just returns nil." | |||
| 1583 | ((and (= 12 month) (zerop segment)) (1- displayed-year)) | 1590 | ((and (= 12 month) (zerop segment)) (1- displayed-year)) |
| 1584 | ((and (= 1 month) (= segment 2)) (1+ displayed-year)) | 1591 | ((and (= 1 month) (= segment 2)) (1+ displayed-year)) |
| 1585 | (t displayed-year)))) | 1592 | (t displayed-year)))) |
| 1586 | (if (and (looking-at "[ 0-9]?[0-9][^0-9]") | 1593 | (if (not (and (looking-at "[ 0-9]?[0-9][^0-9]") |
| 1587 | (< 2 (count-lines (point-min) (point)))) | 1594 | (< 2 (count-lines (point-min) (point))))) |
| 1588 | (save-excursion | 1595 | (if error (error "Not on a date!")) |
| 1589 | (if (not (looking-at " ")) | 1596 | (if (not (looking-at " ")) |
| 1590 | (re-search-backward "[^0-9]")) | 1597 | (re-search-backward "[^0-9]")) |
| 1591 | (list month | 1598 | (list month |
| 1592 | (string-to-number (buffer-substring (1+ (point)) (+ 4 (point)))) | 1599 | (string-to-number (buffer-substring (1+ (point)) (+ 4 (point)))) |
| 1593 | year)) | 1600 | year)))))) |
| 1594 | (if error (error "Not on a date!"))))) | ||
| 1595 | 1601 | ||
| 1596 | (add-to-list 'debug-ignored-errors "Not on a date!") | 1602 | (add-to-list 'debug-ignored-errors "Not on a date!") |
| 1597 | 1603 | ||
| @@ -1668,12 +1674,13 @@ EVENT is an event like `last-nonmenu-event'." | |||
| 1668 | ((calendar-date-is-visible-p today) today) | 1674 | ((calendar-date-is-visible-p today) today) |
| 1669 | (t (list month 1 year)))))))) | 1675 | (t (list month 1 year)))))))) |
| 1670 | 1676 | ||
| 1671 | (defun calendar-set-mark (arg) | 1677 | (defun calendar-set-mark (arg &optional event) |
| 1672 | "Mark the date under the cursor, or jump to marked date. | 1678 | "Mark the date under the cursor, or jump to marked date. |
| 1673 | With no prefix argument, push current date onto marked date ring. | 1679 | With no prefix argument, push current date onto marked date ring. |
| 1674 | With argument ARG, jump to mark, pop it, and put point at end of ring." | 1680 | With argument ARG, jump to mark, pop it, and put point at end of ring." |
| 1675 | (interactive "P") | 1681 | (interactive |
| 1676 | (let ((date (calendar-cursor-to-date t))) | 1682 | (list current-prefix-arg last-nonmenu-event)) |
| 1683 | (let ((date (calendar-cursor-to-date t event))) | ||
| 1677 | (if arg | 1684 | (if arg |
| 1678 | (if (null calendar-mark-ring) | 1685 | (if (null calendar-mark-ring) |
| 1679 | (error "No mark set in this buffer") | 1686 | (error "No mark set in this buffer") |
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 18473d5df57..ec18cb9fcb9 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -1998,11 +1998,12 @@ If omitted, NONMARKING defaults to nil and FILE defaults to | |||
| 1998 | (define-obsolete-function-alias 'make-diary-entry 'diary-make-entry "23.1") | 1998 | (define-obsolete-function-alias 'make-diary-entry 'diary-make-entry "23.1") |
| 1999 | 1999 | ||
| 2000 | ;;;###cal-autoload | 2000 | ;;;###cal-autoload |
| 2001 | (defun diary-insert-entry (arg) | 2001 | (defun diary-insert-entry (arg &optional event) |
| 2002 | "Insert a diary entry for the date indicated by point. | 2002 | "Insert a diary entry for the date indicated by point. |
| 2003 | Prefix argument ARG makes the entry nonmarking." | 2003 | Prefix argument ARG makes the entry nonmarking." |
| 2004 | (interactive "P") | 2004 | (interactive |
| 2005 | (diary-make-entry (calendar-date-string (calendar-cursor-to-date t) t t) | 2005 | (list current-prefix-arg last-nonmenu-event)) |
| 2006 | (diary-make-entry (calendar-date-string (calendar-cursor-to-date t event) t t) | ||
| 2006 | arg)) | 2007 | arg)) |
| 2007 | 2008 | ||
| 2008 | ;;;###cal-autoload | 2009 | ;;;###cal-autoload |
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index 3d1121f1d0b..6dbd9b3a33d 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el | |||
| @@ -853,13 +853,13 @@ This function is suitable for execution in a .emacs file." | |||
| 853 | contents of temp window.")))))) | 853 | contents of temp window.")))))) |
| 854 | 854 | ||
| 855 | ;;;###cal-autoload | 855 | ;;;###cal-autoload |
| 856 | (defun calendar-sunrise-sunset () | 856 | (defun calendar-sunrise-sunset (&optional event) |
| 857 | "Local time of sunrise and sunset for date under cursor. | 857 | "Local time of sunrise and sunset for date under cursor. |
| 858 | Accurate to a few seconds." | 858 | Accurate to a few seconds." |
| 859 | (interactive) | 859 | (interactive (list last-nonmenu-event)) |
| 860 | (or (and calendar-latitude calendar-longitude calendar-time-zone) | 860 | (or (and calendar-latitude calendar-longitude calendar-time-zone) |
| 861 | (solar-setup)) | 861 | (solar-setup)) |
| 862 | (let ((date (calendar-cursor-to-date t))) | 862 | (let ((date (calendar-cursor-to-date t event))) |
| 863 | (message "%s: %s" | 863 | (message "%s: %s" |
| 864 | (calendar-date-string date t t) | 864 | (calendar-date-string date t t) |
| 865 | (solar-sunrise-sunset-string date)))) | 865 | (solar-sunrise-sunset-string date)))) |