GNU bug report logs - #15596
Let's improve the default workings of electric-indent-mode.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 12 Oct 2013 14:57:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 15596 <at> debbugs.gnu.org
Subject: bug#15596: Let's improve the default workings of electric-indent-mode.
Date: Sat, 12 Oct 2013 12:35:46 -0400
> 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




This bug report was last modified 11 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.