zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Marlon Richert <marlon.richert@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function)
Date: Wed, 21 Apr 2021 14:58:00 -0700	[thread overview]
Message-ID: <CAH+w=7bFfZucFRj9OZvzTnvxd+QUW7tZHAJiMLi+O0PNjz=wyA@mail.gmail.com> (raw)
In-Reply-To: <20210421212717.GE21343@tarpaulin.shahaf.local2>

On Wed, Apr 21, 2021 at 2:28 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> [ Aside: does anyone use zyodl.vim?  I see I have some local mods and
> not sure how much to prioritize cleaning them up and pushing them. ]

I've got an emacs yodl-mode somewhere, which is what I use when I
happen to find it ... it may be lurking on a host I rarely access any
more.

> Again, please wrap long lines in your prose.  This is the third time you
> are being asked to do so.

In order of (my personal) preference ...
++ send messages to the list in plain text with 78-column-or so lines
   (except don't line-wrap code**)
++ or send in plain text with long lines to avoid wrapping code
++ or send in HTML so lines are automatically wrapped***

** which admittedly is something I can't currently enforce on my own mailer.
*** which I sometimes do by accident because gmail replies in HTML if
the replied-to message was HTML.

> As to PUSHD_MINUS and PUSHD_SILENT, it would be better to give an
> example doesn't change them from their default values.

Using "pushd -q ..." avoids the need for PUSHD_SILENT.  Sadly there's
no way to temporarily disable PUSHD_MINUS except to setopt it in the
widget body.

> [...] the implementation uses «BUFFER="$*"» but
> the command is passed as an array [... either]
> commands should be passed as a single string, or the assignment to
> BUFFER should be changed

For example, «BUFFER="${(q-)*}"»

> > @@ -0,0 +1,54 @@
> > +# This function lets you implement widgets that can execute arbitrary commands
>
> DRY.  This information is in the manual, so it isn't needed here.

There's precedent for having similar doc in function source files and
also in the manual, so that someone perusing the files doesn't have to
then look to see whether the function is also in the manual.

> > +    # Move the entire current multiline construct into the editor buffer. This
> > +    # function is then aborted and we return to the top-level prompt, which
> > +    # triggers the hook above.
> > +    zle .push-line-or-edit
> > +    return  # Not actually necessary, but for clarity's sake
>
> How is it not necessary?  If control flow continued past the «esac»,
> code would be executed.

Flow can't continue past «zle .push-line-or-edit» because it invokes
the equivalent of send-break and kills the widget.  But I still don't
understand why he wants this here.

> If the user presses the bound key at the select prompt or in vared, why
> should the library function disregard that?

This was my suggestion, because at a select prompt the command
wouldn't be "executed", it'd be fed to select as the value of the
selection, which would be surprising at the least.

In vared it would replace the contents of the variable with the
command string and then exit vared, which is probably also not wanted.
I didn't think of that case, but it's a good catch IMO.

> Shouldn't this behaviour be
> changed?  Or failing that, documented?

Documented, unless you have a suggestion for what to change it to be.


  reply	other threads:[~2021-04-21 21:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 13:36 [RFC][PATCH] Add change-directory() widget function Marlon Richert
2021-04-20 19:43 ` Bart Schaefer
2021-04-20 20:13   ` Marlon Richert
2021-04-20 21:32     ` Bart Schaefer
2021-04-21  3:46       ` Bart Schaefer
2021-04-21 11:37         ` [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function) Marlon Richert
2021-04-21 20:40           ` Bart Schaefer
2021-04-21 21:27           ` Daniel Shahaf
2021-04-21 21:58             ` Bart Schaefer [this message]
2021-04-22 10:55               ` Marlon Richert
2021-04-22 20:25                 ` Daniel Shahaf
2021-04-22 23:27                 ` Bart Schaefer
2021-04-24 20:06                   ` Marlon Richert
2021-04-24 21:49                     ` Bart Schaefer
2021-04-24 21:58                       ` Bart Schaefer
2021-04-26 18:08                         ` Marlon Richert
2021-04-26 21:39                           ` Bart Schaefer
2021-04-27 10:46                             ` Marlon Richert
2021-04-27 19:27                               ` Bart Schaefer
2021-04-30 19:16                                 ` Marlon Richert
2021-04-30 20:25                                   ` Bart Schaefer
2021-05-01 13:30                                     ` Marlon Richert
2021-05-31 17:55                                       ` Marlon Richert
2021-04-25 17:02                     ` Hard-wrapping emails (Was: [PATCH] Add execute-command() widget function (was Re: [RFC][PATCH] Add change-directory() widget function)) Lawrence Velázquez
2021-04-20 21:57     ` [RFC][PATCH] Add change-directory() widget function Daniel Shahaf
2021-04-20 22:14     ` Daniel Shahaf
2021-04-21  0:09       ` Bart Schaefer
2021-04-21  3:18       ` Bart Schaefer
2021-04-21 20:11         ` Daniel Shahaf
2021-04-21 20:29           ` 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='CAH+w=7bFfZucFRj9OZvzTnvxd+QUW7tZHAJiMLi+O0PNjz=wyA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=marlon.richert@gmail.com \
    --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).