Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Aborted command saved in history
- X-seq: zsh-workers 37819
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Aborted command saved in history
- Date: Wed, 27 Jan 2016 21:45:10 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=L+cPg0rEORNXnsnkLYz0Ul/gmdsdoqnJrnimYqyn7+g=; b=XwTEXy/XYvYxQcUTGEN8T0TQ5pd2s85Z2AZwjRQ4S0Z/227+O/QSdBbInegBKuOsVN 0hnSuSoJQT/bmIR0rT4qerp8evrCdPf7jQr8W7R0N3ATTnSdv13F5vUchtRMbr02OV/T dvisHaxqcqSX7Mq0gqAqxKThDASNwA9gSRPr9XqVv8RsPw0lhVBt6GK84Rau23OZTxTd TXuvAkj9ulhvBl/Z+MfFmj61sBHgecE5fS5Wig5iXR8BD1Ln9Wfqw2fmuaQSPXyJ6dXf qoN4jOQAh2K/WwUw0ks1RMfAEc6podFMmKrzLA7bG5hkIfxjpqwmo1aJLzA+rcfApVtt BcGQ==
- In-reply-to: <CAHYJk3TY-JsahHgYWJSe_knx0Xo6D9ecXiTJQ=w+aUTDGHOT8A@mail.gmail.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: <CAHYJk3TY-JsahHgYWJSe_knx0Xo6D9ecXiTJQ=w+aUTDGHOT8A@mail.gmail.com>
On Jan 28, 2:06am, Mikael Magnusson wrote:
}
} If i type
} {<enter>
} and press ctrl-c, the " {" is saved in my history file without
} consulting zshaddhistory()
zshaddhistory is consulted, it just immediately returns without doing
anything because the error condition from the keyboard interrupt is
still persisting.
I'm a little reluctant to push this down into callhookfunc() because
it may be the right thing in other contexts that an error condition
prevents hooks from running? Although if that's true we could save
a lot of no-op doshfunc() calls by testing errflag in callhookfunc().
Moved hookargs to the closer scope because why not, and so that the
newlinklist() happens inside queue_signals().
diff --git a/Src/hist.c b/Src/hist.c
index 007366a..7f9e4db 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1378,7 +1378,6 @@ should_ignore_line(Eprog prog)
mod_export int
hend(Eprog prog)
{
- LinkList hookargs = newlinklist();
int flag, hookret, stack_pos = histsave_stack_pos;
/*
* save:
@@ -1418,9 +1417,17 @@ hend(Eprog prog)
DPUTS(hptr < chline, "History end pointer off start of line");
*hptr = '\0';
}
- addlinknode(hookargs, "zshaddhistory");
- addlinknode(hookargs, chline);
- callhookfunc("zshaddhistory", hookargs, 1, &hookret);
+ {
+ LinkList hookargs = newlinklist();
+ int save_errflag = errflag;
+ errflag = 0;
+
+ addlinknode(hookargs, "zshaddhistory");
+ addlinknode(hookargs, chline);
+ callhookfunc("zshaddhistory", hookargs, 1, &hookret);
+
+ errflag |= save_errflag;
+ }
/* For history sharing, lock history file once for both read and write */
hf = getsparam("HISTFILE");
if (isset(SHAREHISTORY) && !lockhistfile(hf, 0)) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author