zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Steve Dondley <s@dondley.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Is there any possible way to automatically escape characters when executing an alias in zsh?
Date: Sat, 11 Sep 2021 19:26:03 -0700	[thread overview]
Message-ID: <CAH+w=7ZFTm7DZ3d-yzqj7820hz0FtAK6k9QTcScAbN3_sMzokg@mail.gmail.com> (raw)
In-Reply-To: <15168b1d0f01d2561fd2186eb80b2479@dondley.com>

On Sat, Sep 11, 2021 at 6:27 PM Steve Dondley <s@dondley.com> wrote:
>
> If I launch a command with the shell
> and pass it some argument to open up a full-blown GUI for with a
> particular color theme, that doesn't mean I'm interacting with the
> shell.

You're interacting with the up the point where you launch the command,
and then you're interacting with the application you launched.

> And what could possibly be the harm in having the shell do some typing
> for me without me having to think about it?

Having the shell do some typing for you is not the same as having the
shell ignore something you typed in a context where it would normally
pay attention.  Eventually you're going to type something the shell
should not have ignored and the wrong thing is going to happen.

See for example url-quote-magic.  That does the typing for you, and
you can see what it did to make sure it didn't do anything wrong.
PWS's solution (and even my edit thereof) change the input at a time
and place where it's too late for you to fix anything that's awry.

> > zle -N taskwarrior-literal
> > autoload add-zle-hook-widget
> > add-zle-hook-widget line-finish taskwarrior-literal
>
> Yeah, so I don't think this would work because I need <tab> for
> autocompletion. Or am I not understanding this?

You're not understanding.  Given that you said --
> minor completions (none of which will ever contain special characters
> that need to be escaped)
-- taskwarrior-literal should work fine.  As with PWS's suggestion,
this kicks in when you press enter (accept-line), so all your
completions are already out of the way, and it only quotes things that
need quoting.  The difference is that it blindly quotes ANYTHING that
might be interpreted by the shell, including filename globs, etc.


  reply	other threads:[~2021-09-12  2:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 18:41 Steve Dondley
2021-09-11 19:00 ` zzapper
2021-09-11 19:16 ` Peter Stephenson
2021-09-11 19:28   ` Peter Stephenson
2021-09-11 20:45     ` Steve Dondley
2021-09-11 20:53       ` Peter Stephenson
2021-09-11 21:01         ` Steve Dondley
2021-09-11 22:39           ` Lawrence Velázquez
2021-09-11 23:15             ` Steve Dondley
2021-09-12  0:23               ` Bart Schaefer
2021-09-12  1:27                 ` Steve Dondley
2021-09-12  2:26                   ` Bart Schaefer [this message]
2021-09-12  3:02                     ` Steve Dondley
2021-09-11 23:17             ` Bart Schaefer
2021-09-11 23:33               ` Steve Dondley
2021-09-12  3:33               ` Ray Andrews

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='CAH+w=7ZFTm7DZ3d-yzqj7820hz0FtAK6k9QTcScAbN3_sMzokg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=s@dondley.com \
    --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).