bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22564: Fundamental mode isn't fundamental enough.


From: Eli Zaretskii
Subject: bug#22564: Fundamental mode isn't fundamental enough.
Date: Sun, 01 May 2022 09:16:08 +0300

> From: Richard Stallman <rms@gnu.org>
> Date: Sat, 30 Apr 2022 21:53:03 -0400
> Cc: jwiegley@gmail.com, johnw@gnu.org, 22564@debbugs.gnu.org, acm@muc.de,
>  rgm@gnu.org
> 
> The doc string of `electric-indent-mode' is deficient -- it fails to say
> what it will concretely do in an uncustomized Emacs.  All it says is this:
> 
>     When enabled, this reindents whenever the hook ‘electric-indent-functions’
>     returns non-nil, or if you insert a character from 
> ‘electric-indent-chars’.
> 
> To see what that concretely does, you have to look at those variables.
> That's asking too much, for a beginner.

The difficulty is that the hook and the characters vary significantly
from major mode to major mode.  The latter one, for example, can in
some modes include characters that are very unintuitive, like ':'.

We could say something like

  The electric characters normally include the newline, but can also
  include other characters as needed by the major mode; see
  `electric-indent-chars' for the actual list.

Would this help?

> This doc string should say where to find the specifics of what it
> does in Fundametal mode.

Why is that important?  Fundamental mode is not supposed to be used
frequently by Emacs users, so why single out that mode, and why
specifically for this minor mode?

> I looked at them and found that `electric-indent-chars' has TAB (10) in it.
> However, TAB has a global binding, `indent-for-tab-command'.

10 is not TAB, it's C-j (newline).

> What, then, does Electric Indent mode alter in Fundamental mode?  Does
> it alter anything?

It does.  As a simple example, try this in fundamental mode, on an
empty line:

  C-u 10 SPC C-u 10 x C-j

> Was there a concrete motive for proposing to disable it in
> Fundamental mode?

We enabled it by default in every mode (in Emacs 24), so Fundamental
mode is also affected.

I don't remember the motives; perhaps Stefan (CC'ed) does.

> We need to help users find out these
> things.  Is there a way, other than by reading electric.el?

Not really.

> The doc string also fails to say what, concretely, reindenting does, or even
> what controls what reindenting does.  So it needs a lot of improvement.

The problem is that this feature is implemented with so many opaque
hooks and variables which modes can set and override that it's hard to
describe its workings in a way that is both accurate and general
enough to cover all the modes which employ those hooks and those
variables.

The workhorse is electric-indent-post-self-insert-function; please
take a look at what it does and how, and I think any improvement of
the doc string based on what you see there (and the many rabbit holes
down which it will lead you) will be most welcome.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]