From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 14 17:20:14 2014 Received: (at submit) by debbugs.gnu.org; 14 Feb 2014 22:20:14 +0000 Received: from localhost ([127.0.0.1]:52734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WER7F-0004Za-T3 for submit@debbugs.gnu.org; Fri, 14 Feb 2014 17:20:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59431) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WER7C-0004ZE-RQ for submit@debbugs.gnu.org; Fri, 14 Feb 2014 17:20:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WER6x-0005wN-VP for submit@debbugs.gnu.org; Fri, 14 Feb 2014 17:20:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WER6x-0005wJ-SO for submit@debbugs.gnu.org; Fri, 14 Feb 2014 17:19:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WER6q-00018S-Ar for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 17:19:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WER6i-0005lr-TX for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 17:19:48 -0500 Received: from colin.muc.de ([193.149.48.1]:61742 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WER6i-0005j7-Mn for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 17:19:40 -0500 Received: (qmail 24743 invoked by uid 3782); 14 Feb 2014 22:12:58 -0000 Received: from acm.muc.de (pD9518044.dip0.t-ipconnect.de [217.81.128.68]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 14 Feb 2014 23:12:57 +0100 Received: (qmail 3980 invoked by uid 1000); 14 Feb 2014 22:09:34 -0000 Date: Fri, 14 Feb 2014 22:09:34 +0000 To: bug-gnu-emacs@gnu.org Subject: CC Mode modes: mode hooks are called twice. Message-ID: <20140214220934.GA3645@acm.acm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) In C Mode, etc., c-mode-hook, etc. gets called twice at mode initialisation. This is bad, since there will be, at least occasionally, mode hooks which must not be called twice. The cause of this is that there is an invocation of run-mode-hooks generated by the macro define-derived-mode as well as an explicit call to run-mode-hooks which is not at the end of the mode function. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 19 12:29:36 2014 Received: (at 16759) by debbugs.gnu.org; 19 Feb 2014 17:29:36 +0000 Received: from localhost ([127.0.0.1]:60500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGAxk-0002uH-7z for submit@debbugs.gnu.org; Wed, 19 Feb 2014 12:29:36 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:38127 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGAxe-0002u4-HO for 16759@debbugs.gnu.org; Wed, 19 Feb 2014 12:29:34 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WGAxa-0004WV-11; Wed, 19 Feb 2014 12:29:26 -0500 From: Glenn Morris To: Alan Mackenzie Subject: Re: bug#16759: CC Mode modes: mode hooks are called twice. References: <20140214220934.GA3645@acm.acm> X-Spook: beanpole LLNL 2600 Magazine ASIO CID Axis of Evil Medco X-Ran: zArht~EpB2@;[nS@RbmqntF3n6,> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 16759 Cc: 16759@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) Alan Mackenzie wrote: > The cause of this is that there is an invocation of run-mode-hooks > generated by the macro define-derived-mode as well as an explicit call to > run-mode-hooks which is not at the end of the mode function. IIUC, this is because you want to run some C-mode stuff after the hooks. A simple solution would be to add :after-hook to define-derived-mode. You already did this for define-minor-mode. It would be good for symmetry/consistency if nothing else, and seems pre-approved: http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00140.html :) From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 19 13:49:51 2014 Received: (at 16759) by debbugs.gnu.org; 19 Feb 2014 18:49:51 +0000 Received: from localhost ([127.0.0.1]:60549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGCDO-00057r-SQ for submit@debbugs.gnu.org; Wed, 19 Feb 2014 13:49:51 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:42675) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGCDN-00057Y-4L for 16759@debbugs.gnu.org; Wed, 19 Feb 2014 13:49:49 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFLd/8D/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av4EABK/CFFLd/8D/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="48159590" Received: from 75-119-255-3.dsl.teksavvy.com (HELO pastel.home) ([75.119.255.3]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 19 Feb 2014 13:49:43 -0500 Received: by pastel.home (Postfix, from userid 20848) id 305846138C; Wed, 19 Feb 2014 13:49:43 -0500 (EST) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#16759: CC Mode modes: mode hooks are called twice. Message-ID: References: <20140214220934.GA3645@acm.acm> <51k3crxb7v.fsf@fencepost.gnu.org> Date: Wed, 19 Feb 2014 13:49:43 -0500 In-Reply-To: <51k3crxb7v.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 19 Feb 2014 12:29:24 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16759 Cc: Alan Mackenzie , 16759@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> The cause of this is that there is an invocation of run-mode-hooks >> generated by the macro define-derived-mode as well as an explicit call to >> run-mode-hooks which is not at the end of the mode function. > IIUC, this is because you want to run some C-mode stuff after the hooks. More specifically, it's always c-update-modeline, AFAICT. A good solution would be to get rid of it and use something like (let ((lighters '("/" (c-electric-flag "l") (c-electric-flag (c-auto-newline "a")) (c-hungry-delete-key "h") (subword-mode "w")))) (setq c-mode-options-format `(c-electric-flag ,lighters (c-hungry-delete-key ,lighters) (subword-mode ,lighters))) (cond ((memq 'c-mode-options-format mode-line-process) nil) ((equal "" (car-safe mode-line-process)) (push 'c-mode-options-format (cdr mode-line-process))) (t (setq mode-line-process `("" c-mode-options-format ,mode-line-process))))) > A simple solution would be to add :after-hook to define-derived-mode. > You already did this for define-minor-mode. > It would be good for symmetry/consistency if nothing else, and seems > pre-approved: I wouldn't say pre-approved. But, yes, I guess it'd be OK. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 19 14:03:36 2014 Received: (at 16759) by debbugs.gnu.org; 19 Feb 2014 19:03:36 +0000 Received: from localhost ([127.0.0.1]:60567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGCQi-0005Vd-4z for submit@debbugs.gnu.org; Wed, 19 Feb 2014 14:03:36 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:40427 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WGCQg-0005VV-7S for 16759@debbugs.gnu.org; Wed, 19 Feb 2014 14:03:34 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WGCQf-0001Mo-6y; Wed, 19 Feb 2014 14:03:33 -0500 From: Glenn Morris To: Stefan Monnier Subject: Re: bug#16759: CC Mode modes: mode hooks are called twice. References: <20140214220934.GA3645@acm.acm> <51k3crxb7v.fsf@fencepost.gnu.org> X-Spook: KGB Treasury number key data haven Sears Tower Tony Blair X-Ran: F$'/_:&G_+ej{AkAz^Rq6pzOWlWWxTIv:FD}Et){}}A*O}S=KY{IHab3G8g"~1t@21SPvM X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Wed, 19 Feb 2014 14:03:33 -0500 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 16759 Cc: Alan Mackenzie , 16759@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) Stefan Monnier wrote: > (subword-mode "w")))) BTW, since subword-mode is now a generic minor mode with its own lighter, I don't believe that cc-mode needs to report its status at all. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 20 12:47:28 2014 Received: (at 16759) by debbugs.gnu.org; 20 Mar 2014 16:47:28 +0000 Received: from localhost ([127.0.0.1]:42543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQg7r-0005ZY-FX for submit@debbugs.gnu.org; Thu, 20 Mar 2014 12:47:27 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:52198) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WQg7o-0005ZL-Gj for 16759@debbugs.gnu.org; Thu, 20 Mar 2014 12:47:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFHO+KKg/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAbBLZEKA44YlmKBXoMT X-IPAS-Result: Av4EABK/CFHO+KKg/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAbBLZEKA44YlmKBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="52776002" Received: from 206-248-162-160.dsl.teksavvy.com (HELO pastel.home) ([206.248.162.160]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 20 Mar 2014 12:47:23 -0400 Received: by pastel.home (Postfix, from userid 20848) id B851D6012B; Thu, 20 Mar 2014 12:47:23 -0400 (EDT) From: Stefan To: Glenn Morris Subject: Re: bug#16759: CC Mode modes: mode hooks are called twice. Message-ID: References: <20140214220934.GA3645@acm.acm> <51k3crxb7v.fsf@fencepost.gnu.org> Date: Thu, 20 Mar 2014 12:47:23 -0400 In-Reply-To: <51k3crxb7v.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 19 Feb 2014 12:29:24 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16759 Cc: Alan Mackenzie , 16759@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > IIUC, this is because you want to run some C-mode stuff after the hooks. Note that "after the hooks" also means "after the code of the child mode" if someone defines a child mode (since hooks get delayed to after the child mode's code). The need to "run things after the hooks" is not frequent but is not exceptional either, so we should provide a good solution for it. So far, the best solution I know is to use hack-local-variables-hook, but that is not run if you use M-x c-mode RET. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 14:31:27 2016 Received: (at 16759-done) by debbugs.gnu.org; 9 May 2016 18:31:27 +0000 Received: from localhost ([127.0.0.1]:44684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azpxn-0000tR-E8 for submit@debbugs.gnu.org; Mon, 09 May 2016 14:31:27 -0400 Received: from mail.muc.de ([193.149.48.3]:16807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azpxk-0000tH-SR for 16759-done@debbugs.gnu.org; Mon, 09 May 2016 14:31:25 -0400 Received: (qmail 76981 invoked by uid 3782); 9 May 2016 18:31:23 -0000 Date: 9 May 2016 18:31:23 -0000 Message-ID: <20160509183123.76980.qmail@mail.muc.de> From: Alan Mackenzie To: 16759-done@debbugs.gnu.org Subject: Re: bug#16759: CC Mode modes: mode hooks are called twice. Organization: muc.de e.V. In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64)) X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 16759-done Cc: Alan Mackenzie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Bug fixed in the master branch. -- Alan Mackenzie (Nuremberg, Germany). From unknown Sun Aug 17 22:06:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 07 Jun 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator