zsh-workers
 help / color / mirror / code / Atom feed
* %l prompt expansion change
       [not found] ` <handler.s.R.99297392428467.info.0@bugs.debian.org>
@ 2001-06-19 18:10   ` Clint Adams
  2001-06-19 18:34     ` Andrej Borsenkow
  0 siblings, 1 reply; 10+ messages in thread
From: Clint Adams @ 2001-06-19 18:10 UTC (permalink / raw)
  To: nobse, 101083; +Cc: zsh-workers


> PS1='<%?>%n@%m[%l]:%~%# '
> <0>tretkowski@infinity[tty9]:~%
>                        ^^^
> When I use a zsh binary from potato, %l is handled correct:
> 
> <0>tretkowski@infinity[tty9]:~% ./zsh    <-- potato binary
> <0>tretkowski@infinity[9]:~%

Can you explain what makes this incorrect rather than aesthetic?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: %l prompt expansion change
  2001-06-19 18:10   ` %l prompt expansion change Clint Adams
@ 2001-06-19 18:34     ` Andrej Borsenkow
  2001-06-20 17:01       ` Bart Schaefer
  0 siblings, 1 reply; 10+ messages in thread
From: Andrej Borsenkow @ 2001-06-19 18:34 UTC (permalink / raw)
  To: Clint Adams; +Cc: nobse, 101083, zsh-workers

On Tue, 19 Jun 2001, Clint Adams wrote:

>
> > PS1='<%?>%n@%m[%l]:%~%# '
> > <0>tretkowski@infinity[tty9]:~%
> >                        ^^^
> > When I use a zsh binary from potato, %l is handled correct:
> >
> > <0>tretkowski@infinity[tty9]:~% ./zsh    <-- potato binary
> > <0>tretkowski@infinity[9]:~%
>
> Can you explain what makes this incorrect rather than aesthetic?
>

Well, mostly aesthetic considerations. It is `0' om /dev/tty0 and pts/3 or
term/4 somewhere else. Also, ps usually shows tty line as base name sans
/dev/. And not every Unix is Linux yet to treat /dev/tty* specially.

In short, consistency considerations.

I asked if somebody was against this change. In a couple weeks I got some
personal replies "go ahead" and none said "no". So I committed it. Change
it back if you wish; I guess I just stop using %l in prompt again then :-)

-andrej



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: %l prompt expansion change
  2001-06-19 18:34     ` Andrej Borsenkow
@ 2001-06-20 17:01       ` Bart Schaefer
  2001-06-20 17:34         ` Andrej Borsenkow
  0 siblings, 1 reply; 10+ messages in thread
From: Bart Schaefer @ 2001-06-20 17:01 UTC (permalink / raw)
  To: Andrej Borsenkow, Clint Adams; +Cc: nobse, 101083, zsh-workers

On Jun 19, 10:34pm, Andrej Borsenkow wrote:
} Subject: Re: %l prompt expansion change
}
} On Tue, 19 Jun 2001, Clint Adams wrote:
} 
} > > PS1='<%?>%n@%m[%l]:%~%# '
} > > <0>tretkowski@infinity[tty9]:~%
} > >                        ^^^
} > > When I use a zsh binary from potato, %l is handled correct:
} > >
} > > <0>tretkowski@infinity[tty9]:~% ./zsh    <-- potato binary
} > > <0>tretkowski@infinity[9]:~%
} >
} > Can you explain what makes this incorrect rather than aesthetic?
} 
} Well, mostly aesthetic considerations. It is `0' om /dev/tty0 and pts/3 or
} term/4 somewhere else. Also, ps usually shows tty line as base name sans
} /dev/. And not every Unix is Linux yet to treat /dev/tty* specially.

The treatment of /dev/tty* has nothing to do with Linux, and everything
to do with old BSD around 4.2, where real TTYs were named /dev/ttyt* and
PTYs were named /dev/ttyp*, and the intent was to have %l expand to e.g.
"t9" or "p9".  The idea of logging in on a real system console with a
/dev/tty<-> name probably never occurred to PF -- unix machines were
almost exclusively time-sharing when this code was first written.

I can almost guarantee that PF never expected %l to expand to include an
entire directory name like "pts/" or "term/".  Prompts are intended to be
extremely concise, to maximize editing space.  That's why RPROMPT came to
exist: a prompt that could be verbose but would get out of the way when
your command line got long.
 
} I asked if somebody was against this change.

Well, we asked if anybody was against the HIST_NO_STORE change, too, and
now Vincent is complaining about it.  Probably we should ask these kinds
of questions on zsh-users (without including the proposed patch).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: %l prompt expansion change
  2001-06-20 17:01       ` Bart Schaefer
@ 2001-06-20 17:34         ` Andrej Borsenkow
  2001-06-20 17:38           ` Clint Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Andrej Borsenkow @ 2001-06-20 17:34 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Clint Adams, nobse, 101083, zsh-workers

On Wed, 20 Jun 2001, Bart Schaefer wrote:

> }
> } Well, mostly aesthetic considerations. It is `0' om /dev/tty0 and pts/3 or
> } term/4 somewhere else. Also, ps usually shows tty line as base name sans
> } /dev/. And not every Unix is Linux yet to treat /dev/tty* specially.
>
> The treatment of /dev/tty* has nothing to do with Linux, and everything
> to do with old BSD around 4.2, where real TTYs were named /dev/ttyt* and
> PTYs were named /dev/ttyp*, and the intent was to have %l expand to e.g.
> "t9" or "p9".  The idea of logging in on a real system console with a
> /dev/tty<-> name probably never occurred to PF -- unix machines were
> almost exclusively time-sharing when this code was first written.
>
> I can almost guarantee that PF never expected %l to expand to include an
> entire directory name like "pts/" or "term/".  Prompts are intended to be
> extremely concise, to maximize editing space.  That's why RPROMPT came to
> exist: a prompt that could be verbose but would get out of the way when
> your command line got long.
>

It already expands to term/* if tty is /dev/term/*. So, the point of my
patch was to eliminate inconsistency. It is hard to me (sorry) to remember
that {0} is tty0 when most of the time I have {pts/3} or like.


> } I asked if somebody was against this change.
>
> Well, we asked if anybody was against the HIST_NO_STORE change, too, and
> now Vincent is complaining about it.  Probably we should ask these kinds
> of questions on zsh-users (without including the proposed patch).
>

But Clint is on zsh-workers list. No offence intended.

-andrej


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: %l prompt expansion change
  2001-06-20 17:34         ` Andrej Borsenkow
@ 2001-06-20 17:38           ` Clint Adams
  2001-06-20 17:52             ` Andrej Borsenkow
  0 siblings, 1 reply; 10+ messages in thread
From: Clint Adams @ 2001-06-20 17:38 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Bart Schaefer, nobse, 101083, zsh-workers

> But Clint is on zsh-workers list. No offence intended.

I use /dev/pts everywhere I can, so it doesn't much affect me.
I was just passing on Norbert's objection.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: %l prompt expansion change
  2001-06-20 17:38           ` Clint Adams
@ 2001-06-20 17:52             ` Andrej Borsenkow
  2001-06-20 18:24               ` Wayne Davison
  0 siblings, 1 reply; 10+ messages in thread
From: Andrej Borsenkow @ 2001-06-20 17:52 UTC (permalink / raw)
  To: Clint Adams; +Cc: Andrej Borsenkow, Bart Schaefer, nobse, 101083, zsh-workers

On Wed, 20 Jun 2001, Clint Adams wrote:

> > But Clint is on zsh-workers list. No offence intended.
>
> I use /dev/pts everywhere I can, so it doesn't much affect me.
> I was just passing on Norbert's objection.
>

As I said I do not push it. I just find it more lgical and consistemt.

I agree, that putting it into 4.0.2 was probably a mistake.

-andrej


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: %l prompt expansion change
  2001-06-20 17:52             ` Andrej Borsenkow
@ 2001-06-20 18:24               ` Wayne Davison
  2001-06-21  9:46                 ` PATCH: %y modifier in prompt substitution " Andrej Borsenkow
  0 siblings, 1 reply; 10+ messages in thread
From: Wayne Davison @ 2001-06-20 18:24 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Zsh Workers

One solution might be to restore the old %l behavior and put the new,
consistent tty-output behavior onto a new expansion, like %y, perhaps.

..wayne..


^ permalink raw reply	[flat|nested] 10+ messages in thread

* PATCH: %y modifier in prompt substitution RE: %l prompt expansion change
  2001-06-20 18:24               ` Wayne Davison
@ 2001-06-21  9:46                 ` Andrej Borsenkow
  2001-06-22  8:26                   ` Andrej Borsenkow
  0 siblings, 1 reply; 10+ messages in thread
From: Andrej Borsenkow @ 2001-06-21  9:46 UTC (permalink / raw)
  To: Zsh Workers


>
> One solution might be to restore the old %l behavior and put the new,
> consistent tty-output behavior onto a new expansion, like %y, perhaps.
>

I hope this suites everybody ...

-andrej

BTW the list of characters in prompt subst manual is hopelessly out of
order.

Index: Src/prompt.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/prompt.c,v
retrieving revision 1.6
diff -u -r1.6 prompt.c
--- Src/prompt.c        2001/06/06 16:38:50     1.6
+++ Src/prompt.c        2001/06/21 09:45:33
@@ -515,6 +515,14 @@
                break;
            case 'l':
                if (*ttystrname) {
+                   ss = (strncmp(ttystrname, "/dev/tty", 8) ?
+                           ttystrname + 5 : ttystrname + 8);
+                   stradd(ss);
+               } else
+                   stradd("()");
+               break;
+           case 'y':
+               if (*ttystrname) {
                    ss = (strncmp(ttystrname, "/dev/", 5) ?
                            ttystrname : ttystrname + 5);
                    stradd(ss);
Index: Doc/Zsh/prompt.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/prompt.yo,v
retrieving revision 1.3
diff -u -r1.3 prompt.yo
--- Doc/Zsh/prompt.yo   2000/07/13 11:20:46     1.3
+++ Doc/Zsh/prompt.yo   2001/06/21 09:45:34
@@ -120,7 +120,12 @@
 (24/12 hour clock) in the same way.
 )
 item(tt(%l))(
-The line (tty) the user is logged in on.
+The line (tty) the user is logged in on without tt(/dev/) prefix.
+If name starts with tt(/dev/tty) this is stripped.
+)
+item(tt(%y))(
+The line (tty) the user is logged in on without tt(/dev/) prefix.
+It does not treat tt(/dev/tty*) specially.
 )
 item(tt(%?))(
 The return code of the last command executed just before the prompt.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: PATCH: %y modifier in prompt substitution RE: %l prompt expansion change
  2001-06-21  9:46                 ` PATCH: %y modifier in prompt substitution " Andrej Borsenkow
@ 2001-06-22  8:26                   ` Andrej Borsenkow
  2001-06-22  9:31                     ` Peter Stephenson
  0 siblings, 1 reply; 10+ messages in thread
From: Andrej Borsenkow @ 2001-06-22  8:26 UTC (permalink / raw)
  To: Zsh Workers


> >
> > One solution might be to restore the old %l behavior and put the new,
> > consistent tty-output behavior onto a new expansion, like %y, perhaps.
> >
>
> I hope this suites everybody ...
>


Is it O.K. to commit it? Should it go into 4.0 as well (else I just backup
my previous patch).

-andrej


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PATCH: %y modifier in prompt substitution RE: %l prompt expansion change
  2001-06-22  8:26                   ` Andrej Borsenkow
@ 2001-06-22  9:31                     ` Peter Stephenson
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Stephenson @ 2001-06-22  9:31 UTC (permalink / raw)
  To: Zsh hackers list

> Is it O.K. to commit it? Should it go into 4.0 as well (else I just backup
> my previous patch).

I suppose you might as well do the same to both.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-06-22  9:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010619140521.A13262@dman.com>
     [not found] ` <handler.s.R.99297392428467.info.0@bugs.debian.org>
2001-06-19 18:10   ` %l prompt expansion change Clint Adams
2001-06-19 18:34     ` Andrej Borsenkow
2001-06-20 17:01       ` Bart Schaefer
2001-06-20 17:34         ` Andrej Borsenkow
2001-06-20 17:38           ` Clint Adams
2001-06-20 17:52             ` Andrej Borsenkow
2001-06-20 18:24               ` Wayne Davison
2001-06-21  9:46                 ` PATCH: %y modifier in prompt substitution " Andrej Borsenkow
2001-06-22  8:26                   ` Andrej Borsenkow
2001-06-22  9:31                     ` Peter Stephenson

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