From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: eval-after-load as a macro (and eval-next-after-load) Date: 08 Apr 2003 12:46:07 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xhe99z2q8.fsf@kfs2.cua.dk> References: <200304042030.h34KUEQL008262@rum.cs.yale.edu> <200304062105.h36L55Jn019873@rum.cs.yale.edu> <84y92mslqe.fsf@lucy.is.informatik.uni-duisburg.de> <84brziwhsi.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1049792194 24427 80.91.224.249 (8 Apr 2003 08:56:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 8 Apr 2003 08:56:34 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 08 10:56:32 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 192ou8-0006Ll-00 for ; Tue, 08 Apr 2003 10:56:32 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 192oy3-0003CP-00 for ; Tue, 08 Apr 2003 11:00:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192otw-0000Wq-03 for emacs-devel@quimby.gnus.org; Tue, 08 Apr 2003 04:56:20 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 192opr-000881-00 for emacs-devel@gnu.org; Tue, 08 Apr 2003 04:52:07 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 192onY-000717-00 for emacs-devel@gnu.org; Tue, 08 Apr 2003 04:49:47 -0400 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192olV-0005IW-00; Tue, 08 Apr 2003 04:47:38 -0400 Original-Received: from kfs2.cua.dk.cua.dk (kfs2.local.filanet.dk [192.168.1.182]) by mail.filanet.dk (Postfix) with SMTP id A738D7C012; Tue, 8 Apr 2003 10:47:27 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: Original-Lines: 43 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-cc: teirllm@dms.auburn.edu Original-cc: =?iso-8859-1?q?Kai_Gro=DFjohann?= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13019 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13019 Richard Stallman 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.