From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6438 invoked from network); 22 Mar 1997 16:41:24 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 22 Mar 1997 16:41:24 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id LAA13981; Sat, 22 Mar 1997 11:34:07 -0500 (EST) Resent-Date: Sat, 22 Mar 1997 11:34:07 -0500 (EST) Date: Sat, 22 Mar 1997 16:36:41 GMT From: Zefram Message-Id: <13323.199703221636@stone.dcs.warwick.ac.uk> Subject: zed and bindkey X-Patch: 216 Resent-Message-ID: <"Iuk_41.0.LQ3.-d0Dp"@euclid> To: zsh-workers@math.gatech.edu Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3012 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- This patch updates zed's handling of key bindings. By using bindkey's new -L option, it can more accurately restore those key bindings that it changes. Also, by using the -M option, it can add the appropriate accept-line key binding for the user's preferred keymap, rather than blindly using ^X^W. -zefram *** Functions/zed 1996/08/02 22:38:40 1.1.1.3 --- Functions/zed 1997/03/21 22:55:26 *************** *** 7,13 **** # Completion: use # compctl -f -x 'w[1,-f]' -F -- zed ! local var fun ctrl_W_bind="$(bindkey '^W')" # We do not want timeout while we are editing a file integer TMOUT=0 --- 7,13 ---- # Completion: use # compctl -f -x 'w[1,-f]' -F -- zed ! local var fun cleanup # We do not want timeout while we are editing a file integer TMOUT=0 *************** *** 17,38 **** [[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1 # catch interrupts ! cleanup () { ! bindkey "^M" accept-line ! bindkey "^X^W" undefined-key ! bindkey "^W" "$ctrl_W_bind" ! trap - INT ! } ! ! trap 'cleanup ; return 130' INT # don't mangle !'s setopt localoptions nobanghist bindkey "^M" self-insert-unmeta # Depending on your stty's, you may be able to use ^J as accept-line, else: ! bindkey "^X^W" accept-line ! bindkey "^W" kill-region if ((fun)) then var="$(functions $1)" --- 17,34 ---- [[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1 # catch interrupts ! cleanup="$(bindkey -L "^M"; bindkey -L -M emacs "^X^W"; bindkey -aL "ZZ" ! echo "trap - INT EXIT"; trap)" ! trap "return 130" INT ! trap "$cleanup" EXIT # don't mangle !'s setopt localoptions nobanghist bindkey "^M" self-insert-unmeta # Depending on your stty's, you may be able to use ^J as accept-line, else: ! bindkey -M emacs "^X^W" accept-line ! bindkey -a "ZZ" accept-line if ((fun)) then var="$(functions $1)" *************** *** 53,65 **** fi vared var fun=$? - cleanup (( fun == 0 )) && eval function "$var" else [[ -f $1 ]] && var="$(<$1)" vared var fun=$? - cleanup (( fun == 0 )) && print -r -- "$var" >| $1 fi --- 49,59 ---- -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: ascii iQCVAwUBMzMUxHD/+HJTpU/hAQFwhgP/eg4DFVHjmiqzQ/N3fsYdv7kHr3ev33fN GLzgdzhF+BHLBXAl8wgosIQ0kbzC79FUPOK12+sN1vV4CAnn7UNdbaDdqtoQtxtx NHdAa/zVpxAKjdA8OjvfpYvHLxpSPqukwa182VQKLcKmhIZyq31qHM6cX2pRwC+m 357MHqov1qo= =OXyk -----END PGP SIGNATURE-----