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

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

Re: [External] : Tab completion and electric-indent-mode


From: Eli Zaretskii
Subject: Re: [External] : Tab completion and electric-indent-mode
Date: Sat, 18 Jun 2022 19:20:57 +0300

> Date: Sat, 18 Jun 2022 17:35:45 +0200 (CEST)
> From: carlmarcos@tutanota.com
> Cc: help-gnu-emacs@gnu.org
> 
>  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.
> 
>  How can a user get that information, are there commands for that?
> 
>  The commands for that are the usual Help commands, but you need to
>  apply them to the major mode you are interested in.
> 
> Can you provide an example?  I could not find a list of all the
> programming major-modes in emacs manual.
> 
> Called "C-h f mhtml-mode" for instance, which never discusses any
> indentation rules.

The doc string of mhtml-mode says:

  Code inside a <script> element is indented using the rules from
  ‘js-mode’; and code inside a <style> element is indented using
  the rules from ‘css-mode’.

> For embedded JS, the documentation says that
> code elements are indented using the rules from ‘js-mode’.  But
> then, doing "M-h f js-mode" does not describe any indentation
> rules.

Maybe you should tell what exactly do you mean by "indentation rules",
then.  What kind of explanations do you expect to see about
indentation rules in some arbitrary major mode?

In general, indentation provided by any major mode is "as expected by
the user", and Emacs gives you customizable options to control the
various parameters of the indentation.  For example, for  css-mode
type "M-x customize-group RET css RET" and review the options.  Two
options there seem to be relevant to the issue being discussed:
css-electric-keys and css-indent-offset.  That's about all users need
to know about "indentation rules" in css-mode; if you want to know
more detail, read the source.

>  By "reindent" we mean remove any existing indentation, and then
>  indent the line according to context and rules of the major mode.
> 
>  Can there be a clarification that reindentation removes the existing 
> indentation
>  with new indentation rules applied?
> 
>  ??? Isn't the above saying precisely that? Or maybe I don't understand
>  what you need clarified?
> 
> By the definition of "re-" meaning "again"?  Thus re-indent
> corresponds to indent again.  Ok

Yes.



reply via email to

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