zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: pws-24: prompt escapes for script/function and lineno
Date: Fri, 2 Jul 1999 15:05:58 +0200 (MET DST)	[thread overview]
Message-ID: <199907021305.PAA16582@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Mon, 28 Jun 1999 19:05:56 +0200


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 `%<number>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


             reply	other threads:[~1999-07-02 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-02 13:05 Sven Wischnowsky [this message]
1999-07-02 15:54 ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
1999-06-28  9:32 Sven Wischnowsky
1999-06-28 13:08 ` Andrej Borsenkow
1999-06-28 17:05   ` Peter Stephenson
1999-06-29 15:31     ` Bart Schaefer
1999-06-29 15:40       ` Andrej Borsenkow
1999-06-28  9:00 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=199907021305.PAA16582@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.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).