Mercurial > emacs
changeset 76618:447e2a38ab14
(diary-live-p): New function.
(number-of-diary-entries): Add a :set function to redisplay diary
when necessary.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 20 Mar 2007 07:45:06 +0000 |
parents | 60bdcd690457 |
children | b4dec96e199f |
files | lisp/calendar/diary-lib.el |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/calendar/diary-lib.el Tue Mar 20 07:44:29 2007 +0000 +++ b/lisp/calendar/diary-lib.el Tue Mar 20 07:45:06 2007 +0000 @@ -290,6 +290,16 @@ (defvar diary-saved-point) ; internal +(defun diary-live-p () + "Return non-nil if the diary is being displayed. +This is not the same as just visiting the `diary-file'." + (or (get-buffer fancy-diary-buffer) + (when diary-file + (let ((dbuff (find-buffer-visiting + (substitute-in-file-name diary-file)))) + (when dbuff + (with-current-buffer dbuff + diary-selective-display)))))) (defcustom number-of-diary-entries 1 "Specifies how many days of diary entries are to be displayed initially. @@ -317,6 +327,15 @@ (integer :tag "Thursday") (integer :tag "Friday") (integer :tag "Saturday"))) + :initialize 'custom-initialize-default + ;; Redraw a live diary buffer if necessary. Note this assumes diary + ;; was not called with a prefix arg. + :set (lambda (symbol value) + (let ((oldvalue number-of-diary-entries)) + (custom-set-default symbol value) + (and (not (equal value oldvalue)) + (diary-live-p) + (diary)))) :group 'diary)