aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-03-22 03:53:10 +0000
committerRichard M. Stallman1997-03-22 03:53:10 +0000
commitff9c168275d2c088e5aa0b3a0f84e9d3be62b93b (patch)
treeb874113e480c2c0d08d1d6ae8e6c8425cfbb6289
parent14b6a8e10468b71d99fd27468d1191e908d919e9 (diff)
downloademacs-ff9c168275d2c088e5aa0b3a0f84e9d3be62b93b.tar.gz
emacs-ff9c168275d2c088e5aa0b3a0f84e9d3be62b93b.zip
(sh-case): Define with defun and defvar
instead of define-skeleton.
-rw-r--r--lisp/progmodes/sh-script.el85
1 files changed, 46 insertions, 39 deletions
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."
929;; You are welcome to add the syntax or even completely new statements as 929;; You are welcome to add the syntax or even completely new statements as
930;; appropriate for your favorite shell. 930;; appropriate for your favorite shell.
931 931
932(define-skeleton sh-case 932;; This defun is the same as what define-skeleton does,
933 "Insert a case/switch statement. See `sh-feature'." 933;; but by putting the data in a variable named sh-case,
934 (csh "expression: " 934;; we make it possible to use that variable in the menu-enable property.
935 "switch( " str " )" \n 935(defun sh-case (&optional str arg)
936 > "case " (read-string "pattern: ") ?: \n 936 (interactive "*P\nP")
937 > _ \n 937 (skeleton-proxy-new sh-case str arg))
938 "breaksw" \n 938(put 'sh-case 'menu-enable '(sh-feature sh-case))
939 ( "other pattern, %s: " 939
940 < "case " str ?: \n 940(defvar sh-case
941 '((csh "expression: "
942 "switch( " str " )" \n
943 > "case " (read-string "pattern: ") ?: \n
941 > _ \n 944 > _ \n
942 "breaksw" \n) 945 "breaksw" \n
943 < "default:" \n 946 ( "other pattern, %s: "
944 > _ \n 947 < "case " str ?: \n
945 resume: 948 > _ \n
946 < < "endsw") 949 "breaksw" \n)
947 (es) 950 < "default:" \n
948 (rc "expression: " 951 > _ \n
949 "switch( " str " ) {" \n 952 resume:
950 > "case " (read-string "pattern: ") \n 953 < < "endsw")
951 > _ \n 954 (es)
952 ( "other pattern, %s: " 955 (rc "expression: "
953 < "case " str \n 956 "switch( " str " ) {" \n
954 > _ \n) 957 > "case " (read-string "pattern: ") \n
955 < "case *" \n
956 > _ \n
957 resume:
958 < < ?})
959 (sh "expression: "
960 "case " str " in" \n
961 > (read-string "pattern: ") ?\) \n
962 > _ \n
963 ";;" \n
964 ( "other pattern, %s: "
965 < str ?\) \n
966 > _ \n 958 > _ \n
967 ";;" \n) 959 ( "other pattern, %s: "
968 < "*)" \n 960 < "case " str \n
969 > _ \n 961 > _ \n)
970 resume: 962 < "case *" \n
971 < < "esac")) 963 > _ \n
972(put 'sh-case 'menu-enable '(sh-feature sh-case)) 964 resume:
965 < < ?})
966 (sh "expression: "
967 "case " str " in" \n
968 > (read-string "pattern: ") ?\) \n
969 > _ \n
970 ";;" \n
971 ( "other pattern, %s: "
972 < str ?\) \n
973 > _ \n
974 ";;" \n)
975 < "*)" \n
976 > _ \n
977 resume:
978 < < "esac"))
979 "Insert a case/switch statement. See `sh-feature'.")
973 980
974 981
975 982