From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4728 invoked by alias); 13 Dec 2011 19:30:57 -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: 30021 Received: (qmail 21835 invoked from network); 13 Dec 2011 19:30:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.216.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=MylEX6ZC/a4qywwpudhHx0OQx7NAezdkIM8Us7GiJj0=; b=hCemZ37NaF9VTSun62Lx5Yfo4Hbo1s84VA5zOqNeRJn1bnp/IAmYbieLGArN0Yyu0X yWPsrEJdN/bM/4TnS+eGUShYSiMYE6N3Fmsp0WYPaGdWz8SrDanJ2C66SOjW3kxofPMQ 47slyI50ayiBhKq2x7tWKlxJmEtS7PyL0vIik= From: Mikael Magnusson To: zsh-workers@zsh.org Subject: PATCH: _globquals: Say what the digit is when completing time qualifiers, add d Date: Tue, 13 Dec 2011 20:23:26 +0100 Message-Id: <1323804206-875-1-git-send-email-mikachu@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1323547357-12444-1-git-send-email-mikachu@gmail.com> References: <1323547357-12444-1-git-send-email-mikachu@gmail.com> Added the d flag, and moved locals to top to get rid of anon function. It seems the scoping conflicts with compset -P somehow. I didn't notice at first that with my previous patch, *(mM would no longer output the +- hints, as you can see in the previous mail. Now it works: % *(mM === sense + -- more than - -- less than === digit (months) --- Completion/Zsh/Type/_globquals | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals index 778dfa8..9de7742 100644 --- a/Completion/Zsh/Type/_globquals +++ b/Completion/Zsh/Type/_globquals @@ -1,7 +1,8 @@ #autoload -local state=qual expl char delim +local state=qual expl char delim timespec local -a alts +local -A specmap while [[ -n $PREFIX ]]; do char=$PREFIX[1] @@ -111,18 +112,19 @@ while [[ -n $PREFIX ]]; do ;; ([amc]) - if ! compset -P '([Mwhms]|)([-+]|)<->'; then + if ! compset -P '([Mwhmsd]|)([-+]|)<->'; then # complete/skip relative time spec alts=() - if ! compset -P '[Mwhms]' && [[ -z $PREFIX ]]; then - alts+=( - "time-specifiers:time specifier:\ -((M\:months w\:weeks h\:hours m:\minutes s\:seconds))") + timespec=$PREFIX[1] + if ! compset -P '[Mwhmsd]' && [[ -z $PREFIX ]]; then + alts+=("time-specifiers:time specifier:\ +((M\:months w\:weeks h\:hours m:\minutes s\:seconds d\:days))") fi if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then alts+=("senses:sense:((-\:less\ than +\:more\ than))") fi - alts+=('digits:digit: ') + specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days) + alts+=('digits:digit ('${${specmap[(K)$timespec]}:-invalid time specifier}'):' ) _alternative $alts return fi -- 1.7.5.4