From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: obsolete comment in tool-bar.el Date: Fri, 15 Jul 2005 00:35:45 -0400 Message-ID: <878y08k857.fsf-monnier+emacs@gnu.org> References: <200507071915.j67JFZT29961@raven.dms.auburn.edu> <200507090235.j692ZER04883@raven.dms.auburn.edu> <200507110321.j6B3LgG09526@raven.dms.auburn.edu> <85y88dfcqw.fsf@lola.goethe.zz> <200507130302.j6D32qE05640@raven.dms.auburn.edu> <200507140208.j6E28tr08794@raven.dms.auburn.edu> <200507141830.j6EIU5r11167@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1121403336 13686 80.91.229.2 (15 Jul 2005 04:55:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Jul 2005 04:55:36 +0000 (UTC) Cc: rms@gnu.org, mituharu@math.s.chiba-u.ac.jp, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 15 06:55:26 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DtICl-0004YD-Tl for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2005 06:53:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DtIEW-0002Sc-PC for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2005 00:55:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DtICG-0001Qz-18 for emacs-devel@gnu.org; Fri, 15 Jul 2005 00:53:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DtICD-0001OS-2F for emacs-devel@gnu.org; Fri, 15 Jul 2005 00:53:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DtICB-0001Cs-EW for emacs-devel@gnu.org; Fri, 15 Jul 2005 00:53:07 -0400 Original-Received: from [209.226.175.74] (helo=tomts20-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DtI3a-0001EZ-KA; Fri, 15 Jul 2005 00:44:14 -0400 Original-Received: from alfajor ([70.48.83.137]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050715043546.YFNP19894.tomts20-srv.bellnexxia.net@alfajor>; Fri, 15 Jul 2005 00:35:46 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id D34E6D7571; Fri, 15 Jul 2005 00:35:45 -0400 (EDT) Original-To: Luc Teirlinck In-Reply-To: <200507141830.j6EIU5r11167@raven.dms.auburn.edu> (Luc Teirlinck's message of "Thu, 14 Jul 2005 13:30:05 -0500 (CDT)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:40904 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40904 > I have the impression that the offending code in define-minor-mode: > ;; If the mode is global, call the function according to the default. > ,(if globalp > `(if (and load-file-name (not (equal ,init-value ,mode))) > (eval-after-load load-file-name '(,mode (if ,mode 1 -1)))))))) > combined with custom-initialize-default, is an ugly kludge to get around > a bug people sometimes make where they use functions or variables in a > :set function that are defined in the same file, but _after_ the defcustom. AFAIK, the motivation was also for some other cases where the user may somehow setq the variable before loading the file. IIRC this setq may actually be done by Custom (at a time where it doesn't yet know that the var have a :setter). > That of course does not work and the obvious solution is to define > those functions and variables before the defcustom. But this is non-obvious, so it's ugly. Also often those functions use the variable, so to shut up the byte-compiler you need to pre-declare the variable. Miles complained loudly (in the form of comments, some of which may still be in the current elisp code ;-) before I installed this delayed-initialization trick. > But I believe that define-minor-mode tries to hide this type of user > bug and work around it by delaying the enabling of the minor mode > function until after the file is loaded. Which is the right thing to do. > ! `(and load-file-name > ! (eq (quote ,initialize) > ! (quote (:initialize 'custom-initialize-default))) > ! (not (equal ,init-value ,mode)) > ! (eval-after-load load-file-name '(,mode (if ,mode 1 -1)))))))) IIUC the (eq (quote ,initialize) > ! (quote (:initialize 'custom-initialize-default)))