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, 17 Feb 2014 19:11:18 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392682291 20596 80.91.229.3 (18 Feb 2014 00:11:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Feb 2014 00:11:31 +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 18 01:11:38 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 1WFYHh-0006lT-SY for ged-emacs-devel@m.gmane.org; Tue, 18 Feb 2014 01:11:37 +0100 Original-Received: from localhost ([::1]:45045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFYHh-0000yC-Af for ged-emacs-devel@m.gmane.org; Mon, 17 Feb 2014 19:11:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFYHX-0000tb-78 for emacs-devel@gnu.org; Mon, 17 Feb 2014 19:11:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFYHP-0005xL-M2 for emacs-devel@gnu.org; Mon, 17 Feb 2014 19:11:27 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:51352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFYHP-0005xA-I8 for emacs-devel@gnu.org; Mon, 17 Feb 2014 19:11:19 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFLd/lO/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av4EABK/CFFLd/lO/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="47908204" Original-Received: from 75-119-249-78.dsl.teksavvy.com (HELO pastel.home) ([75.119.249.78]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 17 Feb 2014 19:11:19 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id CD2C6610E9; Mon, 17 Feb 2014 19:11:18 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Mon, 17 Feb 2014 18:22:02 +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:169727 Archived-At: > + ;; In Emacs 24.4 onwards, prevent Emacs's built in electric indentation from > + ;; messing up CC Mode's, and set `c-electric-flag' if `electric-indent-mode' > + ;; has been called by the user. > + (when (boundp 'electric-indent-inhibit) (setq electric-indent-inhibit t)) > + (when (and (boundp 'electric-indent-mode-has-been-called) > + (> electric-indent-mode-has-been-called 1)) > + (setq c-electric-flag electric-indent-mode)) Could you explain what problem this is trying to avoid? > + ;; 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? Stefan