Mercurial > emacs
comparison lisp/progmodes/sh-script.el @ 17531:b891e41b4011
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 22 Apr 1997 04:37:22 +0000 |
parents | 478f9bb8575c |
children | 58afe194f1bd |
comparison
equal
deleted
inserted
replaced
17530:9fb83ef40566 | 17531:b891e41b4011 |
---|---|
320 (const :format "" eval) | 320 (const :format "" eval) |
321 sexp)))) | 321 sexp)))) |
322 :group 'sh-script) | 322 :group 'sh-script) |
323 | 323 |
324 | 324 |
325 (defcustom sh-assignment-prefix | 325 (defcustom sh-assignment-regexp |
326 '((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") | 326 '((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") |
327 ;; actually spaces are only supported in let/(( ... )) | 327 ;; actually spaces are only supported in let/(( ... )) |
328 (ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=") | 328 (ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=") |
329 (rc . "\\<\\([a-zA-Z0-9_*]+\\)[ \t]*=") | 329 (rc . "\\<\\([a-zA-Z0-9_*]+\\)[ \t]*=") |
330 (sh . "\\<\\([a-zA-Z0-9_]+\\)=")) | 330 (sh . "\\<\\([a-zA-Z0-9_]+\\)=")) |
999 ;; statement syntax-commands for various shells | 999 ;; statement syntax-commands for various shells |
1000 | 1000 |
1001 ;; You are welcome to add the syntax or even completely new statements as | 1001 ;; You are welcome to add the syntax or even completely new statements as |
1002 ;; appropriate for your favorite shell. | 1002 ;; appropriate for your favorite shell. |
1003 | 1003 |
1004 ;; This defun is the same as what define-skeleton does, | 1004 (define-skeleton sh-case |
1005 ;; but by putting the data in a variable named sh-case, | 1005 "Insert a case/switch statement. See `sh-feature'." |
1006 ;; we make it possible to use that variable in the menu-enable property. | 1006 ((csh "expression: " |
1007 (defun sh-case (&optional str arg) | 1007 "switch( " str " )" \n |
1008 (interactive "*P\nP") | 1008 > "case " (read-string "pattern: ") ?: \n |
1009 (skeleton-proxy-new sh-case str arg)) | |
1010 (put 'sh-case 'menu-enable '(sh-feature sh-case)) | |
1011 | |
1012 (defvar sh-case | |
1013 '((csh "expression: " | |
1014 "switch( " str " )" \n | |
1015 > "case " (read-string "pattern: ") ?: \n | |
1016 > _ \n | |
1017 "breaksw" \n | |
1018 ( "other pattern, %s: " | |
1019 < "case " str ?: \n | |
1020 > _ \n | |
1021 "breaksw" \n) | |
1022 < "default:" \n | |
1023 > _ \n | |
1024 resume: | |
1025 < < "endsw") | |
1026 (es) | |
1027 (rc "expression: " | |
1028 "switch( " str " ) {" \n | |
1029 > "case " (read-string "pattern: ") \n | |
1030 > _ \n | 1009 > _ \n |
1010 "breaksw" \n | |
1031 ( "other pattern, %s: " | 1011 ( "other pattern, %s: " |
1032 < "case " str \n | 1012 < "case " str ?: \n |
1033 > _ \n) | 1013 > _ \n |
1034 < "case *" \n | 1014 "breaksw" \n) |
1015 < "default:" \n | |
1035 > _ \n | 1016 > _ \n |
1036 resume: | 1017 resume: |
1037 < < ?}) | 1018 < < "endsw") |
1038 (sh "expression: " | 1019 (es) |
1039 "case " str " in" \n | 1020 (rc "expression: " |
1040 > (read-string "pattern: ") ?\) \n | 1021 "switch( " str " ) {" \n |
1041 > _ \n | 1022 > "case " (read-string "pattern: ") \n |
1042 ";;" \n | 1023 > _ \n |
1043 ( "other pattern, %s: " | 1024 ( "other pattern, %s: " |
1044 < str ?\) \n | 1025 < "case " str \n |
1045 > _ \n | 1026 > _ \n) |
1046 ";;" \n) | 1027 < "case *" \n |
1047 < "*)" \n | 1028 > _ \n |
1048 > _ \n | 1029 resume: |
1049 resume: | 1030 < < ?}) |
1050 < < "esac")) | 1031 (sh "expression: " |
1051 "Insert a case/switch statement. See `sh-feature'.") | 1032 "case " str " in" \n |
1052 | 1033 > (read-string "pattern: ") ?\) \n |
1053 | 1034 > _ \n |
1035 ";;" \n | |
1036 ( "other pattern, %s: " | |
1037 < str ?\) \n | |
1038 > _ \n | |
1039 ";;" \n) | |
1040 < "*)" \n | |
1041 > _ \n | |
1042 resume: | |
1043 < < "esac"))) | |
1054 | 1044 |
1055 (define-skeleton sh-for | 1045 (define-skeleton sh-for |
1056 "Insert a for loop. See `sh-feature'." | 1046 "Insert a for loop. See `sh-feature'." |
1057 (csh eval sh-modify sh | 1047 (csh eval sh-modify sh |
1058 1 "foreach " | 1048 1 "foreach " |