Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion oddities



On Mon, Dec 11, 2023 at 6:48 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> I know, I'm doing exactly what I ask others not to do and not showing
> an actual example.

OK, stupid minimal example:

dummy_correct() {
  local curcontext=${WIDGET}:::
  zle _correct_word
}
zle -N dummy_correct
bindkey ^Xc dummy_correct

zstyle -e '*' ignored-patterns 'zle -I; print -- ignore: $curcontext;
reply=(\*)'
zstyle -e '*' fake 'zle -I; print -- fake: $curcontext; reply=(\*)'

Hit ^Xc after any word (preferably not in command position or you'll
get a LOT of output) and note what $curcontext is printed.

_correct_word is kind of a silly example because aside from clobbering
$curcontext it's a one-line wrapper for _correct, but consider e.g.
_history_complete_word which does the same thing (incorrectly, I
think, it's missing a colon?) and is over 100 lines.  _expand_alias is
(accidentally?) reasonable because it checks $funcstack before
whacking the context.




Messages sorted by: Reverse Date, Date, Thread, Author