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: Doug Maxey <pops <at> maxeygroup.tech>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Doug Maxey <emacs-bugs <at> maxeygroup.tech>, 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: Sun, 06 Feb 2022 18:14:45 -0600
[Message part 1 (text/plain, inline)]
On Sun, 2022-02-06 at 19:11 -0500, Stefan Monnier wrote:
> > (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".
> 
> We should indeed only skip over "then", and then only over ";" and
> then
> only over "test".
> 
> > 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.
> 
> The sh syntax is fairly nasty to parse, especially backwards, so I
> can't
> give you any general comment here.  I'd try something and then see if
> it
> breaks any tests (including looking at test/manual/indent/shell.sh).
> 
> For sure, I'd recommend adding a regression test.

just a further point, if it helps, this was fine in 27.2.
 
> 
> 
>         Stefan
> 

[Message part 2 (text/html, inline)]
[signature.asc (application/pgp-signature, inline)]

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

Previous Next


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