GNU bug report logs - #53817
28.0.91; sh-mode indent misses on 'if test;then' when 'then' is on 'if' line

Previous Next

Package: emacs;

Reported by: Doug Maxey <emacs-bugs <at> maxeygroup.tech>

Date: Sun, 6 Feb 2022 08:26:02 UTC

Severity: minor

Tags: moreinfo

Found in version 28.0.91

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Doug Maxey <emacs-bugs <at> maxeygroup.tech>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 53817 <at> debbugs.gnu.org
Subject: bug#53817: 28.0.91; sh-mode indent misses on 'if test;then' when 'then' is on 'if' line
Date: Mon, 07 Feb 2022 00:50:49 +0100
Doug Maxey <emacs-bugs <at> maxeygroup.tech> writes:

> However, lots'o bash gets written here, and one of my idioms is:
> <code>
> if test;then
>    do something
> fi
>    ^
> </code>

The problem seems to be here:

(defun sh-smie--default-backward-token ()
[...]
            (progn (skip-syntax-backward ".w_'")
                   (or (not (zerop (skip-syntax-backward "\\")))
                       (when (eq ?\\ (char-before (1- (point))))

Semi-colons have punctuation syntax, so we're skipping back over the
entirety of "test;then" instead of stopping after "then".

This looks easy enough to fix, but the overall logic of that function is
somewhat obscure to me, so I've added Stefan to the comments; perhaps he
has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 101 days ago.

Previous Next


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