diff options
| author | Glenn Morris | 2007-03-20 07:45:06 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-03-20 07:45:06 +0000 |
| commit | e3f4245a04442a1d35d454e2a0e8488fde4acf0c (patch) | |
| tree | 79c94a9452e865fdee310fbcaa1a44a73805f7da | |
| parent | b537c2a9436a66e96fe27d36f62bd4e5a0294014 (diff) | |
| download | emacs-e3f4245a04442a1d35d454e2a0e8488fde4acf0c.tar.gz emacs-e3f4245a04442a1d35d454e2a0e8488fde4acf0c.zip | |
(diary-live-p): New function.
(number-of-diary-entries): Add a :set function to redisplay diary
when necessary.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index f57120e5924..b6fc4300f3e 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -290,6 +290,16 @@ Only used if `diary-header-line-flag' is non-nil." | |||
| 290 | 290 | ||
| 291 | (defvar diary-saved-point) ; internal | 291 | (defvar diary-saved-point) ; internal |
| 292 | 292 | ||
| 293 | (defun diary-live-p () | ||
| 294 | "Return non-nil if the diary is being displayed. | ||
| 295 | This is not the same as just visiting the `diary-file'." | ||
| 296 | (or (get-buffer fancy-diary-buffer) | ||
| 297 | (when diary-file | ||
| 298 | (let ((dbuff (find-buffer-visiting | ||
| 299 | (substitute-in-file-name diary-file)))) | ||
| 300 | (when dbuff | ||
| 301 | (with-current-buffer dbuff | ||
| 302 | diary-selective-display)))))) | ||
| 293 | 303 | ||
| 294 | (defcustom number-of-diary-entries 1 | 304 | (defcustom number-of-diary-entries 1 |
| 295 | "Specifies how many days of diary entries are to be displayed initially. | 305 | "Specifies how many days of diary entries are to be displayed initially. |
| @@ -317,6 +327,15 @@ number of days of diary entries displayed." | |||
| 317 | (integer :tag "Thursday") | 327 | (integer :tag "Thursday") |
| 318 | (integer :tag "Friday") | 328 | (integer :tag "Friday") |
| 319 | (integer :tag "Saturday"))) | 329 | (integer :tag "Saturday"))) |
| 330 | :initialize 'custom-initialize-default | ||
| 331 | ;; Redraw a live diary buffer if necessary. Note this assumes diary | ||
| 332 | ;; was not called with a prefix arg. | ||
| 333 | :set (lambda (symbol value) | ||
| 334 | (let ((oldvalue number-of-diary-entries)) | ||
| 335 | (custom-set-default symbol value) | ||
| 336 | (and (not (equal value oldvalue)) | ||
| 337 | (diary-live-p) | ||
| 338 | (diary)))) | ||
| 320 | :group 'diary) | 339 | :group 'diary) |
| 321 | 340 | ||
| 322 | 341 | ||