From: Peter Stephenson <p.stephenson@samsung.com>
To: <zsh-users@zsh.org>
Subject: Re: P modify in history event
Date: Mon, 18 Nov 2019 09:47:09 +0000 [thread overview]
Message-ID: <1574070429.4551.2.camel@samsung.com> (raw)
In-Reply-To: <BEBF5AEC-185E-4887-98D7-4731E1D8F7B0@easesoftware.com>
On Sun, 2019-11-17 at 12:42 -0600, Perry Smith wrote:
> I’m (slowly) reading through zshexpn and playing with things to
> learn. This does not work:
>
> >
> > pedz@MysticSlate my-play-dir % echo /this/is/a/../../path
> > /this/is/a/../../path
> > pedz@MysticSlate my-play-dir % echo !$:P
> > zsh: illegal modifier: P
> even if the file specified exists
I think it just got missed out of the history modifiers, which are
handled in a different place from the modifiers in the case of glob
qualifiers and vaariables.
pws
diff --git a/Src/hist.c b/Src/hist.c
index fd5606dc3..e47be8e15 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -920,6 +920,16 @@ histsubchar(int c)
case 'u':
sline = casemodify(sline, CASMOD_UPPER);
break;
+ case 'P':
+ if (*sline != '/') {
+ char *here = zgetcwd();
+ if (here[strlen(here)-1] != '/')
+ sline = zhtricat(metafy(here, -1, META_HEAPDUP), "/", sline);
+ else
+ sline = dyncat(here, sline);
+ }
+ sline = xsymlink(sline, 1);
+ break;
default:
herrflush();
zerr("illegal modifier: %c", c);
next prev parent reply other threads:[~2019-11-18 9:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20191117184333epcas5p15bc1aa7b0f78182c3d1acc703f55d445@epcas5p1.samsung.com>
2019-11-17 18:42 ` Perry Smith
2019-11-18 9:47 ` Peter Stephenson [this message]
2019-11-19 18:00 ` Daniel Shahaf
2019-11-19 18:21 ` Peter Stephenson
2019-11-19 19:03 ` Daniel Shahaf
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=1574070429.4551.2.camel@samsung.com \
--to=p.stephenson@samsung.com \
--cc=zsh-users@zsh.org \
/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).