unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
@ 2011-01-31 12:50 jidanni
  2011-01-31 15:35 ` Stefan Monnier
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: jidanni @ 2011-01-31 12:50 UTC (permalink / raw)
  To: 7947

Does sh-script.el indenting recognize new case - esac grammar ;& and ;;& ?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
  2011-01-31 12:50 bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ? jidanni
@ 2011-01-31 15:35 ` Stefan Monnier
  2011-01-31 22:50   ` Glenn Morris
  2011-02-01  0:15 ` jidanni
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2011-01-31 15:35 UTC (permalink / raw)
  To: jidanni; +Cc: 7947

> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
  2011-01-31 15:35 ` Stefan Monnier
@ 2011-01-31 22:50   ` Glenn Morris
  0 siblings, 0 replies; 7+ messages in thread
From: Glenn Morris @ 2011-01-31 22:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7947

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 ';;'.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
  2011-01-31 12:50 bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ? jidanni
  2011-01-31 15:35 ` Stefan Monnier
@ 2011-02-01  0:15 ` jidanni
  2011-02-01 17:56   ` Stefan Monnier
  2011-02-01 23:23 ` jidanni
  2011-02-05 15:53 ` Stefan Monnier
  3 siblings, 1 reply; 7+ messages in thread
From: jidanni @ 2011-02-01  0:15 UTC (permalink / raw)
  To: monnier; +Cc: 7947

>>>>> "SM" == Stefan Monnier <monnier@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 .





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
  2011-02-01  0:15 ` jidanni
@ 2011-02-01 17:56   ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2011-02-01 17:56 UTC (permalink / raw)
  To: jidanni; +Cc: 7947

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)






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
  2011-01-31 12:50 bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ? jidanni
  2011-01-31 15:35 ` Stefan Monnier
  2011-02-01  0:15 ` jidanni
@ 2011-02-01 23:23 ` jidanni
  2011-02-05 15:53 ` Stefan Monnier
  3 siblings, 0 replies; 7+ messages in thread
From: jidanni @ 2011-02-01 23:23 UTC (permalink / raw)
  To: monnier; +Cc: 7947

>>>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
SM> Does the patch below fix things for you?
I trust it will. Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?
  2011-01-31 12:50 bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ? jidanni
                   ` (2 preceding siblings ...)
  2011-02-01 23:23 ` jidanni
@ 2011-02-05 15:53 ` Stefan Monnier
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2011-02-05 15:53 UTC (permalink / raw)
  To: 7947-done

Thanks, committed to trunk,


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-05 15:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-31 12:50 bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ? jidanni
2011-01-31 15:35 ` Stefan Monnier
2011-01-31 22:50   ` Glenn Morris
2011-02-01  0:15 ` jidanni
2011-02-01 17:56   ` Stefan Monnier
2011-02-01 23:23 ` jidanni
2011-02-05 15:53 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).