From: Richard M. Stallman Date: Sat, 22 Mar 1997 03:53:10 +0000 (+0000) Subject: (sh-case): Define with defun and defvar X-Git-Tag: emacs-20.1~2732 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ff9c168275d2c088e5aa0b3a0f84e9d3be62b93b;p=emacs.git (sh-case): Define with defun and defvar instead of define-skeleton. --- diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 7e0e0e32bfb..da6951b6f8a 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -929,47 +929,54 @@ region, clear header." ;; You are welcome to add the syntax or even completely new statements as ;; appropriate for your favorite shell. -(define-skeleton sh-case - "Insert a case/switch statement. See `sh-feature'." - (csh "expression: " - "switch( " str " )" \n - > "case " (read-string "pattern: ") ?: \n - > _ \n - "breaksw" \n - ( "other pattern, %s: " - < "case " str ?: \n +;; This defun is the same as what define-skeleton does, +;; but by putting the data in a variable named sh-case, +;; we make it possible to use that variable in the menu-enable property. +(defun sh-case (&optional str arg) + (interactive "*P\nP") + (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) - < "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 - resume: - < < ?}) - (sh "expression: " - "case " str " in" \n - > (read-string "pattern: ") ?\) \n - > _ \n - ";;" \n - ( "other pattern, %s: " - < str ?\) \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 - ";;" \n) - < "*)" \n - > _ \n - resume: - < < "esac")) -(put 'sh-case 'menu-enable '(sh-feature sh-case)) + ( "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")) + "Insert a case/switch statement. See `sh-feature'.")