From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Redundant (harmful) duplication of run-hooks in define-globalized-minor-mode [patch-2] Date: Fri, 1 Feb 2013 15:44:53 +0000 Message-ID: <20130201154453.GA23075@acm.acm> References: <20130113192854.GA4853@acm.acm> <20130114163003.GC3274@acm.acm> <20130115140855.GA3430@acm.acm> <20130117175159.GA3114@acm.acm> <20130131110404.GA3459@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1359733902 28734 80.91.229.3 (1 Feb 2013 15:51:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2013 15:51:42 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org, Leo Liu , =?iso-8859-1?Q?Jo=E3o_T=E1vora?= To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 01 16:51:59 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U1IuF-00068k-4P for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2013 16:51:59 +0100 Original-Received: from localhost ([::1]:58326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Itx-0001hv-1K for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2013 10:51:41 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Itu-0001h7-OO for emacs-devel@gnu.org; Fri, 01 Feb 2013 10:51:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1Itt-0000nu-Cm for emacs-devel@gnu.org; Fri, 01 Feb 2013 10:51:38 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:51877 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Itt-0000nI-3x for emacs-devel@gnu.org; Fri, 01 Feb 2013 10:51:37 -0500 Original-Received: (qmail 23853 invoked by uid 3782); 1 Feb 2013 15:51:34 -0000 Original-Received: from acm.muc.de (pD955693B.dip.t-dialin.net [217.85.105.59]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 01 Feb 2013 16:51:32 +0100 Original-Received: (qmail 2020 invoked by uid 1000); 1 Feb 2013 15:44:53 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156761 Archived-At: Hi, Stefan. On Thu, Jan 31, 2013 at 09:38:31AM -0500, Stefan Monnier wrote: > > + (MODE-cancel-disable > > + (intern (concat global-mode-name "-cancel-disable"))) > > + (MODE-disable-in-buffer > > + (intern (concat global-mode-name "-disable-in-buffer"))) > If you defvar-local the MODE-disable-in-buffer, ..... That would be disable-MODE I think you meant. Yes, I've now made disable-MODE buffer local. It has to be buffer local, considering the way that MODE-enable-in-buffers checks all buffers each time it runs. > .... then you shouldn't need MODE-cancel-disable since > kill-all-local-variables will have reset MODE-disable-in-buffer to nil > already. I'm not so sure about this. These complicated structures of macros and hooks and generated functions are making my head hurt. ;-( Are you sure there are no ways of invoking this which won't bypass kill-all-local-variables? (That's a real question, not a rhetorical one.) Another thought. As I've coded it up, the disable-MODE flag, once it becomes t, stays t (upto the next major mode change). However, running global-MODE still enables MODE on this buffer. Should we worry about this? I don't think we need to. [Amended patch not included.] > Stefan -- Alan Mackenzie (Nuremberg, Germany).