In workers 50316, I wrote: > That needs some work to avoid conflicting with other helpers that > redefine compadd As far as I can tell that now means only _complete_help and _approximate, and _approximate already avoids redefining compadd when it is a function instead of a builtin. I'm not sure if that affects the results of _complete_help for contexts that use _approximate. Nevertheless it seems as though a helper for temporarily redefining builtins and functions as new functions is possible, so an attempt at it is attached. The idea here is to create a new unique function name and link it to the original function, which preserves the function body, and then unwind that when the redefined function is not needed. There's no neat way to do this without help from the caller in the form of an "always" block. So after a bit of noodling with that idea, the result is _shadow (attached as _shadow.txt for list server compatibility). Example of usage: diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help index 69855de9d..da5947e7f 100644 --- a/Completion/Base/Widget/_complete_help +++ b/Completion/Base/Widget/_complete_help @@ -10,6 +10,7 @@ _complete_help() { local -H _help_filter_funcstack="alternative|call_function|describe|dispatch|wanted|requested|all_labels|next_label" { + _shadow compadd compcall zstyle compadd() { return 1 } compcall() { _help_sort_tags use-compctl } zstyle() { @@ -43,7 +44,7 @@ _complete_help() { ${1:-_main_complete} } always { - unfunction compadd compcall zstyle + _unshadow compadd compcall zstyle } for i in "${(@ok)help_funcs}"; do I'm not certain that Completion/Base/Utility is where _shadow would best be committed, but currently the only places we might want it are in completion, so it should be loaded along with completions, so that's where I was thinking to put it. Remarks?