GNU bug report logs - #23004
24.5; Why double intent do sh-script.el after "then" statement?

Previous Next

Package: emacs;

Reported by: Oleksandr Gavenko <gavenkoa <at> gmail.com>

Date: Sun, 13 Mar 2016 09:35:01 UTC

Severity: normal

Tags: confirmed, fixed, patch

Merged with 21751, 24337

Found in versions 24.5, 25.1

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23004 in the body.
You can then email your comments to 23004 AT debbugs.gnu.org in the normal way.

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#23004; Package emacs. (Sun, 13 Mar 2016 09:35:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleksandr Gavenko <gavenkoa <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 13 Mar 2016 09:35:01 GMT) Full text and rfc822 format available.

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

From: Oleksandr Gavenko <gavenkoa <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; Why double intent do sh-script.el after "then" statement?
Date: Sun, 13 Mar 2016 11:34:07 +0200
In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.2)
 of 2015-10-24 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11702000
System Description:	Debian GNU/Linux testing (stretch)

  $ emacs -q

  M-x sh-mode RET
  M-: (setq sh-basic-offset 2) RET

  if true; then
      <==TAB  4 spaces!!
  else
    <==TAB  2 spaces
  fi

  if true;
  then
      <==TAB  4 spaces!!
  fi

With default 4 offset indent proper after "then" and "else", but changing
`sh-basic-offset' doesn't effect on indent level after "then".

I check:

  /usr/share/emacs/24.5/lisp/progmodes/sh-script.el.gz

  (defun sh-smie-sh-rules (kind token)
    ....
    ;; Attempt at backward compatibility with the old config variables.
    (`(:before . "fi") (sh-var-value 'sh-indent-for-fi))
    (`(:before . "done") (sh-var-value 'sh-indent-for-done))
    (`(:after . "else") (sh-var-value 'sh-indent-after-else))
    (`(:after . "if") (sh-var-value 'sh-indent-after-if))
    (`(:before . "then") (sh-var-value 'sh-indent-for-then))
    (`(:before . "do") (sh-var-value 'sh-indent-for-do))
    (`(:after . "do")
     (sh-var-value (if (smie-rule-hanging-p)
                       'sh-indent-after-loop-construct 'sh-indent-after-do)))
    ;; sh-indent-after-done: aligned completely differently.
    (`(:after . "in") (sh-var-value 'sh-indent-for-case-label))
    ;; sh-indent-for-continuation: Line continuations are handled differently.
    (`(:after . ,(or `"(" `"{" `"[")) (sh-var-value 'sh-indent-after-open))

I see no (:after . "then") but:

    (`(:after . "else") (sh-var-value 'sh-indent-after-else))
    (`(:before . "then") (sh-var-value 'sh-indent-for-then))

I would like to control indenting after "then" statement. Please add
customisation:

  (defcustom sh-indent-after-then '+
    "How much to indent a statement after an `then' statement."
    :type `(choice ,@ sh-number-or-symbol-list )
    :group 'sh-indentation)

-- 
http://defun.work/




Forcibly Merged 21751 23004. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 03 Jul 2016 01:09:01 GMT) Full text and rfc822 format available.

Forcibly Merged 21751 23004 24337. Request was from Alex <agrambot <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 09 Sep 2016 17:19:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 26 Aug 2017 12:18:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 30 Aug 2017 23:49:02 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Mon, 25 Sep 2017 23:44:04 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 21751 <at> debbugs.gnu.org and Bob Proulx <bob <at> proulx.com> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Mon, 25 Sep 2017 23:44:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Oct 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 241 days ago.

Previous Next


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