From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org, "Thomas Gläßle" <thomas@coldfix.de>
Subject: Re: Path with spaces in _canonical_paths
Date: Wed, 23 Nov 2022 23:06:25 +0000 [thread overview]
Message-ID: <2c4018af-1fe8-4e23-a31b-11158061bd18@app.fastmail.com> (raw)
In-Reply-To: <CAH+w=7Z9wVCAeJaU+K-wG2jx8LHvUsF9aahUrAPLvMgaLW0STQ@mail.gmail.com>
Bart Schaefer wrote on Wed, 23 Nov 2022 22:42 +00:00:
> On Wed, Nov 23, 2022 at 2:24 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>>
>> Yes. That's why the comment says s/$origpref/$canpref/ rather than
>> s/$canpref/$origpref/ as the code in HEAD says.
>
> Ah, I see. The comment is explaining what the else-branch OUGHT to be
> accomplishing, rather than what it actually IS doing.
Right.
> That was not clear.
>
Thanks for the feedback.
That comment is using "###" comments (a conventional "TODO" marker), the
word "ideally", a conditional ("would"), and the order of pattern and
replacement is the opposite of what it is in the code. I had thought it
was clear.
Anyway, I see you've extended it to clarify. Thanks for this.
>> I'm not sure off the top of my head. Perhaps that patch needs an extra
>> ${(q)} somewhere? Or perhaps we should add -Q to the if() codepath?
>> What do callers expect?
>
> Callers expect it in the form from the if-branch (what compadd
> produces), so I think the else-branch needs some variant of (q).
>
> Thomas, can you try this?
>
> diff --git a/Completion/Unix/Type/_canonical_paths
> b/Completion/Unix/Type/_canonical_paths
> index a8fbbb524..1444bc165 100644
> --- a/Completion/Unix/Type/_canonical_paths
> +++ b/Completion/Unix/Type/_canonical_paths
> @@ -42,7 +42,8 @@ _canonical_paths_add_paths () {
> # ### Ideally, this codepath would do what the 'if' above does,
> # ### but telling compadd to pretend the "word on the command line"
> # ### is ${"the word on the command line"/$origpref/$canpref}.
> - matches+=(${${(M)files:#$canpref*}/$canpref/$origpref})
> + # ### The following approximates that.
> + matches+=(${(q)${(M)files:#$canpref*}/$canpref/$origpref})
> fi
>
> for subdir in $expref?*(@); do
next prev parent reply other threads:[~2022-11-23 23:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 17:41 thomas
2022-11-21 3:57 ` Bart Schaefer
2022-11-21 10:47 ` thomas
2022-11-21 16:30 ` Bart Schaefer
2022-11-21 17:41 ` Thomas Gläßle
2022-11-21 21:32 ` Bart Schaefer
2022-11-23 14:13 ` Daniel Shahaf
2022-11-23 21:36 ` Bart Schaefer
2022-11-23 22:24 ` Daniel Shahaf
2022-11-23 22:42 ` Bart Schaefer
2022-11-23 23:06 ` Daniel Shahaf [this message]
2022-11-23 23:12 ` Bart Schaefer
2022-11-24 0:12 ` Daniel Shahaf
2022-11-24 18:42 ` Bart Schaefer
2022-11-23 23:36 ` Thomas Gläßle
2022-11-23 23:40 ` Thomas Gläßle
2022-11-24 18:51 ` Bart Schaefer
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=2c4018af-1fe8-4e23-a31b-11158061bd18@app.fastmail.com \
--to=d.s@daniel.shahaf.name \
--cc=schaefer@brasslantern.com \
--cc=thomas@coldfix.de \
--cc=zsh-workers@zsh.org \
/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).