zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Remove _message call from _mkdir
       [not found]     ` <150412101826.ZM21679@torch.brasslantern.com>
@ 2015-04-12 19:46       ` Bart Schaefer
  2015-04-12 19:54         ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-04-12 19:46 UTC (permalink / raw)
  To: zsh-workers

On Apr 12, 10:18am, Bart Schaefer wrote:
}
} > It works perfectly with all 
} > commands but mkdir, which simply refuses to offer hidden files, ever.
} 
} Which turns out to be that _mkdir calls _message which breaks out of the
} loop over _completers in _main_complete, so the _ignored completer in your
} style is never reached.
} 
} _message really ought to be called only when there is no possibility of
} other completions being generated, not merely to suggest what ought to
} be typed at that point.


Unless someone has a better suggestion?


diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir
index b5f7519..58d6c74 100644
--- a/Completion/Unix/Command/_mkdir
+++ b/Completion/Unix/Command/_mkdir
@@ -61,7 +61,7 @@ case "$state" in
       [[ $variant == zsh && ${#${${words[2,-1]}:#-*}} -gt 0 ]]; then
       _wanted directories expl \
         'parent directory (alternatively specify name of directory)' \
-        _path_files -/ && ret=0 || _message 'name of directory'
+        _path_files -/ && ret=0
     fi
     ;;
 esac


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Remove _message call from _mkdir
  2015-04-12 19:46       ` PATCH: Remove _message call from _mkdir Bart Schaefer
@ 2015-04-12 19:54         ` Peter Stephenson
  2015-04-12 21:05           ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2015-04-12 19:54 UTC (permalink / raw)
  To: zsh-workers

On Sun, 12 Apr 2015 12:46:28 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Unless someone has a better suggestion?
> 
> diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir
> index b5f7519..58d6c74 100644
> --- a/Completion/Unix/Command/_mkdir
> +++ b/Completion/Unix/Command/_mkdir
> @@ -61,7 +61,7 @@ case "$state" in
>        [[ $variant == zsh && ${#${${words[2,-1]}:#-*}} -gt 0 ]]; then
>        _wanted directories expl \
>          'parent directory (alternatively specify name of directory)' \
> -        _path_files -/ && ret=0 || _message 'name of directory'
> +        _path_files -/ && ret=0
>      fi
>      ;;
>  esac

I'm not really sure what that was doing there in this one case, anyway.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Remove _message call from _mkdir
  2015-04-12 19:54         ` Peter Stephenson
@ 2015-04-12 21:05           ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2015-04-12 21:05 UTC (permalink / raw)
  To: zsh-workers

On Apr 12,  8:54pm, Peter Stephenson wrote:
}
} >        _wanted directories expl \
} >          'parent directory (alternatively specify name of directory)' \
} > -        _path_files -/ && ret=0 || _message 'name of directory'
} 
} I'm not really sure what that was doing there in this one case, anyway.

In the event that there really are no path prefixes to complete, it is
intended to change this:

torch% mkdir
No matches for `parent directory (alternatively specify name of directory)'

Into this:

torch% mkdir
name of directory

Trouble is there's no simple way to determine on the first call to _mkdir
whether there might be other paths suggested by later completers.

Hence my other suggestion from zsh-users:

> ...  Either that or it needs some option (the inverse
> of "_message -e"?) that tells _main_complete to continue even though a
> message is pending.

This is actually not too hard, just do not set _comp_mesg=yes, though the
option parsing for _message is unnecessarily ugly.  The doc for _message
says:

     ... the resulting string will
     always be shown whether or not matches were generated.

So with _comp_mesg not set, we'd potentially end up with:

torch% mkdir
name of directory
Completing parent directory (alternatively specify name of directory)
[list of the ignored files here]


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-12 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5528B4C2.3010001@gmail.com>
     [not found] ` <150411134410.ZM27516@torch.brasslantern.com>
     [not found]   ` <5529A5C2.3090603@gmail.com>
     [not found]     ` <150412101826.ZM21679@torch.brasslantern.com>
2015-04-12 19:46       ` PATCH: Remove _message call from _mkdir Bart Schaefer
2015-04-12 19:54         ` Peter Stephenson
2015-04-12 21:05           ` Bart Schaefer

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).