zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: Zsh Users <zsh-users@zsh.org>
Subject: command tails
Date: Sun, 16 Apr 2023 08:59:02 -0700	[thread overview]
Message-ID: <b8c7b5a1-83f4-0e00-ac0f-0476237d9cb7@eastlink.ca> (raw)

[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]

Bart sez make a new thread so here it is.


If in the example above the tail is 'arg', then it should also be
'arg' in the following example:

     % list=(arg)
     % my_function $list

>>	No, positively not, the tail is "$list" -- the literal text unexpanded.

This contradicts what you described earlier. If this is not enough,
consider yet another example:

     % ls
     my_function xyz
     % *

What is tail here?

>>	It's "xyz" -- again, the unexpanded literal.

>   And one intuitively sees that zle will be a good candidate for a solution
> because once ENTER is pressed, what it has in it's buffer must needs be
> a sequence of raw keystrokes.

Indeed, if you need the raw command as it was typed, you can get it from zle.

>>	But first Bart had some suggestions from yesterday, I want to play with them first.


> But, broken by semicolons so that chained commands know
> where their own tail ends.

Let's see if this makes sense.

     % alias -g sep='hi ; echo'
     % echo sep bye

What do you want to capture when the last line gets executed?

>>	Too Byzantine, I'm never going to run into any such issue.  'my_function' should report the literal keystrokes that follow it, terminated by ENTER (or a semicolon, whichever come first).  Whatever would be sent to history (but broken by semicolons if possible).  The theoretical aspects are interesting but really this is a question of gritty practicalities.  '% print -rS' knows what I'm looking for.  Obviously things can't be expanded before writing to history!  I'd like to be able to access that unexpanded form without doing it via history if possible and, in the best of all possible worlds, even being able to 'break up' chained commands (but it's not important cuz I'm never actually going to chain my commands; I just think that in principal it should be possible for any command to 'see' it's unexpanded tail).

But first, a short diversion.


[-- Attachment #2: Type: text/html, Size: 2502 bytes --]

             reply	other threads:[~2023-04-16 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16 15:59 Ray Andrews [this message]
2023-04-16 16:13 ` Roman Perepelitsa

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=b8c7b5a1-83f4-0e00-ac0f-0476237d9cb7@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@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).