From c410bd65f5cb14d844f6894206c408c4011d48ed Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 22 Apr 1997 04:37:22 +0000 Subject: [PATCH] (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. --- lisp/progmodes/sh-script.el | 82 ++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 78fbb0a9599..3124d59bffb 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -322,7 +322,7 @@ See `sh-feature'." :group 'sh-script) -(defcustom sh-assignment-prefix +(defcustom sh-assignment-regexp '((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") ;; actually spaces are only supported in let/(( ... )) (ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=") @@ -1001,56 +1001,46 @@ region, clear header." ;; You are welcome to add the syntax or even completely new statements as ;; appropriate for your favorite shell. -;; 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 - ( "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 +(define-skeleton sh-case + "Insert a case/switch statement. See `sh-feature'." + ((csh "expression: " + "switch( " str " )" \n + > "case " (read-string "pattern: ") ?: \n > _ \n - resume: - < < ?}) - (sh "expression: " - "case " str " in" \n - > (read-string "pattern: ") ?\) \n - > _ \n - ";;" \n + "breaksw" \n ( "other pattern, %s: " - < str ?\) \n + < "case " str ?: \n > _ \n - ";;" \n) - < "*)" \n + "breaksw" \n) + < "default:" \n > _ \n resume: - < < "esac")) - "Insert a case/switch statement. See `sh-feature'.") - - + < < "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 + > _ \n + ";;" \n) + < "*)" \n + > _ \n + resume: + < < "esac"))) (define-skeleton sh-for "Insert a for loop. See `sh-feature'." -- 2.39.2