diff options
| author | Glenn Morris | 2005-03-16 13:23:55 +0000 |
|---|---|---|
| committer | Glenn Morris | 2005-03-16 13:23:55 +0000 |
| commit | 81eb8a4a73ee3b356e299475473576edd4b2c8f2 (patch) | |
| tree | e88d87ea89b90df26963457887e533f9c667ae45 | |
| parent | 7a099c439dffc25f5f9a71afc13d559a2ae80c5f (diff) | |
| download | emacs-81eb8a4a73ee3b356e299475473576edd4b2c8f2.tar.gz emacs-81eb8a4a73ee3b356e299475473576edd4b2c8f2.zip | |
(mark-diary-entries): Use new optional argument REDRAW rather than
calendar-redrawing variable.
From Matt Hodges <MPHodges@member.fsf.org>:
(diary-redraw-calendar): Preserve point in diary-file buffer.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 124b29c3fe7..6b8f6986381 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -835,21 +835,23 @@ argument PAREN is non-nil, the regexp is surrounded by parentheses." | |||
| 835 | (defvar marking-diary-entry nil | 835 | (defvar marking-diary-entry nil |
| 836 | "True during the marking of diary entries, if current entry is marking.") | 836 | "True during the marking of diary entries, if current entry is marking.") |
| 837 | 837 | ||
| 838 | (defun mark-diary-entries () | 838 | (defun mark-diary-entries (&optional redraw) |
| 839 | "Mark days in the calendar window that have diary entries. | 839 | "Mark days in the calendar window that have diary entries. |
| 840 | Each entry in the diary file visible in the calendar window is marked. | 840 | Each entry in the diary file visible in the calendar window is |
| 841 | After the entries are marked, the hooks `nongregorian-diary-marking-hook' and | 841 | marked. After the entries are marked, the hooks |
| 842 | `mark-diary-entries-hook' are run." | 842 | `nongregorian-diary-marking-hook' and `mark-diary-entries-hook' |
| 843 | (interactive) | 843 | are run. If the optional argument REDRAW is non-nil (which is |
| 844 | ;; To remove any deleted diary entries. | 844 | the case interactively, for example) then any existing diary |
| 845 | (when (and mark-diary-entries-in-calendar | 845 | marks are first removed. This is intended to deal with deleted |
| 846 | ;; Avoid redrawing when called recursively, eg through | 846 | diary entries." |
| 847 | ;; mark-diary-entries-hook for #include's, else only get | 847 | (interactive "p") |
| 848 | ;; the last set of diary marks. | 848 | ;; To remove any deleted diary entries. Do not redraw when: |
| 849 | (not marking-diary-entries) | 849 | ;; i) processing #include diary files (else only get the marks from |
| 850 | ;; If called from redraw-calendar, the calendar has been | 850 | ;; the last #include file processed). |
| 851 | ;; erased, so no need to unmark the diary entries. | 851 | ;; ii) called via calendar-redraw (since calendar has already been |
| 852 | (not calendar-redrawing)) | 852 | ;; erased). |
| 853 | ;; Use of REDRAW handles both of these cases. | ||
| 854 | (when (and redraw mark-diary-entries-in-calendar) | ||
| 853 | (setq mark-diary-entries-in-calendar nil) | 855 | (setq mark-diary-entries-in-calendar nil) |
| 854 | (redraw-calendar)) | 856 | (redraw-calendar)) |
| 855 | (let ((marking-diary-entries t) | 857 | (let ((marking-diary-entries t) |
| @@ -1661,7 +1663,8 @@ Do nothing if DATE or STRING is nil." | |||
| 1661 | (defun diary-redraw-calendar () | 1663 | (defun diary-redraw-calendar () |
| 1662 | "If `calendar-buffer' is live and diary entries are marked, redraw it." | 1664 | "If `calendar-buffer' is live and diary entries are marked, redraw it." |
| 1663 | (and mark-diary-entries-in-calendar | 1665 | (and mark-diary-entries-in-calendar |
| 1664 | (redraw-calendar)) | 1666 | (save-excursion |
| 1667 | (redraw-calendar))) | ||
| 1665 | ;; Return value suitable for `write-contents-functions'. | 1668 | ;; Return value suitable for `write-contents-functions'. |
| 1666 | nil) | 1669 | nil) |
| 1667 | 1670 | ||