* Re: tag-order with git refs
[not found] ` <20151008103951.483879c3@pwslap01u.europe.root.pri>
@ 2015-10-12 2:08 ` Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2015-10-12 2:08 UTC (permalink / raw)
To: zsh-workers
[> workers]
On Oct 8, 10:39am, Peter Stephenson wrote:
} Subject: Re: tag-order with git refs
}
} Sounds like there are at least some possibilities for improving this,
} but I wonder if we can make ^xh a bit more helpful about what you
} actually need to do in a particular case? That would save a lot of
} documentation for a lot of completions.
Squinted at this for a bit ...
} It's sort of mentioning the
} right words but doesn't give any help about how you need to combine
} them. If we could make it build up a "story so far" string and output
} it at the end, or something like that...?
This would have to be a change to the _help_sort_tags function in
_complete_help.
It does accumulate the call stack down to the point at which the tag
becomes active, e.g. (re-wrapping lines for clarity):
heads-local (__git_heads_local
__git_heads
_alternative
__git_commits
__git_tree_ishs
_alternative
_git-checkout
_call_function
_git)
(looks as if it should be filtering out _alternative and _call_function
along with the list of other things it already does filter).
So I guess you're supposed to intuit that when you see a stack that deep,
you should look at the other parenthesized stacks to find the tags in
__git_heads, and then the tags in _git_commits, and then _git_tree_ishs,
and so on, and build up your tag-order from that.
It's doing this by looking at $funcstack. To get the tags instead of
the function names, I think _help_sort_tags would have to maintain its
own stack.
This patch doesn't attempt that, it just cleans up the funcstack stuff.
diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help
index 0563c61..09637ec 100644
--- a/Completion/Base/Widget/_complete_help
+++ b/Completion/Base/Widget/_complete_help
@@ -6,12 +6,15 @@ _complete_help() {
local _sort_tags=_help_sort_tags text i j k tmp
typeset -A help_funcs help_tags help_sfuncs help_styles
+ local -H _help_scan_funcstack="main_complete|complete|approximate|normal"
+ local -H _help_filter_funcstack="alternative|call_function|describe|dispatch|wanted|requested|all_labels|next_label"
+
{
compadd() { return 1 }
zstyle() {
- local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
+ local _f="${${(@)${(@)funcstack[2,(i)_($~_help_scan_funcstack)]}:#(_($~_help_filter_funcstack)|\((eval|anon)\))}% *}"
- [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
+ [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_($~_help_scan_funcstack)]}:#(_($~_help_filter_funcstack)|\((eval|anon)\))}"
if [[ "$help_sfuncs[$2]" != *${_f}* ||
"$help_styles[${2}${_f}]" != *${3}* ]]; then
@@ -73,7 +76,7 @@ _complete_help() {
}
_help_sort_tags() {
- local f="${${(@)${(@)funcstack[3,(i)_(main_complete|complete|approximate|normal)]}:#(_(dispatch|wanted|requested|all_labels|next_label)|\(eval\))}% *}"
+ local f="${${(@)${(@)funcstack[3,(i)_($~_help_scan_funcstack)]}:#(_($~_help_filter_funcstack)|\((eval|anon)\))}% *}"
if [[ "$help_funcs[$curcontext]" != *${f}* ||
"$help_tags[${curcontext}${f}]" != *(${(j:|:)~argv})* ]]; then
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-12 2:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20151007120820.6f8a59e9@pwslap01u.europe.root.pri>
[not found] ` <28911.1444256551@thecus.kiddle.eu>
[not found] ` <20151008103951.483879c3@pwslap01u.europe.root.pri>
2015-10-12 2:08 ` tag-order with git refs 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).