From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: comint-carriage-motion causes severe problems. Date: Thu, 04 Jul 2002 11:43:14 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200207041543.g64FhEb29778@rum.cs.yale.edu> References: <200207020035.TAA19789@eel.dms.auburn.edu> <200207021534.g62FYao17897@rum.cs.yale.edu> <200207021618.LAA20219@eel.dms.auburn.edu> <200207032057.g63KvX604721@aztec.santafe.edu> <200207032111.g63LBAv25925@rum.cs.yale.edu> <200207040118.UAA22469@eel.dms.auburn.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1025800700 5381 127.0.0.1 (4 Jul 2002 16:38:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 4 Jul 2002 16:38:20 +0000 (UTC) Cc: monnier+gnu/emacs@rum.cs.yale.edu, rms@gnu.org, miles@lsi.nec.co.jp, Kai.Grossjohann@CS.Uni-Dortmund.DE, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17Q9cZ-0001Og-00 for ; Thu, 04 Jul 2002 18:38:19 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17Q9ie-00050X-00 for ; Thu, 04 Jul 2002 18:44:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17Q8nD-00007w-00; Thu, 04 Jul 2002 11:45:15 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17Q8lK-0007aW-00; Thu, 04 Jul 2002 11:43:18 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g64FhEb29778; Thu, 4 Jul 2002 11:43:14 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Luc Teirlinck Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:5462 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:5462 > However, I now believe that there is an even better solution which not > only removes the arbitrariness in the above example, but moreover > removes any danger of breaking existing code, which otherwise seems > to be a very real danger, and which also adds useful flexibility. > > Indeed, I now start to get really weary about breaking existing code > where people rely on the fact that remove-hook "does no harm anyway" > if bar is not in the local value of foo and hence it does not matter > whether > > (remove-hook 'foo 'bar 'local) > > is executed several times if a file is accidentally loaded more than > once. This fear is unfounded. I have been using my hacked Emacs with this feature for at least a year with no problem and I have grepped through the code to try and see what kind of behavior is expected, and the fact is that hooks are added either only globally or only locally. And since my code only adds a (not . BAR) if we're removing it locally and it is present globally, that means that my code is almost never activated. I hactually have a (debug) call in my code to see when a (not . BAR) happens, and the very few times it has happened have all been right. > Depending on peoples' style, current code may contain third non-nil > arguments of t or 'local, as you use, but I can not possibly see how > people would have used a third argument 'override anywhere. (Unless > they were actually anticipating your code.) Hence, all worries about > breaking existing code would be gone, the worry about arbitrariness in > cases of the type you describe is gone, the worry about bad things > happening if files get accidentally loaded more than once is totally > gone and we have, moreover, better flexibility. I'm not sure what you mean by "better flexibility". My "arbitrary" choice is not so arbitrary in that it tries to maintain compatibility and it also has the advantage of still allowing the other behavior. I.e. if you really want to make sure that the hook function will not be run, like your `override' argument would do, you can just do (remove 'foo 'bar 'local) (remove 'foo 'bar 'local) where the first call will remove any local ocurrence and the second will override any remaining global ocurrence. So I'm not sure if we really get more flexibility and if the added complexity is warranted. I see the current behavior of (remove 'foo 'bar 'local) as a bug and my patch as a bug-fix. This impression is partly based on the (very few) cases where the code was triggered to insert (not . BAR). Stefan