From: Derek Gleim <mail@dcgleim.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>,
Mikael Magnusson <mikachu@gmail.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: prexec never gets empty string?
Date: Mon, 16 Feb 2015 09:16:58 -0600 [thread overview]
Message-ID: <CANOe-=7Mm+dUE-4vk9XaR9Zi=n4DGgvkuy31aDD3qWNZ906yzw@mail.gmail.com> (raw)
In-Reply-To: <CANOe-=7Oa8pT4SSVwnpKsNrKbCFiX_x=abS1HVBcqzmt9cg3hw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]
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@dcgleim.com> 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.
>
next prev parent reply other threads:[~2015-02-16 15:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-13 17:19 Derek Gleim
2015-02-13 17:35 ` Peter Stephenson
2015-02-13 19:27 ` Derek Gleim
2015-02-13 20:19 ` Peter Stephenson
2015-02-13 22:16 ` Mikael Magnusson
2015-02-13 22:41 ` Derek Gleim
2015-02-13 23:04 ` Mikael Magnusson
2015-02-13 23:14 ` Mikael Magnusson
2015-02-14 21:37 ` Peter Stephenson
2015-02-16 15:11 ` Derek Gleim
2015-02-16 15:16 ` Derek Gleim [this message]
2015-02-16 15:59 ` Peter Stephenson
2015-02-17 17:09 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANOe-=7Mm+dUE-4vk9XaR9Zi=n4DGgvkuy31aDD3qWNZ906yzw@mail.gmail.com' \
--to=mail@dcgleim.com \
--cc=mikachu@gmail.com \
--cc=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).