zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: array with newlines preserved as literal text
Date: Wed, 3 Feb 2021 11:29:45 -0800	[thread overview]
Message-ID: <a6cca928-6494-86d1-bf01-873c1fe6e6e3@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7ZWs4ataEtKK+SQraA4dfisPFkagvqbr48jZKL_HwQV6g@mail.gmail.com>

On 2021-02-02 6:21 p.m., Bart Schaefer wrote:
> _fn2hist() {
>    emulate -L zsh
>    local cmd=$1
>    shift
>    if [[ -n $functions[$cmd] ]]
>    then
>      print -rS "${$(functions -x 2 $cmd)#$cmd} ${${(qq)@}}"
>    fi
>    $cmd "$@"
> }
>
> Intended to be used like this:
>
> myfn() { : do whatever myfn does }
> alias myfn='_fn2hist myfn'
Cool.  Only thing is that when you pop it out of history it contains the 
'_fn2hist' as well as the subsequent command.  This could obviate all my 
" alias g='noglob _g' " stuff. Can the function and its tail be saved to 
a variable instead of to history?  Mind I'm being lazy I'm sure I can 
figure that out easy enough. Seems '(qq)' is our friend there for 
keeping things unexpanded.



  reply	other threads:[~2021-02-03 19:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 19:16 Ray Andrews
2021-02-02 19:26 ` Roman Perepelitsa
2021-02-03  1:10   ` Ray Andrews
2021-02-02 20:25 ` Bart Schaefer
2021-02-02 23:31   ` Ray Andrews
2021-02-03  2:21     ` Bart Schaefer
2021-02-03 19:29       ` Ray Andrews [this message]
2021-02-03 21:19         ` Bart Schaefer
2021-02-04  2:07           ` Ray Andrews
2021-02-05  2:57             ` Bart Schaefer
2021-02-04 21:55           ` Ray Andrews
2021-02-05  3:22             ` Bart Schaefer
2021-02-05  4:17               ` Ray Andrews
2021-02-05  4:24                 ` 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=a6cca928-6494-86d1-bf01-873c1fe6e6e3@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@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).