zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@math.gatech.edu
Subject: Re: Bad bindkey mojo in 3.1.5
Date: Mon, 02 Nov 1998 10:55:14 +0100	[thread overview]
Message-ID: <9811020955.AA41305@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Sun, 01 Nov 1998 22:17:36 NFT." <981101221736.ZM29688@candle.brasslantern.com>

"Bart Schaefer" wrote:
> Take a look at this:
> 
> zagzig<106> bindkey | grep back
> "^B" backward-char
> "^H" backward-delete-char
> "^W" "^W" "^W" "^W" "^W" "^W" "^W" "^W" backward-kill-word
> "^X^P" history-beginning-search-backward
> "^Xr" history-incremental-search-backward
> (etc.)
> 
> Looks like "zed" tickles the bug:

The problem is in zed rather than the shell.  It doesn't occur with
the zed supplied with 3.1.5, but obviously I'm using the same one as
you (or similar, anyway), though I can't remember who altered it last.
In zsh 3.1, `bindkey '^w'' produces something like

"^W" kill-region

then when this gets restored, the call is in effect

bindkey "^W" "\"^W\" kill-region"

which is obviously wrong.  Zsh didn't used to print the "^W" when you
asked for just one binding, hence the difference.

The following fixes it under the assumption that everything up to and
including 3.0.x doesn't print the key string and doesn't have -L, and
conversely from then on.  Restoring bindkeys is better taken care of
in the zed supplied with the source, but that's specific to 3.1.
I didn't put PATCH: at the top since it doesn't patch any official
version of the source.

It wouldn't be beyond the wit of man, err, person, to implement a
.zedrc which could have arbitrary bindings in it.

*** /home/user2/pws/bin/fns/zed.cw	Wed Dec  3 13:35:57 1997
--- /home/user2/pws/bin/fns/zed	Mon Nov  2 10:45:02 1998
***************
*** 8,14 ****
  # Completion: use
  # compctl -f -x 'w[1,-f]' -F -- zed
  
! local var fun ctrl_W_bind="$(bindkey '^W')" oldcompctl hist
  # We do not want timeout while we are editing a file
  integer TMOUT=0
  
--- 8,19 ----
  # Completion: use
  # compctl -f -x 'w[1,-f]' -F -- zed
  
! local var fun oldcompctl ctrl_W_bind hist
! if [[ -z $ZSH_VERSION || $ZSH_VERSION = 3.0* ]]; then
!   ctrl_W_bind="bindkey '^W' \"$(bindkey '^W')\""
! else
!   ctrl_W_bind="$(bindkey -L '^W')"
! fi
  # We do not want timeout while we are editing a file
  integer TMOUT=0
  
***************
*** 33,39 ****
  cleanup () {
    bindkey "^M" accept-line
    bindkey "^X^W" undefined-key
!   bindkey "^W" "$ctrl_W_bind"
    [[ -n $oldcompctl ]] && eval $oldcompctl
    unfunction cleanup
    [[ -z $ZSH_VERSION ]] && unsetopt nobanghist
--- 38,44 ----
  cleanup () {
    bindkey "^M" accept-line
    bindkey "^X^W" undefined-key
!   eval $ctrl_W_bind
    [[ -n $oldcompctl ]] && eval $oldcompctl
    unfunction cleanup
    [[ -z $ZSH_VERSION ]] && unsetopt nobanghist

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy


      reply	other threads:[~1998-11-02 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-02  6:17 Bart Schaefer
1998-11-02  9:55 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9811020955.AA41305@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).