GNU bug report logs - #753
[Fwd: sh-script.el: indentation of ( )]

Previous Next

Package: emacs;

Reported by: occitan <at> esperanto.org

Date: Wed, 20 Aug 2008 21:45:04 UTC

Severity: normal

Tags: unreproducible

Done: Andrew Hyatt <ahyatt <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #39 received at 753 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 753 <at> debbugs.gnu.org
Subject: Re: bug#753: [Fwd: sh-script.el: indentation of ( )]
Date: Thu, 08 Jan 2009 22:58:08 -0500
>> Basically, what I saw is that it recognized "done|" as a keyword,
>> which I fixed by adding ?| to the "not in keywords" chars. By the
>> same reasonging "done)" is not a keyword, so I added ?\) (and ?\( as
>> well for good measure).

> Adding them causes the problem you are trying to avoid.

I don't follow you.

> Applying (skip-chars-forward "^ \t\n;&|")
> to "done) "
> results in "done)", which is not a recognized keyword.

So does the original code (skip-chars-forward "^ \t\n;&"), but so
doesn't my code (skip-chars-forward "^ \t\n;&|()").  In this sense my
code did make things more correct.

>> I guess that sh-get-kw should be fixed more robustly by recognizing
>> ")" and "(" but not "(done", nor "(done|toto)" for that matter. Can
>> you take care of that and make sure it fixes the problem at hand
>> without breaking the problem that prompted my misguided fix?

> It's tricky. Consider the following two examples:

> for f in 1; do
>     case $f in
>         done) echo t ;;
>     esac
> done


> (for f in 1; do
>    echo $f
> done)

> In the second one, "done)" ends a for loop, in the first one it does not.

It doesn't matter.  "done)" is not an entity in `sh', so we should not
treat it as one.  After all if you replace "done)" with "done )" in the
above 2 scripts, they still mean the same.

> Both Emacs 22.3 and the current CVS get both examples wrong, in
> different ways.

Yes, but it's a due to different bug than the one at hand, IIUC.


        Stefan




This bug report was last modified 9 years and 136 days ago.

Previous Next


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