From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10760 invoked from network); 2 Jul 1999 13:06:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 Jul 1999 13:06:24 -0000 Received: (qmail 15030 invoked by alias); 2 Jul 1999 13:06:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6946 Received: (qmail 15023 invoked from network); 2 Jul 1999 13:06:00 -0000 Date: Fri, 2 Jul 1999 15:05:58 +0200 (MET DST) Message-Id: <199907021305.PAA16582@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Mon, 28 Jun 1999 19:05:56 +0200 Subject: Re: PATCH: pws-24: prompt escapes for script/function and lineno Peter Stephenson wrote: > OK, this makes sense --- %N:%i is certainly unambiguous, and `content over > form' is the zsh motto. (All right, that was a lie.) It's already long > enough when you have lines like > > +/usr/local/lib/hepix/shells/site/aliases.sh:54> [ -r /u/theor/pubtheor/group_aliases.sh ] > > being executed by zsh -f. Why not share some code with `%c' and allow `%N'? Hm, this makes the default be only the last pathname-component, is that ok? Does anyone want to see the whole path anyway? Bye Sven --- os/prompt.c Fri Jul 2 09:04:05 1999 +++ Src/prompt.c Fri Jul 2 14:57:46 1999 @@ -305,10 +305,13 @@ break; case 'c': case '.': + case 'N': { char *t; - if ((nd = finddir(pwd))) + if (*fm == 'N') + t = ztrdup(scriptname ? scriptname : argzero); + else if ((nd = finddir(pwd))) t = tricat("~", nd->nam, pwd + strlen(nd->dir)); else t = ztrdup(pwd); @@ -535,9 +538,6 @@ addbufspc(DIGBUFSIZE); sprintf(bp, "%ld", (long)lineno); bp += strlen(bp); - break; - case 'N': - stradd(scriptname ? scriptname : argzero); break; case '\0': return 0; diff -u od/Zsh/prompt.yo Doc/Zsh/prompt.yo --- od/Zsh/prompt.yo Tue Jun 29 12:51:33 1999 +++ Doc/Zsh/prompt.yo Fri Jul 2 15:04:52 1999 @@ -98,7 +98,9 @@ item(tt(%N))( The name of the script, sourced file, or shell function that zsh is currently executing, whichever was started most recently. If there is -none, this is equivalent to the parameter tt($0). +none, this is equivalent to the parameter tt($0). As for `tt(%c)', an +integer may follow the `tt(%)' to specify the number of trailing +components that should be printed. ) item(tt(%i))( The line number currently being executed in the script, sourced file, or -- Sven Wischnowsky wischnow@informatik.hu-berlin.de