From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#15596: Let's improve the default workings of electric-indent-mode. Date: Sat, 12 Oct 2013 14:54:15 +0000 Message-ID: <20131012145415.GA3987@acm.acm> References: <20131002200737.GA3895@acm.acm> <524CDA92.1030107@dancol.org> <20131003094543.GA3211@acm.acm> <83zjqn5cri.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1381589842 5446 80.91.229.3 (12 Oct 2013 14:57:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Oct 2013 14:57:22 +0000 (UTC) To: 15596@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 12 16:57:25 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 1VV0dA-0001pJ-PH for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Oct 2013 16:57:25 +0200 Original-Received: from localhost ([::1]:58478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV0dA-0005we-13 for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Oct 2013 10:57:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV0cy-0005wN-KH for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:57:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV0cp-0003mn-5l for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:57:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV0cp-0003mj-1r for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:57:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VV0co-0002sD-Iz for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2013 14:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15596 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138158980011010 (code B ref -1); Sat, 12 Oct 2013 14:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Oct 2013 14:56:40 +0000 Original-Received: from localhost ([127.0.0.1]:44436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV0cQ-0002rV-UU for submit@debbugs.gnu.org; Sat, 12 Oct 2013 10:56:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60687) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV0cO-0002rK-Ph for submit@debbugs.gnu.org; Sat, 12 Oct 2013 10:56:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV0cF-0003jE-2b for submit@debbugs.gnu.org; Sat, 12 Oct 2013 10:56:36 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV0cE-0003j9-VH for submit@debbugs.gnu.org; Sat, 12 Oct 2013 10:56:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV0c7-0005tK-HZ for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:56:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV0bw-0003g8-MO for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:56:19 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:30950 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV0bw-0003fw-D3 for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 10:56:08 -0400 Original-Received: (qmail 87941 invoked by uid 3782); 12 Oct 2013 14:56:06 -0000 Original-Received: from acm.muc.de (pD95197FD.dip0.t-ipconnect.de [217.81.151.253]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 12 Oct 2013 16:56:05 +0200 Original-Received: (qmail 4061 invoked by uid 1000); 12 Oct 2013 14:54:15 -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-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:79210 Archived-At: Hi, Stefan. On Sun, Oct 06, 2013 at 01:01:31PM -0400, Stefan Monnier wrote: > Hey, guys. What are you waiting for on the bug-report requesting to > change the default of electric-indent-mode? > Really! I think the default behaviour of electric-indent-mode can and should be improved. 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). We need a method of {en,dis}abling e-i-m for both modes and for indiviual buffers. We probably don't want to change the definition of the variable `electric-indent-mode'. So, make `electric-indent-mode' t by default, yet have it tempered by the new buffer local variables `electric-indent-enabled-function' and `electric-indent-enabled-flag', both defaulting to nil, which work in the canonical Emacs fashion. These variables will be intended mainly for mode maintainers, yet will be available to knowledgeable users for configuration/toggling. When `e-i-m' is t and one of these new variables returns/is t, then electric indentation will take place. With this scheme, users can globally disable e-i-m by toggling electric-indent-mode, as at present. They can enable it in all buffers in which it makes sense by toggling it again. They can enable it in other buffers by setting `electric-indent-enabled-flag' in those buffers. > Stefan -- Alan Mackenzie (Nuremberg, Germany).