From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-workers@zsh.org
Subject: Re: first adventures
Date: Tue, 28 Oct 2014 10:48:13 -0700 [thread overview]
Message-ID: <544FD6DD.7010806@eastlink.ca> (raw)
In-Reply-To: <20141026175257.2611487b@pws-pc.ntlworld.com>
On 10/26/2014 10:52 AM, Peter Stephenson wrote:
Peter, Bart:
First hints of traction:
> That's how it works for interactive shells. The lowest level of input
> in the main shell is within input.c. Because zle is a separate library
> that may be loaded at run time the interaction actually goes through
> the function zleentry() in init.c, which ensures that either zle is
> loaded or if it can't be there's some fallback to get the input
> another way. ZLE_CMD_READ is the command to zleentry() that causes a
> line to be read. shingetline() is the fallback for non-interactive
> shells or if zle can't be loaded. va_end(ap);
At the bottom of zleentry():
///
printf("FILE: %s LINE: %d\n", __FILE__, __LINE__);
puts(ret);
return ret;
}
I get:
$ !4562; ls zsh.*
ls e*; ls zsh.* << exactly as typed, but
with bangchar expanded.
FILE: init.c LINE: 1535
!4562; ls zsh.* << exactly exactly as typed :)
(output)
... so, I finally have my gloriously, deliciously unexpanded, plain
vanilla command, exactly as I
typed it. (BTW, 'cmd = -1' and this doesn't seem to be handled by
'ZLE_CMD_READ' but nevermind.)
However, as Bart has explained, I really do want to be able to capture
the bangchar/history thing expanded
line as well, precisely as shown by the shell anyway:
ls e*; ls zsh.* << exactly as typed, but
with bangchar expanded.
Where can I capture that output? AFAICT, that's exactly as it gets
written to .histfile, so it should
be easy enough to intercept.
Finally, if we have several commands on one line, at some point the line
must be chopped up
at the semicolons for execution, since each individual command only
'gets' that part of the
line that applies to it. How can that be done? (I was speculating that
if each command
could somehow know that it was (say) command #3 on that line, then one
might very inelegantly
parse the .histfile line, counting semicolons, and chop it up that way,
but how ugly is that.)
next prev parent reply other threads:[~2014-10-28 17:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-26 17:20 Ray Andrews
2014-10-26 17:50 ` Bart Schaefer
2014-10-26 18:04 ` Bart Schaefer
2014-10-26 18:41 ` Ray Andrews
2014-10-26 19:57 ` Ray Andrews
2014-10-26 21:04 ` Bart Schaefer
2014-10-27 3:48 ` Ray Andrews
2014-10-27 6:08 ` Bart Schaefer
2014-10-26 17:52 ` Peter Stephenson
2014-10-28 17:48 ` Ray Andrews [this message]
2014-10-29 4:05 ` Bart Schaefer
2014-10-29 15:41 ` Ray Andrews
2014-10-29 20:46 ` Bart Schaefer
2014-10-29 23:31 ` Ray Andrews
2014-10-30 4:07 ` Bart Schaefer
2014-10-30 17:22 ` Ray Andrews
2014-10-31 1:59 ` Ray Andrews
2014-10-31 2:59 ` 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=544FD6DD.7010806@eastlink.ca \
--to=rayandrews@eastlink.ca \
--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).