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: questions about define-minor-mode Date: Thu, 08 Apr 2010 22:16:40 -0400 Message-ID: References: <4576E95FD8124CC1B0C77C7DECF45EE7@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1270779413 9361 80.91.229.12 (9 Apr 2010 02:16:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Apr 2010 02:16:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 09 04:16:52 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O03m7-0007uG-NG for ged-emacs-devel@m.gmane.org; Fri, 09 Apr 2010 04:16:52 +0200 Original-Received: from localhost ([127.0.0.1]:49109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O03m6-0004DF-Rb for ged-emacs-devel@m.gmane.org; Thu, 08 Apr 2010 22:16:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O03m1-0004CQ-PM for emacs-devel@gnu.org; Thu, 08 Apr 2010 22:16:45 -0400 Original-Received: from [140.186.70.92] (port=50753 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O03ly-0004Au-Sv for emacs-devel@gnu.org; Thu, 08 Apr 2010 22:16:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O03lx-00013j-Fk for emacs-devel@gnu.org; Thu, 08 Apr 2010 22:16:42 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:36821 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O03lx-00013a-CO for emacs-devel@gnu.org; Thu, 08 Apr 2010 22:16:41 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAPoqvkvO+K6K/2dsb2JhbACbO3K6ZIUJBIs6 X-IronPort-AV: E=Sophos;i="4.52,173,1270440000"; d="scan'208";a="60500277" Original-Received: from 206-248-174-138.dsl.teksavvy.com (HELO pastel.home) ([206.248.174.138]) by ironport2-out.pppoe.ca with ESMTP; 08 Apr 2010 22:16:40 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 2259C81AE; Thu, 8 Apr 2010 22:16:40 -0400 (EDT) In-Reply-To: <4576E95FD8124CC1B0C77C7DECF45EE7@us.oracle.com> (Drew Adams's message of "Thu, 8 Apr 2010 08:51:59 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:123369 Archived-At: > 1. `define-minor-mode' defines a defcustom if the mode is declared > global, but it does not otherwise. > Why not? I'm sure there is a good reason, but it's not clear to me. > Why shouldn't a user be able to customize the (default) value for > a non-global minor mode? The reason is that such a "global default" can not always be changed easily and correctly in a way that doesn't risk confusing users. I.e. it would only make sense if/when we can provide a meaningful interface such as "always activate it in this/that situation". Until then, the programmer will have to provide its own defcustom for those cases where it makes sense. > 3. The explanation of "initial value must (!) be `nil'" is not clear > to me at all. I don't understand either the "exceptional" conditions > under which non-nil is permitted (!) or the reasoning behind > this rule. The initial value should *describe* (i.e. not control) the normal state in the case where the minor mode function is not called. For minor modes where the function does not do anything (i.e. all the minor mode's state is kept in the boolean variable), the different between controlling and describing is irrelevant. But in the general case it's important since otherwise loading the file would require Emacs to run the minor-mode function to make sure the state is consistent with the minor mode variable. Stefan