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: [drew.adams@oracle.com: Info on define-minor-mode - :init-valueor :initial-value?] Date: Sat, 30 Jul 2005 19:43:13 -0500 (CDT) Message-ID: <200507310043.j6V0hDm25599@raven.dms.auburn.edu> References: <200507290256.j6T2uPh18315@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1122771553 7668 80.91.229.2 (31 Jul 2005 00:59:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 31 Jul 2005 00:59:13 +0000 (UTC) Cc: drew.adams@oracle.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 31 02:59:11 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dz2AP-0003dW-79 for ged-emacs-devel@m.gmane.org; Sun, 31 Jul 2005 02:59:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dz2Cy-0003HF-Il for ged-emacs-devel@m.gmane.org; Sat, 30 Jul 2005 21:01:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dz2CX-00038F-6i for emacs-devel@gnu.org; Sat, 30 Jul 2005 21:01:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dz2CR-000351-Bl for emacs-devel@gnu.org; Sat, 30 Jul 2005 21:01:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dz2CQ-00032u-Eu for emacs-devel@gnu.org; Sat, 30 Jul 2005 21:01:06 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dz27f-00006a-9X; Sat, 30 Jul 2005 20:56:11 -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 j6V0i0CK029629; Sat, 30 Jul 2005 19:44:01 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j6V0hDm25599; Sat, 30 Jul 2005 19:43:13 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rms@gnu.org In-reply-to: (rms@gnu.org) 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:41363 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41363 Richard Stallman wrote: The _default_ :initialize function is custom-initialize-reset. That means that whenever a file containing a defcustom with a :set function is loaded, that :set function is called That seems like the right thing to me. If the user set the variable, he probably wanted to control the mode. In the text you quoted, I was talking about defcustoms with a :set function that are _not_ minor modes. The vast majority of minor modes use custom-initialize-default, so the custom-initialize-reset problems do not apply to them. _even_ if the user customized the variable outside Custom, possibly in an attempt to avoid the :set function. So what? One can't please everybody. I thought that we decided that use of Custom was optional, that people should be able to customize everything in their .emacs and completely ignore Custom, if that is what they wanted to do. custom-initialize-reset effectively makes the Custom way of customizing things mandatory. If you try to customize things manually in your .emacs you subject yourself to Custom overriding you at random moments, without notice, when some file is loaded (for instance by Custom). This has repeatedly caused me (and other people) problems in practice. If you describe these problems, we could think about whether they are worth solving by changing this mechanism. However, if the problems only occur with a few particularly troublesome variables, it would be easier to deal with them one by one. Prior cases that were known to give problems have been solved already in various ways, but people just keep writing new very intrusive :set functions. I have proposed a solution for one very bad example in a different thread. I plan to install that solution if I do not hear any objections to it. But custom-initialize-reset can give bad surprises to people customizing a variable outside Custom, even for very reasonable :set functions. For instance, suppose that setting a variable only takes effect if a timer is set. People using Custom have come to expect that just setting a variable through Custom is sufficient. So you have to provide a :set function that calls the timer. Now somebody who wants the feature sometimes enabled and sometimes not might set a very complex value for the variable in his .emacs and then enable and disable the feature for that complex value by repeatedly setting and unsetting the (autoloadable) timer. But every so often the feature will be mysteriously silently enabled, when some file is silently loaded, for instance by Custom. (That is why, in defcustoms I write that call a timer in a :set function, I usually use custom-initialize-set, or, if the standard value does not require the timer, custom-initialize-default.) Sincerely, Luc.