zsh-workers
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-workers@zsh.org
Subject: Re: first adventures
Date: Wed, 29 Oct 2014 08:41:10 -0700	[thread overview]
Message-ID: <54510A96.20009@eastlink.ca> (raw)
In-Reply-To: <141028210510.ZM10784@torch.brasslantern.com>

On 10/28/2014 09:05 PM, Bart Schaefer wrote:
> } ... so, I finally have my gloriously, deliciously unexpanded, plain
> } vanilla command, exactly as I
>
> Well, you think so, but really it just happens that nothing you typed
> needed to be metafied.
Deo volente! For now I don't even want to think about metafying, my head 
would explode.

> History is expanded by the lexer as each word is consumed, because as
> I mentioned in private email, the expansion has to be re-analyzed to
> correctly tokenize it.  So the previously-discussed point in input.c
> where VERBOSE is handled, is the line with history expanded.
Yeah, that's the right form, but at that point, it's so generous, it 
prints everything the
shell does, like preexec(), and the whole init of the shell.
>
> When prog is non-NULL (the else branch of that if), it contains the
> compiled form of the input code, which is already broken up into the
> set of commands that will be executed.  There is no human-readable
> decomposed form of the individual commands that make up a finished
> input event; getpermtext(prog) returns the readable form of the entire
> thing, which is the closest you get.
Right, it looks good, and each command is on it's own line;

     $ ls init.c*; ls $PWD/main.* > /tmp/junk
     FILE: init.c LINE: 185
     ls init.c*
     ls $PWD/main.* > /tmp/junk

     (output)

It's proof against expansion of glob, variables and redirection ... 
pretty much all I'm thinking of.
bangchar/history is expanded, and so are aliases, but that's good.
So, if there was just some way of matching each line of that output from 
getpermtext() with the
appropriate command, then I'd be close to the finish line. if, in:

    $ ls main.c; ls init.c; ls version.h

... 'ls init.c' could 'know' that it is  command #2 of 3, then I could 
grab line #2 from getpermtext(), and
if I could then assign that to a shell variable, I'd have exactly what I 
want: each command would have
access to the verbatim command line 'segment' that called it (that is, 
between the semicolons).



  reply	other threads:[~2014-10-29 16:08 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
2014-10-29  4:05     ` Bart Schaefer
2014-10-29 15:41       ` Ray Andrews [this message]
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=54510A96.20009@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).