Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Error in zshaddhistory() should not prevent command from running
- X-seq: zsh-workers 40254
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Error in zshaddhistory() should not prevent command from running
- Date: Sun, 1 Jan 2017 03:10:34 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=aTTKz6yWITj9Nfx xmmBz8TmyrTQ=; b=k5aLws7gTVl05F8qY2bwnGrdR6y6koTEEyXR/BStYDKbNnp 5V3Bpx3xYp54GMN6N4M3Pxw7Pciwh4uQ58k9QK6sDunYigAuLWpA0iJfNQuDjXJa 7lwYGXcmxIXc8I5KFNx1Zcuv0R2KCtP7AAszPNl7HNBBiyGlIMUwCp1Tknds=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=aTTKz6yWITj9Nf xxmmBz8TmyrTQ=; b=hfsDny7teWylQsVAWUOf+YpPQbSP9Nf7luSppxtW3qaeVc ff22JWLjPkQdPLAvCtQGViea/kd4+JxE3y1rAhfF6xOxDIMEKfpZ7cB5tXCbDcgu L9YfqLHbGfpL1LGNxBVk/Uo49nKLVgQwq22eH7lHbJPTmNrzGWUFLdzttLGns=
- In-reply-to: <alpine.LRH.2.00.1612302212060.4560@toltec.zanshin.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author