zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: Error in zshaddhistory() should not prevent command from running
Date: Sun, 1 Jan 2017 03:10:34 +0000	[thread overview]
Message-ID: <20170101031034.GA15639@fujitsu.shahaf.local2> (raw)
In-Reply-To: <alpine.LRH.2.00.1612302212060.4560@toltec.zanshin.com>

Bart Schaefer wrote on Fri, Dec 30, 2016 at 22:13:27 -0800:
> [Fourth attempt sending this, primenet is blocking gmail again.]

Two came through.

> Should this actually be in callhookfunc() itself?  I note that the doc
> warns about errors in precmd killing off periodic, or else I'd say it
> ought to be.

I'd be wary of swallowing errors by default.  That said, we could change
callhookfunc()'s signature to remind callers that they may want to clear
errors; for example, an 'ignore_errors' boolean parameter that the
precmd() callsite can set to false and zshaddhistory() to true.

> Possibly more controversial, why run this hook at all when nothing is
> being added?

Playing devil's advocate, I see two reasons:

1) Compatibility.  https://xkcd.com/1172/

2) It's easier to call the user-provided hook function on one more case
that it can easily ignore, than not to do so and to leave the user with
no easy alternative.  (It does seem easier to handle multiline commands
with zshaddhistory() than with, say, wrapping accept-line(), since the
latter fires for each line, not just for the complete command.)

Cheers,

Daniel






  reply	other threads:[~2017-01-01  3:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-31  6:13 Bart Schaefer
2017-01-01  3:10 ` Daniel Shahaf [this message]
2017-01-01 19:20   ` Bart Schaefer
2017-01-02  2:48     ` Daniel Shahaf
  -- strict thread matches above, loose matches on Subject: below --
2016-12-29  0:41 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=20170101031034.GA15639@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --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).