From: Mikael Magnusson <mikachu@gmail.com>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: PATCH 3/5: _imagemagick: complete all files if image files didn't match
Date: Wed, 12 Aug 2015 20:12:21 +0200 [thread overview]
Message-ID: <CAHYJk3SUp2bj35KBdrkpvB+P3CnGASLzuHd8NQ+RFt0u3ZsaPw@mail.gmail.com> (raw)
In-Reply-To: <7518.1439400015@thecus.kiddle.eu>
On Wed, Aug 12, 2015 at 7:20 PM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> Mikael Magnusson wrote:
>> - _files "$@" -g "*.(#i)(${~formats//:/|})(-.)"
>> + _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" || _files "$@"
>
> _files already does this internally, configurable via the file-patterns
> style. From zsh -f or in my full setup, this already works for me. This
> same change might equally be applicable to every use of _files with -g
> that we have.
>
> You might want to instead check your file-patterns styles to see what
> you've configured that broke this.
You're right that it works in zsh -f, however, I don't have any
file-patterns styles set and it still doesn't work in my setup.
This is the line that breaks the desired behaviour,
zstyle ':completion:*' list-dirs-first true
Which I find to be somewhat unexpected.
This seems to fix it, and brings the l-d-f case in line with the
default case below it.
diff --git i/Completion/Unix/Command/_imagemagick
w/Completion/Unix/Command/_imagemagick
index c43086c..115cb01 100644
--- i/Completion/Unix/Command/_imagemagick
+++ w/Completion/Unix/Command/_imagemagick
@@ -14,7 +14,7 @@ typeset -A opt_args
formats=jpg:jpeg:jp2:j2k:jpc:jpx:jpf:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:p
if (( $# )); then
- _files "$@" -g "*.(#i)(${~formats//:/|})(-.)" || _files "$@"
+ _files "$@" -g "*.(#i)(${~formats//:/|})(-.)"
return
fi
diff --git i/Completion/Unix/Type/_files w/Completion/Unix/Type/_files
index f4a8fc2..13f4871 100644
--- i/Completion/Unix/Type/_files
+++ w/Completion/Unix/Type/_files
@@ -72,7 +72,7 @@ elif zstyle -t ":completion:${curcontext}:"
list-dirs-first; then
glob="$glob(#q^-/)"
fi
- pats=( " *(-/):directories:directories ${glob//:/\\:}:globbed-files" )
+ pats=( " *(-/):directories:directories
${glob//:/\\:}:globbed-files" '*:all-files' )
elif [[ "$type" = */* ]] then
pats=( '*(-/):directories ' '*:all-files ' )
else
[extra context for reference]
pats=( '*(-/):directories:directories *(^-/):other-files ' )
fi
else
if [[ "$type" = *g* ]]; then
# People prefer to have directories shown on first try as default.
# Even if the calling function didn't use -/.
#
# if [[ "$type" = */* ]]; then
pats=( " ${glob//:/\\:}:globbed-files *(-/):directories" '*:all-files '
--
Mikael Magnusson
next prev parent reply other threads:[~2015-08-12 18:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 3:04 PATCH 1/5: _git: various fixes Mikael Magnusson
2015-08-12 3:05 ` PATCH 2/5: _wget: complete headers for --header and add --no-use-server-timestamps Mikael Magnusson
2015-08-12 3:05 ` PATCH 3/5: _imagemagick: complete all files if image files didn't match Mikael Magnusson
2015-08-12 17:20 ` Oliver Kiddle
2015-08-12 18:12 ` Mikael Magnusson [this message]
2015-08-12 18:59 ` Bart Schaefer
2015-08-12 19:35 ` Mikael Magnusson
2015-08-12 19:42 ` Bart Schaefer
2015-08-12 20:05 ` Mikael Magnusson
2015-08-12 20:57 ` Bart Schaefer
2015-08-12 21:15 ` Mikael Magnusson
2015-08-12 21:44 ` Bart Schaefer
2015-08-12 22:34 ` Mikael Magnusson
2015-08-12 22:46 ` Bart Schaefer
2015-08-12 23:37 ` Mikael Magnusson
2015-08-13 10:12 ` Oliver Kiddle
2015-08-13 20:27 ` Bart Schaefer
2015-08-14 8:44 ` Oliver Kiddle
2015-08-14 16:18 ` Mikael Magnusson
2015-08-14 16:24 ` Bart Schaefer
2015-08-14 22:31 ` Mikael Magnusson
2015-08-15 0:05 ` Bart Schaefer
2015-08-15 0:52 ` Mikael Magnusson
2015-08-12 3:05 ` PATCH 4/5: _sort: Fix syntax error Mikael Magnusson
2015-08-12 3:05 ` PATCH 5/5: _strftime: Add completion for zsh/datetime's strftime builtin Mikael Magnusson
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=CAHYJk3SUp2bj35KBdrkpvB+P3CnGASLzuHd8NQ+RFt0u3ZsaPw@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=okiddle@yahoo.co.uk \
--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).