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

PATCH: Make _xset complete more helpfully



I've had this in my drafts folder for at least 3 years
"""
xset <tab> has absolutely zero effect, but if i type the first
argument it correctly completes some things i tried, others, not so
much. I'm happy if just the first argument thing is fixed though. It
seems to use _regex_arguments which I've never used before, so I'll
settle for mentioning it here and hoping for the best.
"""

Looking into it now, this seems to be the fix, but I'm not sure I
understand why. Is it simply wrong to give words not starting with a -
or + to _describe when you pass -o? Before the patch, even xset
mo<tab> doesn't complete mouse, but xset -b<tab> does complete xset
-bc. Not having either of -o or -O also works, but I feel like it
should be -O, probably. Because of the way xset treats options, things
that start with a - aren't really different from ones that don't.

I'm not exactly sure what I meant with some arguments not working,
maybe that things like xset dpms <tab> inserts force instead of also
saying you can type a number there. If you do start typing a number
and press tab it does say what the number is for though. I'm not going
to fiddle with that :).

--- a/Completion/X/Command/_xset
+++ b/Completion/X/Command/_xset
@@ -27,8 +27,8 @@ _xset_compopts () {
       tmp=("$tmp[@]" "$opt")
     fi
   done
-  _describe -o options tmp -- ||
-  _describe -o options allopts --
+  _describe -O options tmp -- ||
+  _describe -O options allopts --
 }

 _xset_compfpadd () {


-- 
Mikael Magnusson



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