Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prexec never gets empty string?
- X-seq: zsh-workers 34557
- From: Derek Gleim <mail@xxxxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: prexec never gets empty string?
- Date: Mon, 16 Feb 2015 09:16:58 -0600
- Cc: zsh workers <zsh-workers@xxxxxxx>
- In-reply-to: <CANOe-=7Oa8pT4SSVwnpKsNrKbCFiX_x=abS1HVBcqzmt9cg3hw@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: <CADS3xe8na+zBiEMT1qp+pjLXtDxzvRmC7QVjCt5VXSUu_1jbmA@mail.gmail.com> <CAHYJk3RKv8bZUy-DS3-QWZ6ykRRZejrF0Wwpwa=wdA1-1HCNZw@mail.gmail.com> <CANOe-=7ti2p7uUAAtD309i1BkfmUwPtK+3K0eunJJkmkEJnpGQ@mail.gmail.com> <20150214213757.010b0c82@ntlworld.com> <CANOe-=7Oa8pT4SSVwnpKsNrKbCFiX_x=abS1HVBcqzmt9cg3hw@mail.gmail.com>
Sorry, I meant "minus one from the normal event count" in my
half-baked example.
On Mon, Feb 16, 2015 at 9:11 AM, Derek Gleim <mail@xxxxxxxxxxx> wrote:
> I understood the real intent of preexec, I hoped I could use it as part of
> some work-around for my real goal: to /detect/ when a command was (or, is
> about to be, seems to be the more accurate way of putting it?) ignored from
> history. Something like "if preexex sees an command destined to be
> ignored by
> history, add one to the normal event count". Just to re-cap, I thought I
> could because of this bit in the manual:
>
> > If the history mechanism is active (and the line was not discarded from
> the
> > history buffer), the string that the user typed is passed as the first
> > argument, otherwise it is an empty string.
>
> An impression that was reinforced for me when I also found the first post
> Mikael cited:
>
> > when the current command is discarded from the history (as is often the
> case
> > when the user is ignoring functions, history commands, and/or lines that
> > start with a space) ... so I decided to set the first parameter to an
> empty
> > string when this happens.
>
> ... But, I missed the second post linked talking about leaving it off. So,
> thanks, not a bug, looks like the docs just need an update (21 days in
> 2001,
> ha!).
>
> As an aside, I'd still like to be able to get the prompt expansion `%!` to
> always show the number to be assigned to the next command...
>
> % PROMPT='%! >' zsh --no-rcs --histignorespace
> 1 > true ignore me
> 2 >this command will really be event 1
> 2 >
>
> ... maybe it's just me, but it trips me up sometimes (and histnostore has
> the
> same behavior). But, looks like re-purposing preexec is a dead-end.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author