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: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478. Date: Fri, 28 Feb 2014 19:50:52 +0000 Message-ID: <20140228195051.GA3446@acm.acm> References: <20140222182704.GA2639@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1393617283 27816 80.91.229.3 (28 Feb 2014 19:54:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Feb 2014 19:54:43 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 28 20:54:51 2014 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 1WJTWA-0008Uq-BB for ged-emacs-devel@m.gmane.org; Fri, 28 Feb 2014 20:54:46 +0100 Original-Received: from localhost ([::1]:53031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJTWA-00055B-0U for ged-emacs-devel@m.gmane.org; Fri, 28 Feb 2014 14:54:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJTVx-000549-Qs for emacs-devel@gnu.org; Fri, 28 Feb 2014 14:54:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJTVq-00064f-Gn for emacs-devel@gnu.org; Fri, 28 Feb 2014 14:54:33 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:14123 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJTVq-00061O-AI for emacs-devel@gnu.org; Fri, 28 Feb 2014 14:54:26 -0500 Original-Received: (qmail 76634 invoked by uid 3782); 28 Feb 2014 19:54:24 -0000 Original-Received: from acm.muc.de (pD951B746.dip0.t-ipconnect.de [217.81.183.70]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 28 Feb 2014 20:54:22 +0100 Original-Received: (qmail 4752 invoked by uid 1000); 28 Feb 2014 19:50:52 -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:169958 Archived-At: Hi, Stefan. On Mon, Feb 24, 2014 at 10:24:23PM -0500, Stefan Monnier wrote: > > The other bit takes over the value of c-electric-indent-mode into CC > > Mode only when it has been set by the user, thus preventing > > electric.el's default overriding CC Mode's. > For that I think it's better to only obey electric-indent-mode if > Emacs>24.3 rather than use the electric-indent-mode-has-been-called crutch. That does not achieve the same effect. > >> > + ;; Emacs has en/disabled `electric-indent-mode'. Propagate this through to > >> > + ;; each CC Mode buffer. > >> > + (when (and (boundp 'electric-indent-mode-has-been-called) > >> > + (> electric-indent-mode-has-been-called 1)) > >> > + (mapc (lambda (buf) > >> > + (with-current-buffer buf > >> > + (when c-buffer-is-cc-mode > >> > + ;; Don't use `c-toggle-electric-state' here due to recursion. > >> > + (setq c-electric-flag electric-indent-mode) > >> > + (c-update-modeline)))) > >> > + (buffer-list)))) > >> And could you also explain what this one is trying to avoid? > > Basically the same thing. It's preventing an inopportune default (as > > contrasted with an explicit user setting) overriding CC Mode's default. > Looks quite different since it checks (> > electric-indent-mode-has-been-called 1), .... Both bits of code check (> electric-indent-mode-has-been-called 1), hence they are very similar, not quite different. > .... but if you say it's the same, then I'll remove > electric-indent-mode-has-been-called and let you check Emacs's version > instead. Please don't do this. I meant literally what I wrote. A better solution would be to provide a less ugly way of checking whether a user has called electric-indent-mode - possibly some enhancement of define-minor-mode. I can't think of any at the moment. > Stefan -- Alan Mackenzie (Nuremberg, Germany).