aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2007-03-21 06:25:47 +0000
committerGlenn Morris2007-03-21 06:25:47 +0000
commiteec39ec7cdbfdf642adf1b64f8e9c6f057dd8502 (patch)
treef217735081adbdd47f89eeb8a2f9108b8ca2a535 /lisp
parent9b77729f64ea509459f450fc91d3266621f381ea (diff)
downloademacs-eec39ec7cdbfdf642adf1b64f8e9c6f057dd8502.tar.gz
emacs-eec39ec7cdbfdf642adf1b64f8e9c6f057dd8502.zip
(diary-header-line-flag): Doc fix. Add custom :set function.
(diary-header-line-format): Doc fix. (diary-set-maybe-redraw): New function. (number-of-diary-entries): Change :set to use diary-set-maybe-redraw. (diary-list-entries): Always run diary-mode.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/calendar/diary-lib.el31
2 files changed, 32 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1aab93b40f7..f4633f517ef 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12007-03-21 Glenn Morris <rgm@gnu.org>
2
3 * calendar/calendar.el (diary-set-maybe-redraw): Autoload it.
4 (diary-display-hook): Add custom :set function.
5
6 * calendar/diary-lib.el (diary-header-line-flag): Doc fix. Add
7 custom :set function.
8 (diary-header-line-format): Doc fix.
9 (diary-set-maybe-redraw): New function.
10 (number-of-diary-entries): Change :set to use diary-set-maybe-redraw.
11 (diary-list-entries): Always run diary-mode.
12
12007-03-20 David Kastrup <dak@gnu.org> 132007-03-20 David Kastrup <dak@gnu.org>
2 14
3 * files.el (magic-mode-alist): Require literal "%!PS" string for 15 * files.el (magic-mode-alist): Require literal "%!PS" string for
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index b6fc4300f3e..72620a7f9bb 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -267,10 +267,12 @@ search."
267;; This can be removed once the kill/yank treatment of invisible text 267;; This can be removed once the kill/yank treatment of invisible text
268;; (see etc/TODO) is fixed. -- gm 268;; (see etc/TODO) is fixed. -- gm
269(defcustom diary-header-line-flag t 269(defcustom diary-header-line-flag t
270 "If non-nil, `diary-simple-display' will show a header line. 270 "If non-nil, `simple-diary-display' will show a header line.
271The format of the header is specified by `diary-header-line-format'." 271The format of the header is specified by `diary-header-line-format'."
272 :group 'diary 272 :group 'diary
273 :type 'boolean 273 :type 'boolean
274 :initialize 'custom-initialize-default
275 :set 'diary-set-maybe-redraw
274 :version "22.1") 276 :version "22.1")
275 277
276(defvar diary-selective-display nil) 278(defvar diary-selective-display nil)
@@ -282,7 +284,7 @@ The format of the header is specified by `diary-header-line-format'."
282before edit/copy" 284before edit/copy"
283 "Diary")) 285 "Diary"))
284 ?\s (frame-width))) 286 ?\s (frame-width)))
285 "Format of the header line displayed by `diary-simple-display'. 287 "Format of the header line displayed by `simple-diary-display'.
286Only used if `diary-header-line-flag' is non-nil." 288Only used if `diary-header-line-flag' is non-nil."
287 :group 'diary 289 :group 'diary
288 :type 'sexp 290 :type 'sexp
@@ -301,6 +303,17 @@ This is not the same as just visiting the `diary-file'."
301 (with-current-buffer dbuff 303 (with-current-buffer dbuff
302 diary-selective-display)))))) 304 diary-selective-display))))))
303 305
306(defun diary-set-maybe-redraw (symbol value)
307 "Set SYMBOL's value to VALUE, and redraw the diary if necessary.
308Redraws the diary if it is being displayed (note this is not the same as
309just visiting the `diary-file'), and SYMBOL's value is to be changed."
310 (let ((oldvalue (eval symbol)))
311 (custom-set-default symbol value)
312 (and (not (equal value oldvalue))
313 (diary-live-p)
314 ;; Note this assumes diary was called without prefix arg.
315 (diary))))
316
304(defcustom number-of-diary-entries 1 317(defcustom number-of-diary-entries 1
305 "Specifies how many days of diary entries are to be displayed initially. 318 "Specifies how many days of diary entries are to be displayed initially.
306This variable affects the diary display when the command \\[diary] is used, 319This variable affects the diary display when the command \\[diary] is used,
@@ -328,14 +341,7 @@ number of days of diary entries displayed."
328 (integer :tag "Friday") 341 (integer :tag "Friday")
329 (integer :tag "Saturday"))) 342 (integer :tag "Saturday")))
330 :initialize 'custom-initialize-default 343 :initialize 'custom-initialize-default
331 ;; Redraw a live diary buffer if necessary. Note this assumes diary 344 :set 'diary-set-maybe-redraw
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))))
339 :group 'diary) 345 :group 'diary)
340 346
341 347
@@ -429,7 +435,10 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list."
429 (or (verify-visited-file-modtime diary-buffer) 435 (or (verify-visited-file-modtime diary-buffer)
430 (revert-buffer t t)))) 436 (revert-buffer t t))))
431 ;; Setup things like the header-line-format and invisibility-spec. 437 ;; Setup things like the header-line-format and invisibility-spec.
432 (when (eq major-mode default-major-mode) (diary-mode)) 438 ;; This used to only run if the major-mode was default-major-mode,
439 ;; but that meant eg changes to header-line-format did not
440 ;; take effect from one diary invocation to the next.
441 (diary-mode)
433 ;; d-s-p is passed to the diary display function. 442 ;; d-s-p is passed to the diary display function.
434 (let ((diary-saved-point (point))) 443 (let ((diary-saved-point (point)))
435 (save-excursion 444 (save-excursion