aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2003-10-05 13:53:54 +0000
committerRichard M. Stallman2003-10-05 13:53:54 +0000
commit720baa46696f3d27159d70b5940537f9078816b5 (patch)
tree938df4b7879d89786897fe95c398522cf6f9dc43
parent3c3ba27b4b12c4f32b75661f9f69ff181dd03531 (diff)
downloademacs-720baa46696f3d27159d70b5940537f9078816b5.tar.gz
emacs-720baa46696f3d27159d70b5940537f9078816b5.zip
(sh-feature): Handle sh-modify like sh-append.
(sh-for, sh-indexed-loop, sh-function, sh-while, sh-while-getopts): Use sh-modify directly. (sh-select): Use sh-append, not eval.
-rw-r--r--lisp/progmodes/sh-script.el48
1 files changed, 24 insertions, 24 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 9b4599e1354..e63dda1c663 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -358,21 +358,21 @@ the car and cdr are the same symbol.")
358;; I turned off this feature because it doesn't permit typing commands 358;; I turned off this feature because it doesn't permit typing commands
359;; in the usual way without help. 359;; in the usual way without help.
360;;(defvar sh-abbrevs 360;;(defvar sh-abbrevs
361;; '((csh eval sh-abbrevs shell 361;; '((csh sh-abbrevs shell
362;; "switch" 'sh-case 362;; "switch" 'sh-case
363;; "getopts" 'sh-while-getopts) 363;; "getopts" 'sh-while-getopts)
364 364
365;; (es eval sh-abbrevs shell 365;; (es sh-abbrevs shell
366;; "function" 'sh-function) 366;; "function" 'sh-function)
367 367
368;; (ksh88 eval sh-abbrevs sh 368;; (ksh88 sh-abbrevs sh
369;; "select" 'sh-select) 369;; "select" 'sh-select)
370 370
371;; (rc eval sh-abbrevs shell 371;; (rc sh-abbrevs shell
372;; "case" 'sh-case 372;; "case" 'sh-case
373;; "function" 'sh-function) 373;; "function" 'sh-function)
374 374
375;; (sh eval sh-abbrevs shell 375;; (sh sh-abbrevs shell
376;; "case" 'sh-case 376;; "case" 'sh-case
377;; "function" 'sh-function 377;; "function" 'sh-function
378;; "until" 'sh-until 378;; "until" 'sh-until
@@ -385,7 +385,7 @@ the car and cdr are the same symbol.")
385;; "tmpfile" sh-tmp-file 385;; "tmpfile" sh-tmp-file
386;; "while" sh-while) 386;; "while" sh-while)
387 387
388;; (zsh eval sh-abbrevs ksh88 388;; (zsh sh-abbrevs ksh88
389;; "repeat" 'sh-repeat)) 389;; "repeat" 'sh-repeat))
390;; "Abbrev-table used in Shell-Script mode. See `sh-feature'. 390;; "Abbrev-table used in Shell-Script mode. See `sh-feature'.
391;;;Due to the internal workings of abbrev tables, the shell name symbol is 391;;;Due to the internal workings of abbrev tables, the shell name symbol is
@@ -1567,10 +1567,10 @@ in ALIST."
1567 (unless elt 1567 (unless elt
1568 (setq elt (assq 'sh alist))) 1568 (setq elt (assq 'sh alist)))
1569 (if (and (consp (setq val (cdr elt))) 1569 (if (and (consp (setq val (cdr elt)))
1570 (eq (car val) 'sh-append)) 1570 (memq (car val) '(sh-append sh-modify)))
1571 (setcdr elt 1571 (setcdr elt
1572 (setq val 1572 (setq val
1573 (apply 'sh-append 1573 (apply (car val)
1574 (let ((sh-shell (car (cdr val)))) 1574 (let ((sh-shell (car (cdr val))))
1575 (if (assq sh-shell alist) 1575 (if (assq sh-shell alist)
1576 (sh-feature alist) 1576 (sh-feature alist)
@@ -3128,16 +3128,16 @@ This is always added to the end of the buffer."
3128 3128
3129(define-skeleton sh-for 3129(define-skeleton sh-for
3130 "Insert a for loop. See `sh-feature'." 3130 "Insert a for loop. See `sh-feature'."
3131 (csh eval sh-modify sh 3131 (csh sh-modify sh
3132 1 "" 3132 1 ""
3133 2 "foreach " 3133 2 "foreach "
3134 4 " ( " 3134 4 " ( "
3135 6 " )" 3135 6 " )"
3136 15 '< 3136 15 '<
3137 16 "end") 3137 16 "end")
3138 (es eval sh-modify rc 3138 (es sh-modify rc
3139 4 " = ") 3139 4 " = ")
3140 (rc eval sh-modify sh 3140 (rc sh-modify sh
3141 2 "for( " 3141 2 "for( "
3142 6 " ) {" 3142 6 " ) {"
3143 15 ?\} ) 3143 15 ?\} )
@@ -3150,14 +3150,14 @@ This is always added to the end of the buffer."
3150 3150
3151(define-skeleton sh-indexed-loop 3151(define-skeleton sh-indexed-loop
3152 "Insert an indexed loop from 1 to n. See `sh-feature'." 3152 "Insert an indexed loop from 1 to n. See `sh-feature'."
3153 (bash eval identity posix) 3153 (bash sh-modify posix)
3154 (csh "Index variable: " 3154 (csh "Index variable: "
3155 "@ " str " = 1" \n 3155 "@ " str " = 1" \n
3156 "while( $" str " <= " (read-string "upper limit: ") " )" \n 3156 "while( $" str " <= " (read-string "upper limit: ") " )" \n
3157 > _ ?$ str \n 3157 > _ ?$ str \n
3158 "@ " str "++" \n 3158 "@ " str "++" \n
3159 < "end" \n) 3159 < "end" \n)
3160 (es eval sh-modify rc 3160 (es sh-modify rc
3161 4 " =") 3161 4 " =")
3162 (ksh88 "Index variable: " 3162 (ksh88 "Index variable: "
3163 > "integer " str "=0" \n 3163 > "integer " str "=0" \n
@@ -3255,13 +3255,13 @@ t means to return a list of all possible completions of STRING.
3255 3255
3256(define-skeleton sh-function 3256(define-skeleton sh-function
3257 "Insert a function definition. See `sh-feature'." 3257 "Insert a function definition. See `sh-feature'."
3258 (bash eval sh-modify ksh88 3258 (bash sh-modify ksh88
3259 3 "() {") 3259 3 "() {")
3260 (ksh88 "name: " 3260 (ksh88 "name: "
3261 "function " str " {" \n 3261 "function " str " {" \n
3262 > _ \n 3262 > _ \n
3263 < "}" \n) 3263 < "}" \n)
3264 (rc eval sh-modify ksh88 3264 (rc sh-modify ksh88
3265 1 "fn ") 3265 1 "fn ")
3266 (sh () 3266 (sh ()
3267 "() {" \n 3267 "() {" \n
@@ -3337,14 +3337,14 @@ t means to return a list of all possible completions of STRING.
3337 > "select " str " in " _ "; do" \n 3337 > "select " str " in " _ "; do" \n
3338 > ?$ str \n 3338 > ?$ str \n
3339 "done" > \n) 3339 "done" > \n)
3340 (bash eval sh-append ksh88)) 3340 (bash sh-append ksh88))
3341;;;(put 'sh-select 'menu-enable '(sh-feature sh-select)) 3341;;;(put 'sh-select 'menu-enable '(sh-feature sh-select))
3342 3342
3343 3343
3344 3344
3345(define-skeleton sh-tmp-file 3345(define-skeleton sh-tmp-file
3346 "Insert code to setup temporary file handling. See `sh-feature'." 3346 "Insert code to setup temporary file handling. See `sh-feature'."
3347 (bash eval identity ksh88) 3347 (bash sh-append ksh88)
3348 (csh (file-name-nondirectory (buffer-file-name)) 3348 (csh (file-name-nondirectory (buffer-file-name))
3349 "set tmp = /tmp/" str ".$$" \n 3349 "set tmp = /tmp/" str ".$$" \n
3350 "onintr exit" \n _ 3350 "onintr exit" \n _
@@ -3363,7 +3363,7 @@ t means to return a list of all possible completions of STRING.
3363 _ \n 3363 _ \n
3364 ?\} > \n 3364 ?\} > \n
3365 ?\} > \n) 3365 ?\} > \n)
3366 (ksh88 eval sh-modify sh 3366 (ksh88 sh-modify sh
3367 7 "EXIT") 3367 7 "EXIT")
3368 (rc (file-name-nondirectory (buffer-file-name)) 3368 (rc (file-name-nondirectory (buffer-file-name))
3369 > "tmp = /tmp/" str ".$pid" \n 3369 > "tmp = /tmp/" str ".$pid" \n
@@ -3387,17 +3387,17 @@ t means to return a list of all possible completions of STRING.
3387 3387
3388(define-skeleton sh-while 3388(define-skeleton sh-while
3389 "Insert a while loop. See `sh-feature'." 3389 "Insert a while loop. See `sh-feature'."
3390 (csh eval sh-modify sh 3390 (csh sh-modify sh
3391 2 "" 3391 2 ""
3392 3 "while( " 3392 3 "while( "
3393 5 " )" 3393 5 " )"
3394 10 '< 3394 10 '<
3395 11 "end") 3395 11 "end")
3396 (es eval sh-modify sh 3396 (es sh-modify sh
3397 3 "while { " 3397 3 "while { "
3398 5 " } {" 3398 5 " } {"
3399 10 ?\} ) 3399 10 ?\} )
3400 (rc eval sh-modify sh 3400 (rc sh-modify sh
3401 3 "while( " 3401 3 "while( "
3402 5 " ) {" 3402 5 " ) {"
3403 10 ?\} ) 3403 10 ?\} )
@@ -3413,7 +3413,7 @@ t means to return a list of all possible completions of STRING.
3413 "Insert a while getopts loop. See `sh-feature'. 3413 "Insert a while getopts loop. See `sh-feature'.
3414Prompts for an options string which consists of letters for each recognized 3414Prompts for an options string which consists of letters for each recognized
3415option followed by a colon `:' if the option accepts an argument." 3415option followed by a colon `:' if the option accepts an argument."
3416 (bash eval sh-modify sh 3416 (bash sh-modify sh
3417 18 "${0##*/}") 3417 18 "${0##*/}")
3418 (csh nil 3418 (csh nil
3419 "while( 1 )" \n 3419 "while( 1 )" \n
@@ -3438,11 +3438,11 @@ option followed by a colon `:' if the option accepts an argument."
3438 < < "endsw" \n 3438 < < "endsw" \n
3439 "shift" \n 3439 "shift" \n
3440 < "end" \n) 3440 < "end" \n)
3441 (ksh88 eval sh-modify sh 3441 (ksh88 sh-modify sh
3442 16 "print" 3442 16 "print"
3443 18 "${0##*/}" 3443 18 "${0##*/}"
3444 37 "OPTIND-1") 3444 37 "OPTIND-1")
3445 (posix eval sh-modify sh 3445 (posix sh-modify sh
3446 18 "$(basename $0)") 3446 18 "$(basename $0)")
3447 (sh "optstring: " 3447 (sh "optstring: "
3448 > "while getopts :" str " OPT; do" \n 3448 > "while getopts :" str " OPT; do" \n