Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: prexec never gets empty string?



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