Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: modifiers applied after e qualifier but before oe?
- X-seq: zsh-users 26834
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users List <zsh-users@xxxxxxx>
- Subject: Re: modifiers applied after e qualifier but before oe?
- Date: Mon, 2 Aug 2021 14:19:25 -0700
- Archived-at: <https://zsh.org/users/26834>
- In-reply-to: <CAH+w=7Y0X7QiRaBymb26cH_vrh94j5LjeazmeEhfFQny-KthKQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <20210802144234.noab4lvp3pvj7ct6@chazelas.org> <CAH+w=7Y0X7QiRaBymb26cH_vrh94j5LjeazmeEhfFQny-KthKQ@mail.gmail.com>
On Mon, Aug 2, 2021 at 9:27 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> It's probably intended so that the result of ordering is on the
> modified result rather than on the original path. I do find it
> surprising that it's not mentioned anywhere, though.
I wonder if we need a section on the order of events for globbing,
akin to the "Rules" section for parameter expansion.
What's going on here is that all of the orderings to be applied to a
given filename generation (glob) are collected as the expression is
parsed, and then applied at the very end after everything else has
modified the result. This is why the doc notes that you can't have
more than 12 sort operations on any glob, and it confirms that you
can't change what's seen as the incoming value of $REPLY by the 'oe'
code block.
However, if for some reason you need to do this all in the glob, you
could use the first 'e' block to stash a mapping (in a global hash,
say) and then look up that mapping in the 'oe' block to set $REPLY for
the sort. That means moving the qualifiers into the 'e' block to
assign to $reply, but it's all in one glob.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author