zsh-workers
 help / color / mirror / code / Atom feed
* RE: ${_comps[(K)*diff*]}
@ 2000-03-10 10:32 Sven Wischnowsky
  2000-03-10 10:57 ` ${_comps[(K)*diff*]} Andrej Borsenkow
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2000-03-10 10:32 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > > 
> > > What you miss is that [(k)...] and [(K)...] don't do pattern-matching
> > > on the keys.  I have an idea what's going wrong, but I don't have time
> > > to fix it right now.
> > 
> > (I don't see anything wrong here, what am I missing?)
> > 
> 
> k
>      If used in a subscript on a parameter that is not an associative
>      array, this behaves like `r', but if used on an association, it
>      makes the keys be interpreted as patterns and returns the first
>      value whose key matches the EXP.
> 
> K
>      On an associtation this is like `k' but returns all values whose
>      keys match the EXP. On other types of parameters this has the same
>      effect as `R'.

I know that -- I've written it. Again: so what? Looking at the ouput
you got:

   bor@itsrm2% print ${_comps[(K)*diff*]}
   === nothing ===

The keys of $_comps are used as patterns (none of them is a real
pattern, they are just strings -- the names of commands and special
context), but none of them matches the string `*diff*'. So you get
nothing. Of course. Right? Maybe what you wanted is the (I) flag?
(That (I) and (K) do what they do and that they are named the way they 
are named may be a bit irritating -- probably less when thinking about 
normal arrays instead of associations -- but that has historical
reasons. (K) just came later.)


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: ${_comps[(K)*diff*]}
  2000-03-10 10:32 ${_comps[(K)*diff*]} Sven Wischnowsky
@ 2000-03-10 10:57 ` Andrej Borsenkow
  0 siblings, 0 replies; 6+ messages in thread
From: Andrej Borsenkow @ 2000-03-10 10:57 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> The keys of $_comps are used as patterns (none of them is a real
> pattern, they are just strings -- the names of commands and special
> context), but none of them matches the string `*diff*'. So you get
> nothing. Of course. Right? Maybe what you wanted is the (I) flag?
> (That (I) and (K) do what they do and that they are named the way they
> are named may be a bit irritating -- probably less when thinking about
> normal arrays instead of associations -- but that has historical
> reasons. (K) just came later.)
>

O.K., sorry, I was confused by manual. The description in (k), (K): "the first value whose
key matches the EXP" means (unless my english completely fails me) STRING key is matched
against PATTERN EXP. The usual usage is "string matches pattern", is not it? I hope,
somebody with native english can clarify it.

And the reference in (k) description "this behaves like `r'" just adds to confusion.

Sorry for the noice (yes, I actually meant (I) in this case)

-andrej


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: ${_comps[(K)*diff*]}
  2000-03-10  9:54 ${_comps[(K)*diff*]} Sven Wischnowsky
@ 2000-03-10 10:04 ` Andrej Borsenkow
  0 siblings, 0 replies; 6+ messages in thread
From: Andrej Borsenkow @ 2000-03-10 10:04 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers


> > 
> > What you miss is that [(k)...] and [(K)...] don't do pattern-matching
> > on the keys.  I have an idea what's going wrong, but I don't have time
> > to fix it right now.
> 
> (I don't see anything wrong here, what am I missing?)
> 

k
     If used in a subscript on a parameter that is not an associative
     array, this behaves like `r', but if used on an association, it
     makes the keys be interpreted as patterns and returns the first
     value whose key matches the EXP.

K
     On an associtation this is like `k' but returns all values whose
     keys match the EXP. On other types of parameters this has the same
     effect as `R'.

-andrej


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ${_comps[(K)*diff*]}
@ 2000-03-10  9:54 Sven Wischnowsky
  2000-03-10 10:04 ` ${_comps[(K)*diff*]} Andrej Borsenkow
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Wischnowsky @ 2000-03-10  9:54 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Mar 9,  7:50pm, Andrej Borsenkow wrote:
> } Subject: ${_comps[(K)*diff*]}
> }
> } Do I miss something?
> } 
> } bor@itsrm2% print ${_comps[(R)*diff*]}
> } _diff _diff
> } bor@itsrm2% print ${_comps[(K)*diff*]}
> } === nothing ===
> 
> What you miss is that [(k)...] and [(K)...] don't do pattern-matching
> on the keys.  I have an idea what's going wrong, but I don't have time
> to fix it right now.

(I don't see anything wrong here, what am I missing?)


But this made me notice that we have _use_lo as the default completion 
function for gdiff. This was an oversight, right?

Bye
 Sven

diff -ru ../z.old/Completion/User/_diff Completion/User/_diff
--- ../z.old/Completion/User/_diff	Fri Mar 10 10:29:21 2000
+++ Completion/User/_diff	Fri Mar 10 10:53:01 2000
@@ -1,3 +1,3 @@
-#compdef diff
+#compdef diff gdiff
 
 _diff_options ':original file:_files' ':new file:_files'
diff -ru ../z.old/Completion/User/_use_lo Completion/User/_use_lo
--- ../z.old/Completion/User/_use_lo	Fri Mar 10 10:29:27 2000
+++ Completion/User/_use_lo	Fri Mar 10 10:52:56 2000
@@ -1,4 +1,4 @@
-#compdef gls gdiff
+#compdef gls
 
 # This is for GNU-like commands which understand the --help option,
 # but which do not otherwise require special completion handling.

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ${_comps[(K)*diff*]}
  2000-03-09 16:50 ${_comps[(K)*diff*]} Andrej Borsenkow
@ 2000-03-09 18:43 ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-03-09 18:43 UTC (permalink / raw)
  To: ZSH workers mailing list

On Mar 9,  7:50pm, Andrej Borsenkow wrote:
} Subject: ${_comps[(K)*diff*]}
}
} Do I miss something?
} 
} bor@itsrm2% print ${_comps[(R)*diff*]}
} _diff _diff
} bor@itsrm2% print ${_comps[(K)*diff*]}
} === nothing ===

What you miss is that [(k)...] and [(K)...] don't do pattern-matching
on the keys.  I have an idea what's going wrong, but I don't have time
to fix it right now.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* ${_comps[(K)*diff*]}
@ 2000-03-09 16:50 Andrej Borsenkow
  2000-03-09 18:43 ` ${_comps[(K)*diff*]} Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Andrej Borsenkow @ 2000-03-09 16:50 UTC (permalink / raw)
  To: ZSH workers mailing list

Do I miss something?

bor@itsrm2% print ${_comps[(R)*diff*]}
_diff _diff
bor@itsrm2% print ${_comps[(K)diff]}  
_diff
bor@itsrm2% print ${_comps[(K)gdiff]} 
_diff
bor@itsrm2% print ${_comps[(K)*diff*]}
=== nothing ===

-andrej

Have a nice DOS!
B >> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-03-10 10:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-10 10:32 ${_comps[(K)*diff*]} Sven Wischnowsky
2000-03-10 10:57 ` ${_comps[(K)*diff*]} Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2000-03-10  9:54 ${_comps[(K)*diff*]} Sven Wischnowsky
2000-03-10 10:04 ` ${_comps[(K)*diff*]} Andrej Borsenkow
2000-03-09 16:50 ${_comps[(K)*diff*]} Andrej Borsenkow
2000-03-09 18:43 ` ${_comps[(K)*diff*]} Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).