zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Derek Gleim <mail@dcgleim.com>, zsh workers <zsh-workers@zsh.org>
Subject: Re: prexec never gets empty string?
Date: Mon, 16 Feb 2015 15:59:20 +0000	[thread overview]
Message-ID: <20150216155920.699add98@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CANOe-=7Oa8pT4SSVwnpKsNrKbCFiX_x=abS1HVBcqzmt9cg3hw@mail.gmail.com>

On Mon, 16 Feb 2015 09:11:07 -0600
Derek Gleim <mail@dcgleim.com> wrote:
> > 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.

Yes, it looks like that's been wrong for a long time.

> 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).

It's perfectly possible you've hit a conflict that no one else has --- I
don't think %! is that commonly used.  Without some kind of internal
workaround it's hard to see what you can do without simply preforming
the same check as the history doesl.  One way of doing it would be
always to use zshaddhistory with appropriate logic and note there what
whether the line was to be ignored --- but it wouldn't be that surprsing
if there were corresponding gotchas there, too.

pws


diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo
index 6e9cfee..ace0a40 100644
--- a/Doc/Zsh/func.yo
+++ b/Doc/Zsh/func.yo
@@ -247,10 +247,10 @@ findex(preexec)
 vindex(preexec_functions)
 item(tt(preexec))(
 Executed just after a command has been read and is about to be
-executed.  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.  The
-actual command that will be executed (including expanded aliases) is
+executed.  If the history mechanism is active (regardless of whether
the +line was discarded from the history buffer), the string that the
user +typed is passed as the first argument, otherwise it is an empty
string. +The actual command that will be executed (including expanded
aliases) is passed in two different forms: the second argument is a
single-line, size-limited version of the command (with things like
function bodies elided); the third argument contains the full text that
is being

-- 
Peter Stephenson | Principal Engineer Samsung Cambridge Solution Centre
Email: p.stephenson@samsung.com | Phone: +44 1223 434724 |
www.samsung.com


  parent reply	other threads:[~2015-02-16 15:59 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
2015-02-16 15:59         ` Peter Stephenson [this message]
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=20150216155920.699add98@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=mail@dcgleim.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).