diff options
| author | Glenn Morris | 2005-03-01 10:23:58 +0000 |
|---|---|---|
| committer | Glenn Morris | 2005-03-01 10:23:58 +0000 |
| commit | a46c339d7af01d00c5472fabee7bf22f19419bf8 (patch) | |
| tree | f9c650b93f5dbd350609198da91b02e276600852 | |
| parent | 40534fe432b97cc1640d27dbe949cb9329e8ba30 (diff) | |
| download | emacs-a46c339d7af01d00c5472fabee7bf22f19419bf8.tar.gz emacs-a46c339d7af01d00c5472fabee7bf22f19419bf8.zip | |
(mark-diary-entries): Remove any old marks first.
(diary-redraw-calendar): New function.
(make-diary-entry): Add diary-redraw-calendar to local
write-contents-functions. Turn off selective display before inserting
in diary.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 5fbae2500d7..97dc1dd0a71 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; diary-lib.el --- diary functions | 1 | ;;; diary-lib.el --- diary functions |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2003, 2004 | 3 | ;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2003, 2004, 2005 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | 6 | ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> |
| @@ -841,6 +841,10 @@ Each entry in the diary file visible in the calendar window is marked. | |||
| 841 | After the entries are marked, the hooks `nongregorian-diary-marking-hook' and | 841 | After the entries are marked, the hooks `nongregorian-diary-marking-hook' and |
| 842 | `mark-diary-entries-hook' are run." | 842 | `mark-diary-entries-hook' are run." |
| 843 | (interactive) | 843 | (interactive) |
| 844 | ;; To remove any deleted diary entries. | ||
| 845 | (when mark-diary-entries-in-calendar | ||
| 846 | (setq mark-diary-entries-in-calendar nil) | ||
| 847 | (redraw-calendar)) | ||
| 844 | (let ((marking-diary-entries t) | 848 | (let ((marking-diary-entries t) |
| 845 | file-glob-attrs marks) | 849 | file-glob-attrs marks) |
| 846 | (save-excursion | 850 | (save-excursion |
| @@ -1647,11 +1651,26 @@ Do nothing if DATE or STRING is nil." | |||
| 1647 | (append diary-entries-list | 1651 | (append diary-entries-list |
| 1648 | (list (list date string specifier marker globcolor)))))) | 1652 | (list (list date string specifier marker globcolor)))))) |
| 1649 | 1653 | ||
| 1654 | (defun diary-redraw-calendar () | ||
| 1655 | "If `calendar-buffer' is live and diary entries are marked, redraw it." | ||
| 1656 | (and mark-diary-entries-in-calendar | ||
| 1657 | (redraw-calendar)) | ||
| 1658 | ;; Return value suitable for `write-contents-functions'. | ||
| 1659 | nil) | ||
| 1660 | |||
| 1650 | (defun make-diary-entry (string &optional nonmarking file) | 1661 | (defun make-diary-entry (string &optional nonmarking file) |
| 1651 | "Insert a diary entry STRING which may be NONMARKING in FILE. | 1662 | "Insert a diary entry STRING which may be NONMARKING in FILE. |
| 1652 | If omitted, NONMARKING defaults to nil and FILE defaults to `diary-file'." | 1663 | If omitted, NONMARKING defaults to nil and FILE defaults to |
| 1664 | `diary-file'. Adds `diary-redraw-calendar' to | ||
| 1665 | `write-contents-functions' for FILE, so that the calendar will be | ||
| 1666 | redrawn with the new entry marked, if necessary." | ||
| 1653 | (let ((pop-up-frames (window-dedicated-p (selected-window)))) | 1667 | (let ((pop-up-frames (window-dedicated-p (selected-window)))) |
| 1654 | (find-file-other-window (substitute-in-file-name (or file diary-file)))) | 1668 | (find-file-other-window (substitute-in-file-name (or file diary-file)))) |
| 1669 | (add-hook 'write-contents-functions 'diary-redraw-calendar nil t) | ||
| 1670 | (when selective-display | ||
| 1671 | (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) | ||
| 1672 | (setq selective-display nil) | ||
| 1673 | (kill-local-variable 'mode-line-format)) | ||
| 1655 | (widen) | 1674 | (widen) |
| 1656 | (goto-char (point-max)) | 1675 | (goto-char (point-max)) |
| 1657 | (when (let ((case-fold-search t)) | 1676 | (when (let ((case-fold-search t)) |