comparison lisp/progmodes/sh-script.el @ 66027:61174c5e6da6

(sh-tmp-file): Use mktemp -t. Finish support for es and rc shells.
author Richard M. Stallman <rms@gnu.org>
date Tue, 11 Oct 2005 22:06:43 +0000
parents a001884be063
children 9cf3996bb877 5e2d3828e89f
comparison
equal deleted inserted replaced
66026:20752359c953 66027:61174c5e6da6
3390 3390
3391 (define-skeleton sh-tmp-file 3391 (define-skeleton sh-tmp-file
3392 "Insert code to setup temporary file handling. See `sh-feature'." 3392 "Insert code to setup temporary file handling. See `sh-feature'."
3393 (bash sh-append ksh88) 3393 (bash sh-append ksh88)
3394 (csh (file-name-nondirectory (buffer-file-name)) 3394 (csh (file-name-nondirectory (buffer-file-name))
3395 "set tmp = `mktemp /tmp/" str ".XXXXXX`" \n 3395 "set tmp = `mktemp -t " str ".XXXXXX`" \n
3396 "onintr exit" \n _ 3396 "onintr exit" \n _
3397 (and (goto-char (point-max)) 3397 (and (goto-char (point-max))
3398 (not (bolp)) 3398 (not (bolp))
3399 ?\n) 3399 ?\n)
3400 "exit:\n" 3400 "exit:\n"
3401 "rm $tmp* >&/dev/null" > \n) 3401 "rm $tmp* >&/dev/null" > \n)
3402 ;; The change to use mktemp here has not been tested;
3403 ;; I don't know es syntax, so I had to guess.
3404 ;; If you try it, or if you know es syntax and can check it,
3405 ;; please tell me whether it needs any change. --rms.
3406 (es (file-name-nondirectory (buffer-file-name)) 3402 (es (file-name-nondirectory (buffer-file-name))
3407 > "local( signals = $signals sighup sigint; tmp = `mktemp /tmp/" str 3403 > "local( signals = $signals sighup sigint;" \n
3408 ".XXXXXX` ) {" \n 3404 > "tmp = `{ mktemp -t " str ".XXXXXX } ) {" \n
3409 > "catch @ e {" \n 3405 > "catch @ e {" \n
3410 > "rm $tmp^* >[2]/dev/null" \n 3406 > "rm $tmp^* >[2]/dev/null" \n
3411 "throw $e" \n 3407 "throw $e" \n
3412 "} {" > \n 3408 "} {" > \n
3413 _ \n 3409 _ \n
3414 ?\} > \n 3410 ?\} > \n
3415 ?\} > \n) 3411 ?\} > \n)
3416 (ksh88 sh-modify sh 3412 (ksh88 sh-modify sh
3417 7 "EXIT") 3413 7 "EXIT")
3418 ;; The change to use mktemp here has not been tested;
3419 ;; I don't know rc syntax, so I had to guess.
3420 ;; If you try it, or if you know rc syntax and can check it,
3421 ;; please tell me whether it needs any change. --rms.
3422 (rc (file-name-nondirectory (buffer-file-name)) 3414 (rc (file-name-nondirectory (buffer-file-name))
3423 > "tmp = `mktemp /tmp/" str ".XXXXXX`" \n 3415 > "tmp = `{ mktemp -t " str ".XXXXXX }" \n
3424 "fn sigexit { rm $tmp^* >[2]/dev/null }" \n) 3416 "fn sigexit { rm $tmp^* >[2]/dev/null }" \n)
3425 (sh (file-name-nondirectory (buffer-file-name)) 3417 (sh (file-name-nondirectory (buffer-file-name))
3426 > "TMP=`mktemp ${TMPDIR:-/tmp}/" str ".XXXXXX`" \n 3418 > "TMP=`mktemp -t " str ".XXXXXX`" \n
3427 "trap \"rm $TMP* 2>/dev/null\" " ?0 \n)) 3419 "trap \"rm $TMP* 2>/dev/null\" " ?0 \n))
3428 3420
3429 3421
3430 3422
3431 (define-skeleton sh-until 3423 (define-skeleton sh-until