emacs-devel
[Top][All Lists]
Advanced

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

Re: eval-after-load as a macro (and eval-next-after-load)


From: Kim F. Storm
Subject: Re: eval-after-load as a macro (and eval-next-after-load)
Date: 08 Apr 2003 12:46:07 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

>     Maybe some wording could be added to talk about efficiency.  For
>     example, crisp.el adds two entries to cua-movement-commands.  It does
>     not make sense for crisp to require cua, as many crisp users probably
>     don't want to use cua.  It also doesn't work to just frob
>     cua-movement-commands, since adding to a list can only be done after
>     the defvar.
> 
> The usual way to handle this is with hooks.  Does cua mode have
> a cua-mode-hook?

It does not, but I can add one.

However, such hooks (e.g. cua-mode-hook) are normally for users to
set, so if a package like crisp modifies it (too), Customize will
report "this variable is set outside custom" -- and saving it will
cause the crisp addition to be saved as well (potentially adding to
the hook a reference to a function which isn't defined on next emacs
startup).

Doing this via a hook would require having two hooks -- one for emacs
internal use and another for the user...  

IMO, that is an unnecessary complication, when eval-after-load does
the job perfectly.  

In fact, using a hook is more complex, as we need to handle two cases,
depending on whether cua is enabled or not-enabled (which requires
testing cua internal variables), and then in the first case, the hook
action must be performed by crisp directly, and in the second case a
hook must be setup (and be written to de-install itself when it has
been run).


BTW, in the cua/crisp case, crisp actually add the entries to the
cua--standard-movement-commands list -- which is for emacs internal
use (there is a cua-movement-commands list for the user to modify).

The separation into cua--standard-movement-commands and
cua-movement-commands is precisely to avoid mixing emacs' internal
setup and the user's individual customizations.






reply via email to

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