emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calendar customization too late


From: Stephen Berman
Subject: Re: Calendar customization too late
Date: Tue, 20 Mar 2007 17:06:41 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux)

On Mon, 19 Mar 2007 20:25:32 -0400 Glenn Morris <address@hidden> wrote:

> Stephen Berman wrote:
>
>> I think the problem is caused by appt-activate making the diary
>> display before the customization takes effect.
>
> It happens with just (diary) too, regardless of appt.el. How about
> this patch:

I updated from CVS and confirm that that patch fixes the bug; thanks.
Upon further testing, I've found a couple of other cases that seem to
be similar:

(i) Do the first three steps of the recipe from my OP (or, as you
pointed out, replace step 2 with (diary)), and then do `M-x
customize-variable RET diary-display-hook' and in the Customize buffer
click the check-box by fancy-diary-display and then click `Save for
Future Sessions'.  When you restart Emacs the diary is still initially
shown with simple rather than fancy display.  Here is an analogous fix
to yours, but since diary-display-hook can also have other functions,
the following patch abstracts from fancy-diary-display:

*** calendar.el~1.195~  2007-03-20 09:04:26.000000000 +0100
--- calendar.el         2007-03-20 15:39:27.000000000 +0100
***************
*** 794,799 ****
--- 794,806 ----
  diary buffer, set the variable `diary-list-include-blanks' to t."
    :type 'hook
    :options '(fancy-diary-display)
+   :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)
+        (custom-set-default symbol value)
+        (and (diary-live-p)
+             (diary)))
    :group 'diary)
  
  ;;;###autoload

(ii) Do the first three steps of the recipe and then do `M-x
customize-variable RET diary-header-line-flag', toggle it to `off' and
click `Save for Future Sessions'.  When you restart Emacs the diary is
still shown with the header line given by diary-header-line-format.
Unfortunately, I haven't been able to find an analogous fix for this
case.  I tried several variations of your fix, applied to
diary-header-line-flag, such as this one:

*** diary-lib.el~1.120~ 2007-03-20 09:04:26.000000000 +0100
--- diary-lib.el        2007-03-20 16:43:24.000000000 +0100
***************
*** 271,276 ****
--- 271,284 ----
  The format of the header is specified by `diary-header-line-format'."
    :group   'diary
    :type    'boolean
+   :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)
+        (custom-set-default symbol value)
+        (and (eq header-line-format diary-header-line-format)
+             (diary-live-p)
+             (diary-mode)))
    :version "22.1")
  
  (defvar diary-selective-display nil)

But I still get the header-line, and not only initially but also upon
subsequent invocation of diary or calendar.  However, if I manually
eval (diary-mode), then the header-line vanishes.  I guess I don't
understand how :set works in defcustom, because AFAICS all the
conditions are satisfied, so (diary-mode) should be evalled, yet it
isn't.  Anyway, this was just to show you what I tried, I expect you
can come up with the right fix.

I haven't had time to check whether similar problems arise with
further defcustoms in diary-lib.el.  But I did notice a couple of
typos in diary-lib.el: the docstrings of the defcustoms of
diary-header-line-flag and diary-header-line-format refer to
`diary-simple-display'; it should be `simple-diary-display' (which
doesn't follow the Emacs naming conventions, but that's still true of
a bunch of names in the calendar packages).

Steve Berman





reply via email to

[Prev in Thread] Current Thread [Next in Thread]