Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bug in ztrftime(): '%e' and '%f' specifiers swapped
- X-seq: zsh-workers 27058
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Zsh list <zsh-workers@xxxxxxxxxx>
- Subject: Re: bug in ztrftime(): '%e' and '%f' specifiers swapped
- Date: Fri, 26 Jun 2009 22:23:52 +0100
- In-reply-to: Message from Greg Klanderman <gak@xxxxxxxxxxxxxx> of "Fri, 26 Jun 2009 16:40:25 EDT." <19013.12857.274684.466725@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Greg Klanderman wrote:
> You have inadvertently swapped the meanings of the '%e' and '%f' format
> specifiers.
Thanks for tracking this down.
> However, I find this equivalent patch to be more readable:
Interesting how subjective this is, I find it significantly less so
(though they're certainly equivalent so this is all rather minor and if
you hadn't sent two patches I'd never even have thought about it):
- there is no immediate visual cue that the formats do different things
- the test for the format letter is repeated without it being obvious it
is the same test
- it's made even less obvious because the second test has to advance
back down the format string since the key letter isn't saved in a
variable [we do this sort of thing all the time elsewhere, though]
- the fact that 'f' sets the "strip" feature unconditionally is obscured
- I'm not that keen on "||" and "&&" in assignments anyway [again, the
shell is full of stuff I'm not that keen on]
so I've committed the first one.
> Btw, are the zsh extension format specifiers documented?
See the description of the %D format in the description of prompt
escapes, which is where these first occurred; feel free to add some more
cross references, I see there isn't one in the zsh/datetime description,
for example.
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author