zsh-workers
 help / color / mirror / code / Atom feed
From: Jim <linux.tech.guy@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: devs <zsh-workers@zsh.org>
Subject: Re: history expansion - modifiers :h and :t - questions
Date: Tue, 31 Oct 2023 14:21:17 -0500	[thread overview]
Message-ID: <CA+rB6GKjAW5v5FBanTVp37XbisZQER-nrGJOJRKeRhF+92GRrg@mail.gmail.com> (raw)
In-Reply-To: <CA+rB6GJbVezqj+15mH_ZTD8BLh9ZUkNOy5t=o+UASpQvROkApQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]

On Tue, Oct 24, 2023 at 4:56 PM Bart Schaefer <schaefer@brasslantern.com>
> wrote:
>
> The documentation for :t is being a bit too literal.  More accurate
>> would be to say that 0 is always the same as having no digit at all.
>>
>
Does the following patch make sense?  This applies to both h and t
modifiers.
t already references h as to what actions digits have on the two modifiers
and
the exception t has.

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 837a85db6..6de49bff6 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -276,7 +276,8 @@ substitution tt($var:h2) is treated as tt(${var:h}2),
not as
 tt(${var:h2}).  No restriction applies to the use of digits in history
 substitution or globbing qualifiers.  If more components are requested
 than are present, the entire path is substituted (so this does not
-trigger a `failed modifier' error in history expansion).
+trigger a `failed modifier' error in history expansion).  0 is treated
+the same as if there were no digits.
 )
 item(tt(l))(
 Convert the words to all lowercase.
@@ -342,7 +343,7 @@ Remove all leading pathname components, leaving the
final component (tail).
 This works like `tt(basename)'.  Any trailing slashes are first removed.
 Decimal digits are handled as described above for (h), but in this
 case that number of trailing components is preserved instead of
-the default 1; 0 is treated the same as 1.
+the default 1.
 )
 item(tt(u))(
 Convert the words to all uppercase.

Just a thought.  Thanks.

Regards,

Jim Murphy

[-- Attachment #2: Type: text/html, Size: 2286 bytes --]

  reply	other threads:[~2023-10-31 19:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 19:23 Jim
2023-10-24 21:56 ` Bart Schaefer
2023-10-24 23:24   ` Jim
2023-10-31 19:21     ` Jim [this message]
2023-10-26  6:33   ` Stephane Chazelas

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=CA+rB6GKjAW5v5FBanTVp37XbisZQER-nrGJOJRKeRhF+92GRrg@mail.gmail.com \
    --to=linux.tech.guy@gmail.com \
    --cc=linuxtechguy@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@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).