GNU bug report logs - #7947
Does sh-script.el recognize new case grammar ;& and ;;& ?

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Mon, 31 Jan 2011 12:56:01 UTC

Severity: normal

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

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 7947 in the body.
You can then email your comments to 7947 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7947; Package emacs. (Mon, 31 Jan 2011 12:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 31 Jan 2011 12:56:01 GMT) Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: Does sh-script.el recognize new case grammar ;& and ;;& ?
Date: Mon, 31 Jan 2011 20:50:42 +0800
Does sh-script.el indenting recognize new case - esac grammar ;& and ;;& ?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7947; Package emacs. (Mon, 31 Jan 2011 15:28:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: 7947 <at> debbugs.gnu.org
Subject: Re: bug#7947: Does sh-script.el recognize new case grammar ; & and ; ;
	& ?
Date: Mon, 31 Jan 2011 10:35:31 -0500
> Does sh-script.el indenting recognize new case - esac grammar ;& and ;;& ?

If you ask, I'd guess it doesn't (at least, I hadn't heard about it
until now, I don't know what it's about, I can't remember sh-script.el
mentioning something about it, and I can't remember seeing a "recent"
commit to sh-script.el about something related).  Do you have
a reference describing what it means, and maybe some sample code showing
the current indentation result and the one you'd like to have instead?


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7947; Package emacs. (Mon, 31 Jan 2011 22:42:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7947 <at> debbugs.gnu.org
Subject: Re: bug#7947: Does sh-script.el recognize new case grammar ; & and ; ;
	& ?
Date: Mon, 31 Jan 2011 17:50:00 -0500
Stefan Monnier wrote:

> Do you have a reference describing what it means

http://tiswww.case.edu/php/chet/bash/NEWS

This is a terse description of the new features added to bash-4.0
[...]

ee. The new `;&' case statement action list terminator causes
    execution to continue with the action associated with the next
    pattern in the statement rather than terminating the command.

ff. The new `;;&' case statement action list terminator causes the
    shell to test the next set of patterns after completing execution
    of the current action, rather than terminating the command.


So basically they can appear in place of ';;' and should be treated
exactly the same as ';;'.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7947; Package emacs. (Tue, 01 Feb 2011 00:08:02 GMT) Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: monnier <at> iro.umontreal.ca
Cc: 7947 <at> debbugs.gnu.org
Subject: Re: bug#7947: Does sh-script.el recognize new case grammar ; & and ; ;
	& ?
Date: Tue, 01 Feb 2011 08:15:36 +0800
>>>>> "SM" == Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
SM> a reference describing what it means

$ man bash|grep ';&'
              matches are attempted after the first pattern match.  Using ;& in place of ;; causes execution to continue
              with the list associated with the next set of patterns.  Using ;;& in place of ;; causes the shell to test
Also on Debian in /usr/share/doc/abs-guide/examples/case4.sh

All I know is indenting seems funny around them when using emacs'
sh-script.el .




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7947; Package emacs. (Tue, 01 Feb 2011 17:49:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: 7947 <at> debbugs.gnu.org
Subject: Re: bug#7947: Does sh-script.el recognize new case grammar ; & and ; ;
	& ?
Date: Tue, 01 Feb 2011 12:56:23 -0500
SM> a reference describing what it means

> $ man bash|grep ';&'
>               matches are attempted after the first pattern match.  Using ;&
> in place of ;; causes execution to continue
>               with the list associated with the next set of patterns.
> Using ;;& in place of ;; causes the shell to test
> Also on Debian in /usr/share/doc/abs-guide/examples/case4.sh

> All I know is indenting seems funny around them when using emacs'
> sh-script.el .

Does the patch below fix things for you?


        Stefan


=== modified file 'lisp/progmodes/sh-script.el'
--- lisp/progmodes/sh-script.el	2011-01-26 08:36:39 +0000
+++ lisp/progmodes/sh-script.el	2011-02-01 17:55:26 +0000
@@ -1104,7 +1104,7 @@
                  ;; a normal command rather than the real `in' keyword.
                  ;; I.e. we should look back to try and find the
                  ;; corresponding `case'.
-                 (looking-at ";;\\|in"))
+                 (looking-at ";[;&]\\|in"))
       sh-st-punc)))
 
 (defun sh-font-lock-backslash-quote ()
@@ -1659,6 +1659,8 @@
      ("esac" sh-handle-this-esac sh-handle-prev-esac)
      (case-label nil sh-handle-after-case-label) ;; ???
      (";;" nil sh-handle-prev-case-alt-end) ;; ???
+     (";;&" nil sh-handle-prev-case-alt-end) ;; ???
+     (";&" nil sh-handle-prev-case-alt-end) ;; ???
      ("done" sh-handle-this-done sh-handle-prev-done)
      ("do" sh-handle-this-do sh-handle-prev-do))
 
@@ -2496,7 +2498,7 @@
                          (sh-prev-line nil)
                        (line-beginning-position))))
       (skip-chars-backward " \t;" min-point)
-      (if (looking-at "\\s-*;;")
+      (if (looking-at "\\s-*;[;&]")
           ;; (message "Found ;; !")
           ";;"
         (skip-chars-backward "^)}];\"'`({[" min-point)





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7947; Package emacs. (Tue, 01 Feb 2011 23:15:02 GMT) Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: monnier <at> iro.umontreal.ca
Cc: 7947 <at> debbugs.gnu.org
Subject: Re: bug#7947: Does sh-script.el recognize new case grammar ; & and ; ;
	& ?
Date: Wed, 02 Feb 2011 07:23:03 +0800
>>>>> "SM" == Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
SM> Does the patch below fix things for you?
I trust it will. Thanks.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Sat, 05 Feb 2011 15:46:02 GMT) Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. (Sat, 05 Feb 2011 15:46:02 GMT) Full text and rfc822 format available.

Message #25 received at 7947-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 7947-done <at> debbugs.gnu.org
Subject: Re: Does sh-script.el recognize new case grammar ;& and ;;& ?
Date: Sat, 05 Feb 2011 10:53:23 -0500
Thanks, committed to trunk,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Mar 2011 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 107 days ago.

Previous Next


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