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

Re: PATCH: _xwit



In article <200003241254.NAA26008@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> Hm. If I parsed _xwit correctly (which I'm not sure about, because I
> haven't really understood _regex_arguments yet):
> 
>   _arguments '-keyrepeat:*[0-9]##:keycode: ' ...
> 
> What have I missed?

-keyrepeat and -nokeyrepeat takes a sequence of words.  The words is
sequence of:
1) a keycode represended as an integer (one word)
2) a keycode range represented as an integer, hyphen and an integer
(three words)

For example,

  xwit -nokeyrepeat 61 - 69 128 

disables autorepeat for keys `q', `w', `e', `r', `t', `y' and ` '. 
(On my keyboard, of course.)

The arguments for -keyrepeats is end before next option as:

  xwit -nokeyrepeat 61 - 69 128 -sync

So, '-keyrepeat:*[0-9]##:keycode: ' doesn't work because [0-9]##
matches to the first argument: `61'.

If _arguments have a form like `:*pattern:message:action' but the
pattern is matched against to a argument *next* to an arguments for
the option, we can use _arguments for _xwit.

> If the tag alias changes make it in, this would become what is shown
> in the patch below.

Wow.  Thanks.

> The patch also shows one of the way to do this with tag aliases. Unless 
> we find a way to put that into _regex_arguments, that is. We would
> need the descriptions and tags there then but it doesn't handle them,
> right? Sigh.

Hm.  I'll read changed tag stuff...

Since I found that `xwit -keyrepeat 10 -<TAB>' runs _message, it is
fixed as follows.

Index: Completion/X/_xwit
===================================================================
RCS file: /projects/zsh/zsh/Completion/X/_xwit,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 _xwit
--- Completion/X/_xwit	2000/03/24 12:56:54	1.1.1.2
+++ Completion/X/_xwit	2000/03/24 13:29:35
@@ -39,8 +39,8 @@
     \| "/iconmove$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
     \| "/id$nul/" "$guard" "/$word/" ":_x_window" \
     \| "/(no|)keyrepeat$nul/" "$guard" \
-        \( "/[0-9]##$nul/" ":_message keycode" \
-	  \( "/-$nul/" "/[0-9]##$nul/" ":_message 'last keycode'" \| \) \) \# \
+        \( "/[0-9]##$nul/" ":[[ -prefix [0-9]## ]] && _message keycode" \
+	  \( "/-$nul/" "/[0-9]##$nul/" ":[[ -prefix [0-9]## ]] && _message 'last keycode'" \| \) \) \# \
     \| "/names$nul/" "$guard" "/$word/" ":_x_window -n" \# \
     \| "/[]/" ':_xwit_compopts' \
     \) \
-- 
Tanaka Akira



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