From: Jacob Menke <linux.dev25@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-workers@zsh.org
Subject: Re: Possible issue with Completion/Unix/Type/_date_formats return value
Date: Thu, 28 Jan 2021 04:40:46 -0500 [thread overview]
Message-ID: <CAB5oL3YTeQY-n=t9+qC4Vmh5jTgmqUv+tLfTYCiiF8Gh-BvL1w@mail.gmail.com> (raw)
In-Reply-To: <20210126233738.GB25751@tarpaulin.shahaf.local2>
[-- Attachment #1.1: Type: text/plain, Size: 1599 bytes --]
Sure,
Patch is attached and here:
diff --git a/Completion/Unix/Type/_date_formats
b/Completion/Unix/Type/_date_formats
index 889a9577..226e1ef7 100644
--- a/Completion/Unix/Type/_date_formats
+++ b/Completion/Unix/Type/_date_formats
@@ -1,6 +1,6 @@
#autoload
-local flag
+local flag ret=1
local -aU specs
local -A exclusion
@@ -106,5 +106,6 @@ for flag in ${(s..)PREFIX#%}; do
done
_describe -t date-format-specifier 'date format specifier' specs \
- -p "${(Q)PREFIX:-%}" -S ''
+ -p "${(Q)PREFIX:-%}" -S '' && ret=0
[[ $1 == zsh ]] && _message -e date-format-precision 'precision for %%. (1-9)'
+return ret
On Tue, 26 Jan 2021 at 18:37, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Jacob Menke wrote on Wed, Jan 20, 2021 at 17:43:31 -0500:
> > Hello,
> >
> > I was wondering if _date_formats has an improper return value.
> >
> > When called from _date (when $1 is unset, thus $1 == zsh is
> > false) _date_formats always returns 1 even when matches are generated
> from
> > _describe. This causes completion to continue erroneously.
> >
> > Last two lines are shown:
> > _describe -t date-format-specifier 'date format specifier' specs
> > -p "${(Q)PREFIX:-%}" -S ''
> > [[ $1 == zsh ]] && _message -e date-format-precision 'precision for
> %%.(1-9)'
> >
> > I believe the return value of _describe should be returned either by
> making
> > _describe last statement or storing its value in local var ret and then
> > returning ret.
>
> Thanks for the report and sorry for the late answer. I agree that it's
> wrong
> as it stands. Anyone wants to take it from here?
>
[-- Attachment #1.2: Type: text/html, Size: 2216 bytes --]
[-- Attachment #2: _date_format-ret.patch --]
[-- Type: application/octet-stream, Size: 591 bytes --]
diff --git a/Completion/Unix/Type/_date_formats b/Completion/Unix/Type/_date_formats
index 889a9577..226e1ef7 100644
--- a/Completion/Unix/Type/_date_formats
+++ b/Completion/Unix/Type/_date_formats
@@ -1,6 +1,6 @@
#autoload
-local flag
+local flag ret=1
local -aU specs
local -A exclusion
@@ -106,5 +106,6 @@ for flag in ${(s..)PREFIX#%}; do
done
_describe -t date-format-specifier 'date format specifier' specs \
- -p "${(Q)PREFIX:-%}" -S ''
+ -p "${(Q)PREFIX:-%}" -S '' && ret=0
[[ $1 == zsh ]] && _message -e date-format-precision 'precision for %%. (1-9)'
+return ret
next prev parent reply other threads:[~2021-01-28 9:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 22:43 Jacob Menke
2021-01-26 23:37 ` Daniel Shahaf
2021-01-28 9:40 ` Jacob Menke [this message]
2021-01-28 18:39 ` Daniel Shahaf
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='CAB5oL3YTeQY-n=t9+qC4Vmh5jTgmqUv+tLfTYCiiF8Gh-BvL1w@mail.gmail.com' \
--to=linux.dev25@gmail.com \
--cc=d.s@daniel.shahaf.name \
--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).