From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#15596: Let's improve the default workings of electric-indent-mode. Date: Sat, 12 Oct 2013 12:35:46 -0400 Message-ID: References: <20131002200737.GA3895@acm.acm> <524CDA92.1030107@dancol.org> <20131003094543.GA3211@acm.acm> <83zjqn5cri.fsf@gnu.org> <20131012145415.GA3987@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1381595778 4116 80.91.229.3 (12 Oct 2013 16:36:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Oct 2013 16:36:18 +0000 (UTC) Cc: 15596@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 12 18:36:20 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1VV2At-0006lX-Up for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Oct 2013 18:36:20 +0200 Original-Received: from localhost ([::1]:58813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV2At-0007Ge-Ft for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Oct 2013 12:36:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV2Aj-0007GR-Pi for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 12:36:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV2Ac-0005jG-7A for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 12:36:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV2Ac-0005jB-43 for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 12:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VV2Ab-0005Fw-RQ for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 12:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2013 16:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15596 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15596-submit@debbugs.gnu.org id=B15596.138159575120186 (code B ref 15596); Sat, 12 Oct 2013 16:36:01 +0000 Original-Received: (at 15596) by debbugs.gnu.org; 12 Oct 2013 16:35:51 +0000 Original-Received: from localhost ([127.0.0.1]:44539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV2AQ-0005FV-CS for submit@debbugs.gnu.org; Sat, 12 Oct 2013 12:35:50 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:64967) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV2AN-0005FK-Kg for 15596@debbugs.gnu.org; Sat, 12 Oct 2013 12:35:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCreE/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFMCreE/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35349546" Original-Received: from 76-10-183-132.dsl.teksavvy.com (HELO pastel.home) ([76.10.183.132]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 12 Oct 2013 12:31:51 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 54D906049A; Sat, 12 Oct 2013 12:35:46 -0400 (EDT) In-Reply-To: <20131012145415.GA3987@acm.acm> (Alan Mackenzie's message of "Sat, 12 Oct 2013 14:54:15 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79211 Archived-At: > At the moment, it is (rather crudely) just nil or t, globally for all > modes and all buffers. This is unsatisfactory, as it makes it difficult > to {en,dis}able e-i-m for a single mode, and for a single buffer. An > example of when you might want to do the latter is thus: one has an > isolated file.c (or section therewithin) whose indentation style does not > conform to project norms, and one does not wish to reindent the file > wholesale. Electric indentation makes editing such a file inconvenient, > hence the need for the ability readily to switch it off (currently > available in CC Mode with C-c C-l). Currently it's easyish for the user to do (add-hook 'blabla-hook (lambda () (setq-local electric-indent-mode nil))) Or to set electric-indent-mode to nil in the file variables. But we could provide an electric-indent-local-mode, yes. Patch welcome. > So, make `electric-indent-mode' t by default, yet have it tempered by the Have any one of you tried to use Emacs with this setting? I'm not fundamentally opposed to changing the default setting, but just as was the case for font-lock-mode, transient-mark-mode, etc... we need to be sure it actually works well enough in "all" cases (except those cases where the user just doesn't like the feature and will disable it globally). But contrary to font-lock-mode, transient-mark-mode, AFAIK not many people have enabled this mode yet, so I'd urge you all to try it out for a few weeks first, to see if you like it not only in modes like c-mode but also everywhere else, and if there are cases where you find it inconvenient, report it here, so we can see what we should do about it. > new buffer local variables `electric-indent-enabled-function' and The buffer-local value of electric-indent-mode is already used for that purpose (and there's also the new electric-indent-inhibit which I recently added, which prevents reindentation, while still doing automatic indentation for new lines. Stefan