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

Re: _x_geometry problem



Tanaka Akira wrote:

> I found a problem about _x_geometry.
> 
> Z(2):akr@is27e1u11% Src/zsh -f                 
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D
> is27e1u11% zstyle ':completion*:messages' format '%d'
> is27e1u11% /usr/X11/bin/ico -geometry <TAB
> -default-
> 
> With set -x:
> ...
> +_arguments:251> _x_geometry -J -default-
> +_x_geometry:3> ((  2  ))
> +_x_geometry:4> _message -default-
> ...
> 
> Hm.  _x_geometry fail to detect whether its arguments has a message or
> not.

Oops. This comes from times when argument lists were simpler...

The patch also adds the matcher-list style to _zstyle and removes
_matcher from the .distfile.

Bye
 Sven

diff -ru ../z.old/Completion/Builtins/_zstyle Completion/Builtins/_zstyle
--- ../z.old/Completion/Builtins/_zstyle	Fri Feb 18 10:15:16 2000
+++ Completion/Builtins/_zstyle	Fri Feb 18 10:22:31 2000
@@ -42,6 +42,7 @@
   list-rows-first	 c:bool
   local			 c:
   matcher		 c:
+  matcher-list		 c:
   max-errors		 c:
   menu			 c:boolauto
   numbers		 c:bool
diff -ru ../z.old/Completion/Core/.distfiles Completion/Core/.distfiles
--- ../z.old/Completion/Core/.distfiles	Fri Feb 18 10:15:25 2000
+++ Completion/Core/.distfiles	Fri Feb 18 10:22:01 2000
@@ -1,7 +1,7 @@
 DISTFILES_SRC='
     .distfiles
     _alternative _approximate _compalso _complete _correct _description
-    _expand _files _funcall _list _main_complete _match _matcher
+    _expand _files _funcall _list _main_complete _match
     _menu _multi_parts _message _normal _oldlist _options
     _parameters _path_files _prefix _requested _sep_parts
     _set_options _setup _sort_tags _tags
diff -ru ../z.old/Completion/Core/_message Completion/Core/_message
--- ../z.old/Completion/Core/_message	Fri Feb 18 10:15:22 2000
+++ Completion/Core/_message	Fri Feb 18 10:54:02 2000
@@ -1,14 +1,20 @@
 #autoload
 
-local format
+local format raw
 
 _tags messages || return 1
 
-zstyle -s ":completion:${curcontext}:messages" format format ||
-    zstyle -s ":completion:${curcontext}:descriptions" format format
+if [[ "$1" = -r ]]; then
+  raw=yes
+  shift
+  format="$1"
+else
+  zstyle -s ":completion:${curcontext}:messages" format format ||
+      zstyle -s ":completion:${curcontext}:descriptions" format format
+fi
 
-if [[ -n "$format" ]]; then
-  zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+if [[ -n "$format$raw" ]]; then
+  [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
   if [[ $compstate[nmatches] -eq 0 ]]; then
     compstate[list]='list force'
     compstate[insert]=''
diff -ru ../z.old/Completion/X/_x_borderwidth Completion/X/_x_borderwidth
--- ../z.old/Completion/X/_x_borderwidth	Fri Feb 18 10:15:35 2000
+++ Completion/X/_x_borderwidth	Fri Feb 18 10:55:05 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'border width'
 fi
diff -ru ../z.old/Completion/X/_x_geometry Completion/X/_x_geometry
--- ../z.old/Completion/X/_x_geometry	Fri Feb 18 10:15:35 2000
+++ Completion/X/_x_geometry	Fri Feb 18 10:54:30 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'geometry'
 fi
diff -ru ../z.old/Completion/X/_x_locale Completion/X/_x_locale
--- ../z.old/Completion/X/_x_locale	Fri Feb 18 10:15:35 2000
+++ Completion/X/_x_locale	Fri Feb 18 10:55:02 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'locale'
 fi
diff -ru ../z.old/Completion/X/_x_name Completion/X/_x_name
--- ../z.old/Completion/X/_x_name	Fri Feb 18 10:15:35 2000
+++ Completion/X/_x_name	Fri Feb 18 10:54:58 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'name'
 fi
diff -ru ../z.old/Completion/X/_x_resource Completion/X/_x_resource
--- ../z.old/Completion/X/_x_resource	Fri Feb 18 10:15:35 2000
+++ Completion/X/_x_resource	Fri Feb 18 10:54:56 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'resource'
 fi
diff -ru ../z.old/Completion/X/_x_selection_timeout Completion/X/_x_selection_timeout
--- ../z.old/Completion/X/_x_selection_timeout	Fri Feb 18 10:15:35 2000
+++ Completion/X/_x_selection_timeout	Fri Feb 18 10:54:52 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'selection timeout'
 fi
diff -ru ../z.old/Completion/X/_x_title Completion/X/_x_title
--- ../z.old/Completion/X/_x_title	Fri Feb 18 10:15:36 2000
+++ Completion/X/_x_title	Fri Feb 18 10:54:49 2000
@@ -1,7 +1,9 @@
 #autoload
 
-if (( $# )); then
-  _message "$2"
+local x="$argv[(I)-X]"
+
+if (( x )); then
+  _message -r "$argv[x + 1]"
 else
   _message 'title'
 fi
diff -ru ../z.old/Doc/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- ../z.old/Doc/Zsh/compsys.yo	Fri Feb 18 10:14:49 2000
+++ Doc/Zsh/compsys.yo	Fri Feb 18 10:57:08 2000
@@ -1922,7 +1922,7 @@
 compadd "$expl[@]" - "$files[@]")
 )
 findex(_message)
-item(tt(_message) var(descr))(
+item(tt(_message) [ -r ] var(descr))(
 The var(descr) is used like the third
 argument to the tt(_description) function. However, the resulting
 string will always be shown whether or not matches were
@@ -1932,6 +1932,11 @@
 This function also uses the tt(format) style for the tt(messages) tag in
 preference to the tt(format) style for the tt(descriptions) tag. The
 latter is used only if the former is unset.
+
+If the tt(-r) option is given, no style is used and the var(descr) is
+used literally as the string to display. This is only used in cases
+where that string is taken from some pre-processed argument list
+containing an expanded description.
 )
 findex(_setup)
 item(tt(_setup) var(tag))(

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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