Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: psychiatric help
- X-seq: zsh-users 30496
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: psychiatric help
- Date: Sun, 5 Apr 2026 12:00:30 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nqYDpddI3415+3J7ziGnKIxppwxKTRdHR52giNva6JA=; fh=D6X9xIaVjTSxb6gwuCseglo0uxyISp24IsyxMp5sRU4=; b=VE654IieIOYd2Q/Ab7mcM339U3WY59tSpBZ+wFJESN1Pgau5d4ZcdeT6StK+Z3c3TA irQxkBQLgrbcPn7UWqdPfLrz7T+7IMwWXtEPtsJReMUsqFlmAruUWzE7omM/NFog2vly tZAjF9JJu2fI2v/O7k4s6KO1GlE9GUXy8DaFHG0bTfNwCem+6UuIkToEstFIODNIBRri pq625TLYBN9D2PG3qxAT+jbWy2Dfjcc6w97URUeuD5oxkHTUG/vquFjWAuvlp/qbQ9Sj 05nyLoLV8NISy/mO9djUn+wWDBw2RFaL/X5pNNcP3b1e2iMxpGl/30xTFUC8kJQUFQ7m GHhw==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1775415641; cv=none; d=google.com; s=arc-20240605; b=Ian9Ecs6tVYv1pU/XrtniRXaMk6hwpA59Fxg1ZAujxQ2kN4OuVIIssGWAbP0PEbWz/ wnwkxo5aK5tLxeXQNwNX4I/K99R0hqrcXQS+lMtm316u2VjLRDbGnIais2jkYpTOedVT WVaOdlJr+zsDIXekH8/K05nNdafctUAmfraodoi3HKoNgpRXgNe3kDHuGPG8PdCK9xa/ VdapIYYAJO/pLK6rjDOohtCUqdWspbt0U5aD6jmh+e0dmhoarEslGM3IDykVfOxlyBPV 26Bkm5e7Un49H24LR+KzR9/5LFysbc5nwYEWCdQ/LGA1I18YOUtgDxmr3zKyQun4Slt6 UCFA==
- Archived-at: <https://zsh.org/users/30496>
- In-reply-to: <fcd552e0-d0eb-4443-bf6a-8ba11663638f@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <0610849d-f81c-4539-b13d-c4be9cbd1276@eastlink.ca> <CAA=-s3yUhzu7WbAB0F09abwmzPYowJ1s6o+YiV+cuQBf-GvFXw@mail.gmail.com> <448d6d35-c261-4e7e-bc67-c2a58d082b87@eastlink.ca> <CAA=-s3wKQb+1Sq2mV+h2Gk8rOQYKt8x_JNg9NhmdwAgJesxBkQ@mail.gmail.com> <755f4aa9-e27a-4b4d-8f23-add76a13ee83@eastlink.ca> <CAH+w=7Ydks9vqHA8x_zcHq454q8_C49Tq0xqPWuv9ejKYxCoOA@mail.gmail.com> <fcd552e0-d0eb-4443-bf6a-8ba11663638f@eastlink.ca>
On Sun, Apr 5, 2026 at 10:28 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> Tried this:
>
> alias tt='noglob _tt'
> function _tt ()
> {
> out=( $@ ) # Bart sez. Array will preserve hard space, no backslash needed.
> _execute 'ls $~out' # Need tilde here!
This is a bit inside-out if not exactly backward. Please note that:
1) $~out does nothing here because of the single quotes around it.
2) The presence of the tilde has an effect later only because
> ... '_execute' boils down to a call to 'eval' as you suspect ...
3) None of that would be necessary if you weren't prefixing with noglob
Hunting back through some of your old posts, I'm reminded that your _l
function wants to rewrite the not-yet-globbed command into something
else, and _execute is just an adjunct to put the rewrite into the
history. Without doing a lot more historical research than I want to,
I don't know why it was never made clear before that this is the wrong
place to go about this ... your instinct about studying the other
approaches ("A ZLE widget for calculator" thread) was a good one.
There's a bunch of stuff in the calculator thread about writing only
the unmodified command into the history, whereas you appear to want
the rewritten command in the history (or maybe you want both?). I'll
address the simpler case of keeping only the rewritten command.
Start this way:
1) Edit your _l function to expect to be a ZLE widget:
a) add a few lines at the top:
set -- ${(z)BUFFER}
[[ ${aliases[$1]} = 'noglob _l' ]] || return 0
shift # discard command word, to be replaced by ls
b) replace call to _execute with assignment to BUFFER
_execute 'ls $~out' # would become something like
BUFFER="ls $out" # No need for single-quotes or tilde, I think
2) Install the new function as a widget
zle -N zle-line-finish _l
There may be some other details depending on what happens in _l but
that's the gist of it. Note this only works when _l is NOT embedded
in some more complex command, but I think you said before that is not
an issue. I couldn't find any details of _l shared before, or I'd
have made more specific suggestions.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author