From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: turning on minor modes from hooks Date: Sun, 30 Aug 2009 11:11:41 +0900 Message-ID: <87ws4mgiea.fsf@catnip.gol.com> References: <200908292125.n7TLPCdp005058@godzilla.ics.uci.edu> <87eiqui4yx.fsf@catnip.gol.com> <9CA8B839B73049A6A7B1AD1C4D92BFC3@us.oracle.com> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251598326 20836 80.91.229.12 (30 Aug 2009 02:12:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Aug 2009 02:12:06 +0000 (UTC) Cc: 'Dan Nicolaescu' , emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 30 04:11:58 2009 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.50) id 1MhZtd-0002mk-RY for ged-emacs-devel@m.gmane.org; Sun, 30 Aug 2009 04:11:58 +0200 Original-Received: from localhost ([127.0.0.1]:42539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhZtc-0007JR-TK for ged-emacs-devel@m.gmane.org; Sat, 29 Aug 2009 22:11:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MhZtX-0007HO-G6 for emacs-devel@gnu.org; Sat, 29 Aug 2009 22:11:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MhZtU-0007Gd-0R for emacs-devel@gnu.org; Sat, 29 Aug 2009 22:11:51 -0400 Original-Received: from [199.232.76.173] (port=46939 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MhZtT-0007GT-Oh for emacs-devel@gnu.org; Sat, 29 Aug 2009 22:11:47 -0400 Original-Received: from smtp11.dentaku.gol.com ([203.216.5.73]:41012) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MhZtQ-0006rk-QO; Sat, 29 Aug 2009 22:11:45 -0400 Original-Received: from 218.231.109.79.eo.eaccess.ne.jp ([218.231.109.79] helo=catnip.gol.com) by smtp11.dentaku.gol.com with esmtpa (Dentaku) id 1MhZtN-0007Ft-UB; Sun, 30 Aug 2009 11:11:42 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id 22D1CDF8D; Sun, 30 Aug 2009 11:11:41 +0900 (JST) System-Type: x86_64-unknown-linux-gnu In-Reply-To: <9CA8B839B73049A6A7B1AD1C4D92BFC3@us.oracle.com> (Drew Adams's message of "Sat, 29 Aug 2009 17:14:53 -0700") Original-Lines: 59 X-Virus-Scanned: ClamAV GOL (outbound) X-Abuse-Complaints: abuse@gol.com X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:114864 Archived-At: "Drew Adams" writes: >> Stephen has long advocated that non-interactive invocation of mode >> commands should always turn on the mode instead of toggling. > > So interactively a nil arg will toggle, but in Lisp a nil arg will turn it on? > And just why is that a great idea? Er, because it works the command work "as expected" in all contexts, instead of in just one. >> I agree with that: I think the vast majority of uses in code >> do not use the toggling anyway, and while there probably are >> a few uses which would be broken by such a change, I think >> there would be far _more_ currently-incorrect uses > > In libraries or in user init files? Mostly in user init files -- uses in libraries mostly won't be affected, as they tend to explicitly specify the argument, and explicitly set or reset the mode, not toggle it. > The latter, maybe, at least until they > discover that it doesn't do what they thought. That doesn't take long... That's exactly the problem -- it _does_ take long for a user to discover, because the default state for most modes is "off", and so toggling _usually_ does the right thing. Inadvertent use of the toggling behavior tends to result in obscure and hard to locate bugs (because it "usually" works right, and only fails in the rare case where the mode happens to be already turned on for some reason). >> that would be _fixed_ by such a change (where someone uses >> (add-hook 'foo-hook 'ack-mode) not realizing that it really >> toggles instead of turning on). > > "Not realizing" is the key phrase. This is not about being unable to understand, > I think. It's about ordinary ignorance. It's about things not being the way some > newbies expect, without reading the doc. Yes. Of course the doc should be good, but it's pretty clear that in practice, it's not enough -- people don't always read the doc, or don't read it carefully enough, or aren't experienced enough to understand all the ramifications of what they're reading (the latter can be addressed to some extent by careful wording, but it's almost impossible to do reach all users). Thus it's really really useful if we can have _both_ good docs _and_ commands that work intuitively. Belt and braces, etc, etc. > This is a YAGNI feature, at best, and a bug-producer and code > complexifier, at worst. I think you're wrong. It will cause some bugs, but it will fix far more. -Miles -- I'm beginning to think that life is just one long Yoko Ono album; no rhyme or reason, just a lot of incoherent shrieks and then it's over. --Ian Wolff