GNU bug report logs - #78592
30.1; sh-mode variable sh-indent-comment does not work

Previous Next

Package: emacs;

Reported by: richard newton <richardn26 <at> gmail.com>

Date: Mon, 26 May 2025 14:41:01 UTC

Severity: normal

Found in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 78592 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78592; Package emacs. (Mon, 26 May 2025 14:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to richard newton <richardn26 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 26 May 2025 14:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: richard newton <richardn26 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; sh-mode variable sh-indent-comment does not work
Date: Mon, 26 May 2025 15:40:19 +0200
[Message part 1 (text/plain, inline)]
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

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

The same also seems to apply to the sh-mode variables
sh-first-lines-indent
sh-indent-for-else

In GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.49,
 cairo version 1.18.4) of 2025-03-30, modified by Debian built on sbuild
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/libexec --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-pgtk
 'CFLAGS=-g -O2 -Werror=implicit-function-declaration
 -ffile-prefix-map=/build/reproducible-path/emacs-30.1+1=.
 -fstack-protector-strong -fstack-clash-protection -Wformat
 -Werror=format-security -fcf-protection -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  server-mode: t
  which-function-mode: t
  global-cwarn-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums face-remap help-macro package-x
package url-handlers emacs-news-mode noutline outline tabify man etags
fileloop generator xref project view pcase shell pcomplete compare-w
diff-mode track-changes yank-media mhtml-mode css-mode eww xdg url-queue
shr pixel-fill kinsoku url-file svg xml mm-url gnus nnheader gnus-util
mail-utils range mm-util mail-prsvr color js c-ts-common conf-mode
rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap sgml-mode facemenu dom nxml-util nxml-enc
xmltok debug backtrace cal-menu calendar cal-loaddefs jka-compr
find-func gnutls network-stream puny nsm warnings easy-mmode cl-print
rcirc parse-time iso8601 apropos time-date compile comint ansi-osc
ansi-color ring comp-run shortdoc text-property-search comp-common erc
format-spec erc-backend erc-networks erc-common erc-compat compat
erc-loaddefs help-fns radix-tree rot13 disp-table epa-file epa derived
epg rfc6068 epg-config browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util url-parse auth-source eieio eieio-core cl-macs password-cache
json subr-x map url-vars mailcap cl-extra help-mode edmacro kmacro
byte-opt gv bytecomp byte-compile thingatpt misearch multi-isearch
mule-util display-line-numbers sh-script rx smie treesit executable
dired-aux add-log server cl-seq which-func imenu cus-start dired
dired-loaddefs cwarn cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs cus-edit pp cus-load icons
wid-edit cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 868468 161855) (symbols 48 23300 0)
  (strings 32 96041 7003) (string-bytes 1 4003228) (vectors 16 48843)
  (vector-slots 8 1448049 118949) (floats 8 313 9292)
  (intervals 56 80852 2722) (buffers 992 108))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78592; Package emacs. (Thu, 29 May 2025 09:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 78592 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: richard newton <richardn26 <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 78592 <at> debbugs.gnu.org
Subject: Re: bug#78592: 30.1; sh-mode variable sh-indent-comment does not work
Date: Thu, 29 May 2025 12:11:04 +0300
> From: richard newton <richardn26 <at> gmail.com>
> Date: Mon, 26 May 2025 15:40:19 +0200
> 
> 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
> 
> Should it be marked as obsolete (or deleted)? Should it be removed from sh-var-list
> 
> The same also seems to apply to the sh-mode variables
> sh-first-lines-indent
> sh-indent-for-else

Stefan, this seems to be due to your cleanup of sh-script's indentation
in

 commit f9504ffba2e2604338c243dd77c877bbb8162e4a
 Author:     Stefan Monnier <monnier <at> iro.umontreal.ca>
 AuthorDate: Mon Feb 3 15:26:59 2020 -0500
 Commit:     Stefan Monnier <monnier <at> iro.umontreal.ca>
 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?  I don't see that in NEWS in
any release of Emacs except this in NEWS.28:

  ** 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78592; Package emacs. (Thu, 29 May 2025 21:21:02 GMT) Full text and rfc822 format available.

Message #11 received at 78592 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78592 <at> debbugs.gnu.org, richard newton <richardn26 <at> gmail.com>
Subject: Re: bug#78592: 30.1; sh-mode variable sh-indent-comment does not work
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 <monnier <at> iro.umontreal.ca>
>  AuthorDate: Mon Feb 3 15:26:59 2020 -0500
>  Commit:     Stefan Monnier <monnier <at> iro.umontreal.ca>
>  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





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 31 May 2025 12:12:03 GMT) Full text and rfc822 format available.

Notification sent to richard newton <richardn26 <at> gmail.com>:
bug acknowledged by developer. (Sat, 31 May 2025 12:12:03 GMT) Full text and rfc822 format available.

Message #16 received at 78592-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 78592-done <at> debbugs.gnu.org, richardn26 <at> gmail.com
Subject: Re: bug#78592: 30.1; sh-mode variable sh-indent-comment does not work
Date: Sat, 31 May 2025 15:11:21 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: richard newton <richardn26 <at> gmail.com>,  78592 <at> debbugs.gnu.org
> 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 <monnier <at> iro.umontreal.ca>
> >  AuthorDate: Mon Feb 3 15:26:59 2020 -0500
> >  Commit:     Stefan Monnier <monnier <at> iro.umontreal.ca>
> >  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).

OK, so I've now removed these variables, and I'm closing this bug.




This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.