Subject: bug#78592: 30.1; sh-mode variable sh-indent-comment does not work

From: Stefan Monnier <[email-masked]>
Date: Thu, 29 May 2025 17:20:17 -0400

>> sh-mode variable sh-indent-comment does not work any more. Setting it to
>> nil or a number does not seem to
>> have any effect when indenting a comment in a shell script.
>> 
>> Looking at sh-script.el it only seems to be referenced in sh-var-list
>> The same also seems to apply to the sh-mode variables
>> sh-first-lines-indent
>> sh-indent-for-else

Indeed, these vars were not ported over to the new SMIE-based indentation code.

>> Should it be marked as obsolete (or deleted)? Should it be removed from sh-var-list

I think so, yes.

> Stefan, this seems to be due to your cleanup of sh-script's
> indentation in
>
>  commit f9504ffba2e2604338c243dd77c877bbb8162e4a
>  Author:     Stefan Monnier <[email-masked]>
>  AuthorDate: Mon Feb 3 15:26:59 2020 -0500
>  Commit:     Stefan Monnier <[email-masked]>
>  CommitDate: Mon Feb 3 15:26:59 2020 -0500
>
>  * lisp/progmodes/sh-script.el: Remove old non-SMIE indentation code
>
> Are these variables really no-ops now?

Yes.

> I don't see that in NEWS in any release of Emacs except this in
> NEWS.28:

They were already no-ops when using SMIE indentation before that change,
so in a sense it is implied by "The old non-SMIE indentation of
'sh-mode' has been removed", but we should have removed those vars at
the same time.

I just hadn't noticed that nobody complained about the lack of support
for those vars, so the new code was never adjusted to obey them.

>   ** The old non-SMIE indentation of 'sh-mode' has been removed.
>
> What, if anything, can users do now to control indentation of comment
> lines in sh-mode?

There's no easy/convenient way to do it.
They have to add a new function on `smie-indent-function` that provides
the indentation they want (or advise `smie-indent-comment`, or replace
this function on that list with another one).

        Stefan