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

Re: PATCH: newsgroup completion



Oliver Kiddle wrote:

> ...
> 
> I look in .newsrc* for newsgroups as this covers netscape and setups
> like mine where I have configured tin's newsrctable for multiple news
> servers. Having a glob also simplified the situation where .newsrc*
> doesn't exit because zsh doesn't run the fgrep. I suppose we could
> also add a style to specify a different newsrc file.

Hmhm. Re-use `path'.

> When no .newsrc file exists, I end up with _cache_newsgroups
> containing one empty value (''). I got around this by using the
> ${(w)#_cache_newsgroups} but it'd be nice if there was a parameter
> expansion flag or maybe a typeset option to remove empty entries from
> an array. Any opinions?

I always use ${array:#}.

> This newsgroup completion shows up a few problems with _multi_parts.
> The suffix handling doesn't seem to work properly. If I use
> _newsgroups -S',' I still get a space and not a comma after a full
> newsgroup name.

Handling of -S is non-trivial in _multiparts because there are so many 
placees where it has to use it itself. I've found one more place where 
the caller-supplied -S could be used, I think.

> I'm also getting a problem after the first part of a newsgroup is
> typed in full. e.g:
>   tin comp<tab>
> gives me:
>   tin comp..comp.
> I can reproduce this starting from zsh -f so it isn't my setup.

And I think I fixed this, too.

Bye
 Sven

Index: Completion/Core/_multi_parts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_multi_parts,v
retrieving revision 1.4
diff -u -r1.4 _multi_parts
--- Completion/Core/_multi_parts	2000/07/24 12:52:42	1.4
+++ Completion/Core/_multi_parts	2001/02/09 13:55:48
@@ -113,7 +113,7 @@
 
 	if [[ $#imm -ne 0 && $#matches -eq 1 ]] ||
            zstyle -t ":completion:${curcontext}:" expand suffix; then
-	  compadd "$group[@]" "$expl[@]" "$opts[@]" \
+	  compadd "$group[@]" "$expl[@]" "$sopts[@]" \
                   -M "r:|${sep}=* r:|=* $matcher" - "$pref$matches[1]"
         else
 	  if (( $matches[(I)${tmp1[1]}${sep}*] )); then
@@ -235,7 +235,7 @@
     SUFFIX=""
 
     if [[ -n "$pref" && "$orig" != "$pref" ]]; then
-      if [[ "$pref" = *${sep} ]]; then
+      if [[ "$pref" = *${sep}*${sep} ]]; then
         compadd "$group[@]" "$expl[@]" "$opts[@]" \
                 -p "${pref%${sep}*${sep}}${sep}" -S "$sep" \
                 -M "r:|${sep}=* r:|=* $matcher" - "${${pref%${sep}}##*${sep}}"

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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