zsh-workers
 help / color / mirror / code / Atom feed
From: "alain (a.) caron" <alainc@nortel.ca>
To: mdb@cdc.noaa.gov
Cc: zsh-workers@math.gatech.edu
Subject: re:[zash-3.0.0] bug in cdmatch for dirs w/ embedded space?
Date: Thu, 12 Sep 1996 15:38:00 -0400	[thread overview]
Message-ID: <"9653 Thu Sep 12 18:01:31 1996"@bnr.ca> (raw)

In message "[zash-3.0.0] bug in cdmatch for dirs w/ embedded space?",
'mdb@cdc.noaa.gov' writes:

>I'm trying to get zsh to complete a directory that has an embedded
>space, e.g., `foo bar' (personally I don't like them, but with
>mac/win95 filenames it seems to be pretty common to come across).
>
>I used the versions of compctl, cdmatch, and cdmatch2 distributed with
>zsh-3.0.0, and invoked zsh with the -f switch. It fails because too
>many backslashes get put in the completion, e.g.,
>
>  % cd foo<TAB>
>results in
>  % cd foo\\\ bar/
>
>Is there a more up to date cdmatch/compctl for this sort of thing? Or
>is there a (non-default) that needs to be set?
>
>Thanks.
>
>Here's exactly what I did:
>
>charney$ ~/bin/sunos-5.5/zsh-3.0.0 -f
>charney% echo $ZSH_VERSION
>3.0.0
>charney% ls
>foo bar
>charney% if [[ -o AUTO_REMOVE_SLASH ]] then
>then>     compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
>then>   -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
>then> else
>else>     compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
>else>   -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
>else> fi
>charney% fpath=(~/.zfunctions)
>charney% autoload cdmatch
>charney% autoload cdmatch2
>charney% cd foo\\\ bar/    # typed cd foo<TAB> here
>cd: no such file or directory: foo\ bar/
>charney% cd foo\ bar
>charney% pwd
>/tmp/mdb/foo bar
>charney% cat ~/.zfunctions/cdmatch
># Start of cdmatch.
># Save in your functions directory and autoload, then do
># compctl -x 'S[/][~][./][../]' -g '*(-/)' - \
>#         'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
>#
># Completes directories for cd, pushd, ... anything which knows about cdpath.
># You do not have to include `.' in your cdpath.
>#
># It works properly only if $ZSH_VERSION > 2.6-beta2. For erarlier versions
># it still works if RC_EXPAND_PARAM is not set or when cdpath is empty.
>local narg pref cdp
>read -nc narg
>read -Ac pref
>cdp=(. $cdpath)
>reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t:gs/ /\\\\ /) )

replace this last line by:

reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) )

and everything should work fine.  At least, it does for me.


>return
># End of cdmatch.
>charney% cat ~/.zfunctions/cdmatch2
># This function should be called from compctl to complete the
># second argument of cd and pushd.
>local from
>read -Ac from
>from="${from[2]}"
>eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )"
>reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" )
>[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''"
>return
>charney%
>charney$
>
>--
>  -mb-
>

Regards,


Alain Caron
Nortel Technology, Montr?al, Qu?bec, Canada
email: alainc@nortel.ca
phone: 514-765-7718 or ESN 852-7718


             reply	other threads:[~1996-09-13  3:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-12 19:38 alain (a.) caron [this message]
1996-09-13  7:50 ` [zash-3.0.0] " Peter Stephenson

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='"9653 Thu Sep 12 18:01:31 1996"@bnr.ca' \
    --to=alainc@nortel.ca \
    --cc=mdb@cdc.noaa.gov \
    --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).