Commit e3f4245a authored by Glenn Morris's avatar Glenn Morris

(diary-live-p): New function.

(number-of-diary-entries): Add a :set function to redisplay diary
when necessary.
parent b537c2a9
...@@ -290,6 +290,16 @@ Only used if `diary-header-line-flag' is non-nil." ...@@ -290,6 +290,16 @@ Only used if `diary-header-line-flag' is non-nil."
(defvar diary-saved-point) ; internal (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 (defcustom number-of-diary-entries 1
"Specifies how many days of diary entries are to be displayed initially. "Specifies how many days of diary entries are to be displayed initially.
...@@ -317,6 +327,15 @@ number of days of diary entries displayed." ...@@ -317,6 +327,15 @@ number of days of diary entries displayed."
(integer :tag "Thursday") (integer :tag "Thursday")
(integer :tag "Friday") (integer :tag "Friday")
(integer :tag "Saturday"))) (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) :group 'diary)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment