Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

$PS2 change



I'd like to propose a couple of essentially cosmetic changes in the
way PS2 is treated; these are far from urgent and don't need to happen
now, though the chance of them causing problems is essentially nil:

1) the %_ which shows shell constructs started should default to
showing all constructs, instead of 1 as it does at present.  You can
get just one entirely naturally as %1_; you can't get all constructs
naturally at all at the moment.  You can do %100_, of course, but
that's not nice.

(If this had been done with other %-codes, we wouldn't need the
difference between %m and %M, etc., which I find a bit confusing.  I
don't see why %m shouldn't do what %M does, and %1m what %m and %1m
both now do, the single-letter form being much easier to remember and
to read off.  The same goes even more for the six different ways of
getting PWD or bits thereof, when two --- one with tildes, one without
--- would be quite adequate.  Still, too late now.  Looks like this
came from tcsh.  (Actually, it's not quite too late: we could have %M,
%/ and %~ also handling path components, with just the default ---
full expansion instead of single component --- being different.  I
would prefer this.))

2) the default for PS2 should be "%_> " instead of just "> ".  This
is the only conceivable purpose for %_; we might as well use it,
especially given that the default PS1 contains escapes.  I'll bet 90%
of ornery zsh users would think this is a new feature.  Anyone
finnicky enough not to like this isn't going to have problems sticking
PS2="> " in .zshrc.

(I've had complaints that the default set up for zsh isn't as smart as
it could be for the average user, this is one trivial way to redress the
balance.)

*** Doc/zshparam.man.cmdsp	Tue Aug  6 09:34:47 1996
--- Doc/zshparam.man	Mon Aug 12 10:38:07 1996
***************
*** 565,571 ****
  .B %_
  The status of the parser, i.e. the shell constructs (like `if' and
  `for') that have been started on the command line. If given an integer
! number that many strings will be printed.
  .TP
  .B %E
  Clears to end of line.
--- 565,572 ----
  .B %_
  The status of the parser, i.e. the shell constructs (like `if' and
  `for') that have been started on the command line. If given an integer
! number that many strings will be printed; zero or no integer means
! print as many as there are.
  .TP
  .B %E
  Clears to end of line.
***************
*** 682,688 ****
  The secondary prompt, printed when the shell needs more information
  to complete a command.
  Recognizes the same escape sequences as \fB$PS1\fP.
! The default is "> ".
  .TP
  .B PS3
  Selection prompt used within a \fBselect\fP loop.
--- 683,690 ----
  The secondary prompt, printed when the shell needs more information
  to complete a command.
  Recognizes the same escape sequences as \fB$PS1\fP.
! The default is "%_> ", which displays any shell constructs or quotation
! marks which are currently being processed.
  .TP
  .B PS3
  Selection prompt used within a \fBselect\fP loop.
*** Src/init.c.cmdsp	Sat Aug  3 04:43:24 1996
--- Src/init.c	Fri Aug  9 18:20:43 1996
***************
*** 506,512 ****
      /* Set default prompts */
      if (opts[INTERACTIVE]) {
  	prompt  = ztrdup("%m%# ");
! 	prompt2 = ztrdup("> ");
  	prompt3 = ztrdup("?# ");
  	prompt4 = ztrdup("+ ");
      } else {
--- 506,512 ----
      /* Set default prompts */
      if (opts[INTERACTIVE]) {
  	prompt  = ztrdup("%m%# ");
! 	prompt2 = ztrdup("%_> ");
  	prompt3 = ztrdup("?# ");
  	prompt4 = ztrdup("+ ");
      } else {
*** Src/zle_misc.c.cmdsp	Wed Jul 31 17:43:13 1996
--- Src/zle_misc.c	Fri Aug  9 18:16:35 1996
***************
*** 1241,1249 ****
  		break;
  	    case '_':
  		if (cmdsp) {
! 		    if (arg <= 0)
! 			arg = 1;
! 		    if (arg > cmdsp)
  			arg = cmdsp;
  		    for (t0 = cmdsp - arg; arg--; t0++) {
  			stradd(cmdnames[cmdstack[t0]]);
--- 1241,1247 ----
  		break;
  	    case '_':
  		if (cmdsp) {
! 		    if (arg > cmdsp || arg <= 0)
  			arg = cmdsp;
  		    for (t0 = cmdsp - arg; arg--; t0++) {
  			stradd(cmdnames[cmdstack[t0]]);

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



Messages sorted by: Reverse Date, Date, Thread, Author