changeset 77292:c15c7123019d

(diary-header-line-format): Add a custom :set function. (diary-list-entries): Only switch to diary-mode from default-major-mode (reverts 2007-03-21 change). Otherwise, set header-line-format, in case of any customization.
author Glenn Morris <rgm@gnu.org>
date Wed, 18 Apr 2007 04:06:37 +0000
parents 02b2ddeac1ef
children e262afb73c6e
files lisp/calendar/diary-lib.el
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/diary-lib.el	Wed Apr 18 04:05:40 2007 +0000
+++ b/lisp/calendar/diary-lib.el	Wed Apr 18 04:06:37 2007 +0000
@@ -276,6 +276,7 @@
   :group   'diary
   :type    'boolean
   :initialize 'custom-initialize-default
+  ;; FIXME overkill.
   :set 'diary-set-maybe-redraw
   :version "22.1")
 
@@ -292,6 +293,9 @@
 Only used if `diary-header-line-flag' is non-nil."
   :group   'diary
   :type    'sexp
+  :initialize 'custom-initialize-default
+  ;; FIXME overkill.
+  :set 'diary-set-maybe-redraw
   :version "22.1")
 
 (defvar diary-saved-point)		; internal
@@ -434,10 +438,16 @@
             (or (verify-visited-file-modtime diary-buffer)
                 (revert-buffer t t))))
         ;; Setup things like the header-line-format and invisibility-spec.
-        ;; This used to only run if the major-mode was default-major-mode,
-        ;; but that meant eg changes to header-line-format did not
-        ;; take effect from one diary invocation to the next.
-        (diary-mode)
+        (if (eq major-mode default-major-mode)
+            (diary-mode)
+          ;; This kludge is to make customizations to
+          ;; diary-header-line-flag after diary has been displayed
+          ;; take effect. Unconditionally calling (diary-mode)
+          ;; clobbers file local variables.
+          ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-03/msg00363.html
+          ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-04/msg00404.html
+          (setq header-line-format (and diary-header-line-flag
+                                        diary-header-line-format)))
         ;; d-s-p is passed to the diary display function.
         (let ((diary-saved-point (point)))
           (save-excursion