zsh-workers
 help / color / mirror / code / Atom feed
From: Derek Peschel <dpeschel@eskimo.com>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh-workers@sunsite.dk
Subject: Re: PATCH: 4.0.2: rprompt2 variable
Date: Wed, 30 Jan 2002 21:01:04 -0800	[thread overview]
Message-ID: <20020130210103.A28938@eskimo.eskimo.com> (raw)
In-Reply-To: <3C56E82C.64A1D159@yahoo.co.uk>; from okiddle@yahoo.co.uk on Tue, Jan 29, 2002 at 06:21:32PM +0000

On Tue, Jan 29, 2002 at 06:21:32PM +0000, Oliver Kiddle wrote:
> Derek Peschel wrote:
> > 
> > Even if a feature (right-hand prompts) is frivolous, it might as well be
> > available in general.
> > 
> > Now you can see the parser state (or whatever else you might want to put
> > in PROMPT2) and still have a consistent left margin when entering a multi-
> > line command.  See my companion "reverse parser state" patch if you want
> > the parser state to expand leftward on your screen.
> > 
> > Comments welcome (I just started using zsh and I have no idea if anyone
> > else will find these patches useful).
> 
> I'd just like to say that I like this. I've never actually used
> rprompts but this with the transient_rprompt option (new since 4.0.2)
> is useful. For one thing, it makes life easier if I decide to cut 'n'
> paste the lines into an editor or other terminal because I don't then
> have a prompt to get rid of. I fear that other people may want a
> separate transient_rprompt2 option with this.

Because you mentioned it, I decided to see how easy it is to add.
(I'm not sure why people would want one prompt transient and not the
other, but I also don't like it when programs make assumptions that
prevent me from doing something.)

> > %_ no longer treats negative integers like zero, but instead extracts
> > leading (outermost) words.  Maybe someone somewhere cares more about
> > the outer state than the inner state.
> > 
> > %^ works like %_ (including the behavior described above) but after
> > the words are selected they are printed in reverse order.  Try using %^
> > in RPS2.
> > 
> > I picked ^ because it comes before _ in ASCII.
> 
> I'm not sure whether the negative integers part might ever be useful
> though I have no objections because it is logical. I'd be tempted to
> use negative numbers for reversing the order but -0 not being a
> distinct number from +0 makes that less clean as a solution.

It's very important for programs (especially large and complicated ones)
to act consistently IMO.  Some of the other prompt escapes (like the one
for the current directory) already use the sign to choose between first
and last components.  I don't think any other escapes have a "reverse order"
feature.

I'm not sure whether the negative integer feature might be useful either.
Though someone might not like the way the line changes from

	for for for if then
to
	for for if then if

and reason that if the line is going to get too long, it should just
stop growing.  So leaving the feature out on principle seems a bit
presumptuous to me (especially since it was easy to add and didn't use
very much code).

Would it be possible to do the reversal using the precmd feature?  (Can
you "print" the prompt to a string?)  If so, then the %^ escape can go.
And that makes more sense as the code to take out, since none of the
other escapes has a "reverse order" feature.

-- Derek


  reply	other threads:[~2002-01-31  5:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-25 12:48 Derek Peschel
2002-01-29 18:21 ` Oliver Kiddle
2002-01-31  5:01   ` Derek Peschel [this message]
2002-01-31 14:12     ` Oliver Kiddle
2002-01-31 12:06   ` Peter Stephenson

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=20020130210103.A28938@eskimo.eskimo.com \
    --to=dpeschel@eskimo.com \
    --cc=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.dk \
    /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).