emacs-devel
[Top][All Lists]
Advanced

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

Re: cal-x.el/diary-lib.el diary-mode-hook


From: Stefan Monnier
Subject: Re: cal-x.el/diary-lib.el diary-mode-hook
Date: Thu, 15 May 2008 10:52:15 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Hi, this is regarding calendar.  I experience the symptoms in
> Emacs 22.2, and by inspecting CVS HEAD I suspect it is still
> affected despite the code having been significantly updated.

> emacs -q
> (setq diary-display-hook 'fancy-diary-display)
> (setq calendar-setup 'one-frame)
> (calendar)

> A couple places in calendar/*.el seem to assume that
> diary-mode-hook is a list of functions, e.g. when it uses ``(memq
> 'diary-fancy-display diary-display-hook)''.

> In my setup I had ``(setq diary-display-hook
> 'fancy-schedule-display-desk-calendar)'' [instead of add-hook or
> ``setq .. '(..)''] and this would trigger a type error.

> I realize the documentation for diary-display-hook says "list of
> functions", but a couple places in the code let-bind
> diary-display-hook to non-lists, and the documentation in 22.2 has
> sample code with non-lists.

Hooks accept either a function or a list of functions, where the former
is only accepted for historical reasons.  So all the code that sets
hooks to a single function should be reported as (minor) bugs, and all
the documentation that does that should be reported as (non-minor) bugs.
A quick grep in the EMACS_22_BASE branch disn't show me the sample code
you refer to, so could you please tell us where you found it?

This said, using `memq' on a hook is indeed an error.


        Stefan


PS: You should "never" modify a hook with setq, always use `add-hook'.





reply via email to

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