From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478. Date: Mon, 24 Feb 2014 22:24:23 -0500 Message-ID: References: <20140222182704.GA2639@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1393298680 17826 80.91.229.3 (25 Feb 2014 03:24:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Feb 2014 03:24:40 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 25 04:24:43 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 1WI8dP-0001s1-1B for ged-emacs-devel@m.gmane.org; Tue, 25 Feb 2014 04:24:43 +0100 Original-Received: from localhost ([::1]:60894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WI8dO-0006hz-AH for ged-emacs-devel@m.gmane.org; Mon, 24 Feb 2014 22:24:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WI8dE-0006hg-6R for emacs-devel@gnu.org; Mon, 24 Feb 2014 22:24:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WI8d6-0006WJ-Sc for emacs-devel@gnu.org; Mon, 24 Feb 2014 22:24:32 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:36111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WI8d6-0006WF-Ov for emacs-devel@gnu.org; Mon, 24 Feb 2014 22:24:24 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFsoXjX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtji6CXAOIYZwZgV6Cais X-IPAS-Result: Av4EABK/CFFsoXjX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtji6CXAOIYZwZgV6Cais X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="48674539" Original-Received: from 108-161-120-215.dsl.teksavvy.com (HELO ceviche.home) ([108.161.120.215]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 Feb 2014 22:24:23 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 4EF0E66099; Mon, 24 Feb 2014 22:24:23 -0500 (EST) In-Reply-To: <20140222182704.GA2639@acm.acm> (Alan Mackenzie's message of "Sat, 22 Feb 2014 18:27:04 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:169856 Archived-At: > 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. >> > + ;; 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), 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. Stefan