From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7901 invoked by alias); 1 Jan 2017 03:13:55 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40254 Received: (qmail 11936 invoked from network); 1 Jan 2017 03:13:55 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-0.7/5.0):. Processed in 3.47484 secs); 01 Jan 2017 03:13:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) 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= X-ME-Sender: X-Sasl-enc: fascPBjv1ZjbWB30bi4/YKxw5aAm4NMRHkYkO3y87t/o 1483240422 Date: Sun, 1 Jan 2017 03:10:34 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: Error in zshaddhistory() should not prevent command from running Message-ID: <20170101031034.GA15639@fujitsu.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) 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