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

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

bug#20846: 24.4; Electric-indent-mode does not call indent-line-function


From: Stefan Monnier
Subject: bug#20846: 24.4; Electric-indent-mode does not call indent-line-function after hitting RET inside a comment
Date: Sat, 29 May 2021 09:24:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lars Ingebrigtsen [2021-05-29 04:26:29] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> The (nth 8 (syntax-ppss)) test has been in `electric-indent-mode` from
>> the very beginning, but I must say I can't remember why I put it in,
>> I think it was a mistake and we should remove it.
>
> This bit?
>
>     (when (and
> [...]
>                (not
>                 (or (memq act '(nil no-indent))
>                     ;; In a string or comment.
>                     (unless (eq act 'do-indent) (nth 8 (syntax-ppss))))))))
>
>
> Uhm...  I stared at that logic for a couple of minutes, but I'm still
> not able to convince myself that I understand it,

The logic here is that the functions on the hook can return either nil
to mean "indent, of course" or `no-indent` or `do-indent` where this
last one overrides the default "don't indent inside a string or comment"
(and it also overrides potential other functions on that hook which
might have said `no-indent`).

> so could you do the necessary here?  :-)

Done.  Can we close this bug?


        Stefan






reply via email to

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