From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: [External] : Tab completion and electric-indent-mode
Date: Sat, 18 Jun 2022 09:44:59 +0300 [thread overview]
Message-ID: <83pmj6o4gk.fsf@gnu.org> (raw)
In-Reply-To: <N4ouWCD--3-2@tutanota.com> (carlmarcos@tutanota.com)
> Date: Sat, 18 Jun 2022 05:45:06 +0200 (CEST)
> From: carlmarcos@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> But before you do, I suggest to check the latest code, because the
> above quotations are obsolete.
>
> Have looked /emacs/lisp/electric.el which now describes command loop for `electric' modes.
>
> Still think there should be clear explanations on the level of indentations emacs does.
> This is because reindentation typically refers to an indentation enhancement compared to
> some basic indentation method. "On-the-Fly Reindentation" also has difficulty of interpretation.
> Does there exist indentation that is "Not On-the-Fly"? What would that do?
>
> Have viewed the main repository
>
> define-minor-mode electric-indent-mode
>
> says
>
> When enabled, this reindents whenever the hook `electric-indent-functions'
> returns non-nil, I do not find the comment informative regarding the types of
> reindents.
I don't know in which place you looked, but the above is just a small
part of what the doc string says. You omitted the parts that are
supposed to answer your questions. In particular, the doc string does
attempt to explain what "reindent" means.
> electric-indent-functions states that it is a special hook run to decide whether to auto-indent.
Why are you focusing on electric-indent-functions? In most cases, the
cause of electric reindentation is not that function, but what the
rest of the sentence says:
...or if you insert one of the "electric characters".
> Additionally, reindent means that an indentation scheme would have been applied
> already, supposedly composed of a simpler indent scheme.
>
> Can information be introduced on how indentation and re-indentation works and the conditions
> by which indentation is applied?
What exactly indentation and reindentation do depends on the current
major mode. electric-indent-mode just makes the mode-specific
indentation to happen automatically in certain situations, where Emacs
thinks the user expects reindentation.
If you want to know how a specific major mode indents text, you need
to look for answers in that mode, not in electric-indent-mode, because
the latter simply cannot give you the answer.
> There needs to be clear explanations of what indentation and reindentation do and under what
> conditions as the current information is developer targeted but not user targeted.
Here's the full doc string of electric-indent-mode in the current
development version of Emacs:
Toggle on-the-fly reindentation of text lines (Electric Indent mode).
When enabled, this reindents whenever the hook `electric-indent-functions'
returns non-nil, or if you insert one of the "electric characters".
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.
By "reindent" we mean remove any existing indentation, and then
indent the line according to context and rules of the major mode.
This is a global minor mode. To toggle the mode in a single buffer,
use `electric-indent-local-mode'.
Given that electric-indent-mode doesn't know (and doesn't care) about
the major-mode's specific indentation rules, the above explains what
the minor mode itself does, including what is meant by
"reindentation". The rest of the details are in the documentation of
the major modes, and you should look there for more information.
next prev parent reply other threads:[~2022-06-18 6:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 11:59 Tab completion and electric-indent-mode carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-17 14:10 ` [External] : " Drew Adams
2022-06-17 14:14 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-17 15:33 ` Eli Zaretskii
2022-06-18 3:45 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-18 6:44 ` Eli Zaretskii [this message]
2022-06-18 8:05 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-18 8:17 ` Eli Zaretskii
2022-06-18 15:35 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-18 16:20 ` Eli Zaretskii
2022-06-18 9:15 ` Eric S Fraga
2022-06-19 2:26 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-06-22 10:46 ` Eric S Fraga
2022-06-18 23:10 ` Drew Adams
2022-06-18 23:19 ` Drew Adams
2022-06-17 17:41 ` Emanuel Berg
2022-06-18 4:20 ` carlmarcos--- via Users list for the GNU Emacs text editor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83pmj6o4gk.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).