From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9125 invoked by alias); 6 Jul 2015 14:57:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35705 Received: (qmail 13072 invoked from network); 6 Jul 2015 14:56:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RF8HEbldrW4D7gGDHTXjjOBlhlQDu53Pap8Fm3InsF4=; b=i1Tc2x9zY23rDX4p9cCxTu3O/TdQMo5SnMLOpCM6DoQfvIWez4bu0V7C2rvOQDRO7Z G+HSGHxOFOPC9r0cb1/YNXJS7fWU9cjh3srRoBNkatqSaMGA379hlSpcUxrToXJMzXiJ Pwb89EfFL937dSlDEqyUnOHP0427h1KFp0/9d1ZHsTJqSY6Q1igw3ysraPVDGtA2G9x4 2FMqQ+wkjwYDAQa+j3JTw+m5sCDPDS9dZrCaPJMBBQtR/J0DUDqkNF5MeJ/P/bQu4x3c 9tlToDNj3qPmwM2GtKlCptF+AWL5K1tLblIMMn5OurUCWLBqPiHIAeVEYHHOxtrGk+No CEuQ== MIME-Version: 1.0 X-Received: by 10.43.33.142 with SMTP id so14mr33684511icb.36.1436194615279; Mon, 06 Jul 2015 07:56:55 -0700 (PDT) In-Reply-To: References: <1436143012-9243-1-git-send-email-mikachu@gmail.com> <4740.1436181110@thecus.kiddle.eu> Date: Mon, 6 Jul 2015 16:56:55 +0200 Message-ID: Subject: Re: PATCH: _ps1234, _date_formats: Complete strftime formats for %D{} From: Mikael Magnusson To: Oliver Kiddle Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Mon, Jul 6, 2015 at 4:17 PM, Mikael Magnusson wrote: > On Mon, Jul 6, 2015 at 1:11 PM, Oliver Kiddle wrote: >> Mikael Magnusson wrote: >>> >>> PS, my strftime(3) says it handles %E and %O, and it does work with date +%Ey, >>> but zsh just prints the literal %Ey. Is it handled wrong by us or not >>> by the libc like the manpage claims? >> >> Looking at the source, it seems only - is treated as a modifier. >> It'd be nice for it to be updated if it can remain portable. >> >>> + compset -P "*" >>> + _describe -t date-format-specifier 'date format specifier' '(%)' -S '' >> >> Using _describe to complete just % seems rather overkill. An _wanted >> would do. However, it'd be better to use a prefix for the % and use >> compset -P to cut off complete format specifiers or unrelated >> characters. The patch below does that and adds a case statement to >> select some OS specific additions. >> >> It'd perhaps be nice to complete format specifiers and modifiers with a >> different tag and description. > > I don't know how most of the things you did work, but as far as I can > tell it only breaks one thing; pressing tab after %5 now completes all > modifiers instead of just putting in a . since %. is the only one that > takes a numeric argument. %- is also handled internally by zsh for > some modifiers, so it'll work on any OSTYPE as long as $1 is zsh. Oh, I see I didn't read far enough in strftime(3), and only checked behaviour in zsh, not date. This is fun too btw: % print -P %D\{%10A\} %10A % print -P %D\{%9A\} %9A I guess this code could use some overall touchups. It looks like the order of modifiers matter, so for example %-Ey works in date, but %E-y does not. Ah, date has a similar bug: % date +%5Ey 15 % date +%-Ey 15 % date +%-5Ey 15 % date +%5-Ey %5-Ey (the string was already five characters, but it still added extra padding, and didn't expand the number, and if it was expanded, there should be one more space). -- Mikael Magnusson