Commit c410bd65 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(sh-case): Make this a simple define-skeleton

as it was originally.  Don't add a menu-enable property.
(sh-assignment-regexp): Renamed from sh-assignment-prefix
undoing a renaming made by mistake.
parent c60e7b0d
...@@ -322,7 +322,7 @@ See `sh-feature'." ...@@ -322,7 +322,7 @@ See `sh-feature'."
:group 'sh-script) :group 'sh-script)
(defcustom sh-assignment-prefix (defcustom sh-assignment-regexp
'((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") '((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=")
;; actually spaces are only supported in let/(( ... )) ;; actually spaces are only supported in let/(( ... ))
(ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=") (ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=")
...@@ -1001,56 +1001,46 @@ region, clear header." ...@@ -1001,56 +1001,46 @@ region, clear header."
;; You are welcome to add the syntax or even completely new statements as ;; You are welcome to add the syntax or even completely new statements as
;; appropriate for your favorite shell. ;; appropriate for your favorite shell.
;; This defun is the same as what define-skeleton does, (define-skeleton sh-case
;; but by putting the data in a variable named sh-case, "Insert a case/switch statement. See `sh-feature'."
;; we make it possible to use that variable in the menu-enable property. ((csh "expression: "
(defun sh-case (&optional str arg) "switch( " str " )" \n
(interactive "*P\nP") > "case " (read-string "pattern: ") ?: \n
(skeleton-proxy-new sh-case str arg))
(put 'sh-case 'menu-enable '(sh-feature sh-case))
(defvar sh-case
'((csh "expression: "
"switch( " str " )" \n
> "case " (read-string "pattern: ") ?: \n
> _ \n
"breaksw" \n
( "other pattern, %s: "
< "case " str ?: \n
> _ \n
"breaksw" \n)
< "default:" \n
> _ \n
resume:
< < "endsw")
(es)
(rc "expression: "
"switch( " str " ) {" \n
> "case " (read-string "pattern: ") \n
> _ \n
( "other pattern, %s: "
< "case " str \n
> _ \n)
< "case *" \n
> _ \n > _ \n
resume: "breaksw" \n
< < ?})
(sh "expression: "
"case " str " in" \n
> (read-string "pattern: ") ?\) \n
> _ \n
";;" \n
( "other pattern, %s: " ( "other pattern, %s: "
< str ?\) \n < "case " str ?: \n
> _ \n > _ \n
";;" \n) "breaksw" \n)
< "*)" \n < "default:" \n
> _ \n > _ \n
resume: resume:
< < "esac")) < < "endsw")
"Insert a case/switch statement. See `sh-feature'.") (es)
(rc "expression: "
"switch( " str " ) {" \n
> "case " (read-string "pattern: ") \n
> _ \n
( "other pattern, %s: "
< "case " str \n
> _ \n)
< "case *" \n
> _ \n
resume:
< < ?})
(sh "expression: "
"case " str " in" \n
> (read-string "pattern: ") ?\) \n
> _ \n
";;" \n
( "other pattern, %s: "
< str ?\) \n
> _ \n
";;" \n)
< "*)" \n
> _ \n
resume:
< < "esac")))
(define-skeleton sh-for (define-skeleton sh-for
"Insert a for loop. See `sh-feature'." "Insert a for loop. See `sh-feature'."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment