GNU bug report logs - #21244
shell-script mode indentation fooled by one-liner 'for' statement

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Wed, 12 Aug 2015 16:33:01 UTC

Severity: minor

Tags: confirmed, patch

Merged with 2910, 26217, 30170, 46093, 48193

Found in versions 25.0.95, 25.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Martin Vath <martin <at> mvath.de>, 26217 <at> debbugs.gnu.org
Subject: Re: bug#2910: 23.0.60; Shell-script coloring bug
Date: Sat, 14 Oct 2023 09:44:37 -0300
[Message part 1 (text/plain, inline)]
tags 26217 patch
quit


On 13/10/23 13:06, Stefan Monnier wrote:
>> I don't know what's the decision (if there is one) about situations like
>> these.  If the bugs in lang-mode are fixed by lang-ts-mode, will these
>> bug reports be treated as: wontfix? fixed? open in case someone wants to
>> spend time in lang-mode?
>
> AFAIK we don't consider the `foo-ts-mode` to obsolete the other modes.
> Maybe we will, but we don't yet.  IMO I think we'd first need to have
> a good long-term strategy about what we'll do when tree-sitter becomes
> unmaintained/obsolete.  IOW I think we need to develop our own layer of
> abstraction above tree-sitter so that we can accommodate other
> parser backends.
>
> FWIW, it's not clear at all what such a layer would look like, so we're
> pretty far from it.  I'd welcome people start thinking about it, maybe
> by looking at existing alternatives like our own `wisi` (in GNU ELPA),
> SMIE, maybe LSP (assuming there are servers out there which can provide
> that kind of functionality), etc...

Thank you for your response.  I don't know if this has been raised in
emacs-devel, but IMO it should be.

>> - Wrong indentation for lines after:
>> for i do echo 1; done
>>
>> I took a look at this, and ISTM that giving "do" a special treatment
>> like sh-smie--sh-keyword-p gives to "in" might fix this, perhaps by
>> reusing sh-smie--sh-keyword-in-p.
>
> Sounds about right.

I attach a patch that should also handle the fontification issue. It
also comes with some tests, and I've did some manual testing on my own.
I haven't found problems, but I'm suspicious because it seems too easy.
[0001-Fix-indentation-and-fontification-in-shell-script-Bu.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 221 days ago.

Previous Next


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