From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: obsolete comment in tool-bar.el Date: Fri, 15 Jul 2005 17:05:10 -0500 (CDT) Message-ID: <200507152205.j6FM5Ap13297@raven.dms.auburn.edu> 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> <878y08k857.fsf-monnier+emacs@gnu.org> <200507151353.j6FDrMf12755@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1121465247 13411 80.91.229.2 (15 Jul 2005 22:07:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 15 Jul 2005 22:07:27 +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 Sat Jul 16 00:07:18 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DtYKo-0007nh-Ku for ged-emacs-devel@m.gmane.org; Sat, 16 Jul 2005 00:07:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DtYMJ-0007Rp-Nm for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2005 18:08:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DtYLC-0007P1-Vv for emacs-devel@gnu.org; Fri, 15 Jul 2005 18:07:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DtYL9-0007NV-Ek for emacs-devel@gnu.org; Fri, 15 Jul 2005 18:07:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DtYL9-0007NG-9c for emacs-devel@gnu.org; Fri, 15 Jul 2005 18:07:27 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DtYRW-0006SE-BU; Fri, 15 Jul 2005 18:14:02 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j6FM5JCK009842; Fri, 15 Jul 2005 17:05:20 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j6FM5Ap13297; Fri, 15 Jul 2005 17:05:10 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@iro.umontreal.ca In-reply-to: (message from Stefan Monnier on Fri, 15 Jul 2005 16:44:20 -0400) 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:40959 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40959 Stefan Monnier wrote: > Miles complained loudly (in the form of comments, some of which > may still be in the current elisp code ;-) > These comments make no sense. If you do not understand them, I fear you may not understand the problem well enough to judge what's the least bad solution. Well I should not have said "these comments make no sense", as I may not have found all of them. It would also have been more accurate to say "your solution to these comments makes no sense". What I found were two instances of the following comment: ;;; Note this definition must be at the end of the file, because ;;; `define-minor-mode' actually calls the mode-function if the ;;; associated variable is non-nil, which requires that all needed ;;; functions be already defined. [This is arguably a bug in d-m-m] You can solve the only problem pointed out in this comment in two ways. The ideal one is to come up with a solution that does not require define-minor-mode to actually call the mode function. The second is to put the call to the define-minor-mode after all functions used by the minor mode, for instance at the end of the file. That may require a compiler defvar, but that is not the end of the world. There are several things wrong with your solution. The call to the minor mode becomes de facto part of the initialization of the minor mode defcustom. Therefore the ":initialize 'custom-initialize-default" is misleading. The motivation given for that :initialize function is that loading the file should not call the mode function. But the file calls the minor mode function anyway (via an eval-after-load), in a way that misleads people into believing it will not be. The second problem is much worse. In `(elisp)Hooks for Loading' it is stated that well-designed Lisp programs should not use eval-after-load. There is a very good reason for that. The kind of use of eval-after-load made by define-minor-mode means that define-minor-mode behaves differently when called interactively than when called from a file. This destroys the interactive nature of Elisp. For instance, the eval-after-load makes the interactive testing (for instance in ielm) of any Elisp code that directly or indirectly calls define-minor-mode unreliable. You can only reliably test such code by loading files. (As I noticed.) The two above problems seem to me to be worse than the problems caused by a compiler defvar and a call to define-minor-mode late in the file. If it really is impossible to get rid of the call to the mode function (something I am not convinced of), then I believe that you should get rid of the eval-after-load and clearly state in the define-minor-mode docstring that it can call the mode function and state what the consequences of that are. Sincerely, Luc.