zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: _long_options
@ 1999-03-08 10:31 Sven Wischnowsky
  1999-03-08 11:15 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-03-08 10:31 UTC (permalink / raw)
  To: zsh-workers


Aargh, I remembered this a bit too late...

If `_long_options' thinks the command invoked is a path name relative
to PWD it probably should put `$PWD' before it to make sure the cache
isn't used for another command that happens to have the same name but
is in a different directory.

I had this idea when playing with `_tar' (which is not changed, yet):
there we probably should try to turn the archive name into a absolute
path when building the cache name. Would

  tf="$PWD/$tf"
  tf="${${tf//.\\/}//\\/[^/]#\\/..}"

be enough for that? (Looks funny, doesn't it? ;-)


Bye
 Sven

diff -u oc/User/_long_options Completion/User/_long_options
--- oc/User/_long_options	Mon Mar  8 11:22:18 1999
+++ Completion/User/_long_options	Mon Mar  8 11:28:43 1999
@@ -58,11 +58,17 @@
 # We cache the information about options and the command name, see if
 # we can use the cache.
 
-if [[ "$words[1]" != $_lo_cache_cmd ]]; then
+if [[ "$words[1]" = (.|..)/* ]]; then
+  tmp="$PWD/$words[1]"
+else
+  tmp="$words[1]"
+fi
+
+if [[ "$tmp" != $_lo_cache_cmd ]]; then
 
   # No, store the new command name and clear the old parameters.
 
-  _lo_cache_cmd="$words[1]"
+  _lo_cache_cmd="$tmp"
   (( $+_lo_cache_actions )) && unset ${_lo_cache_actions%% *} _lo_cache_actions
 
   local opts pattern anum=1 tmpo str

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


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: PATCH: _tar, again
@ 1999-03-09 11:16 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-03-09 11:16 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> Minor gripes: in the listing, _long_options doesn't show the / after
> directories inside the archive as my original _tar did (that's why I stuck
> it on the end instead of treating it as a suffix);

I was aware of this, I just thought that the auto-removability was
more interesting. But if you prefer... the patch below changes this.

> _path_files seems to
> have forgotten about noglobdots somehow.

Actually `globdots' was explicitly set, I don't remember why, so the
patch removes the setopts for it.

>  Somehow my _match_pattern isn't
> having an effect on _multi_parts, but I suppose that's my problem.

*Shrug*, works for me...

Bye
 Sven

diff -u oc/Core/_main_complete Completion/Core/_main_complete
--- oc/Core/_main_complete	Tue Mar  9 11:31:45 1999
+++ Completion/Core/_main_complete	Tue Mar  9 11:49:11 1999
@@ -32,7 +32,7 @@
 
 local comp name _comp_correct comax
 
-setopt localoptions nullglob rcexpandparam globdots
+setopt localoptions nullglob rcexpandparam
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 
 # Special completion contexts after `~' and `='.
diff -u oc/Core/_multi_parts Completion/Core/_multi_parts
--- oc/Core/_multi_parts	Tue Mar  9 11:31:45 1999
+++ Completion/Core/_multi_parts	Tue Mar  9 12:10:34 1999
@@ -143,7 +143,7 @@
     for i in "$matches[@]" ; do
       if [[ "$i" = *${sep}* ]]; then
         compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" \
-	        -p "$pref" -qS "$sep" -s "$orig" - "${i%%${sep}*}"
+	        -p "$pref" -s "$orig" - "${i%%${sep}*}${sep}"
       else
         compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" \
 	        -p "$pref" -s "$orig" - "${i%%${sep}*}"
@@ -152,8 +152,8 @@
   else
     for i in "$matches[@]" ; do
       if [[ "$i" = *${sep}* ]]; then
-        compadd -U -i "$IPREFIX" -p "$pref" -s "${sep}${i#*${sep}}" \
-	        "$group[@]" "$expl[@]" -M "r:|${sep:q}=*" - "${i%%${sep}*}"
+        compadd -U -i "$IPREFIX" -p "$pref" -s "${i#*${sep}}" \
+	        "$group[@]" "$expl[@]" -M "r:|${sep:q}=*" - "${i%%${sep}*}${sep}"
       else
         compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -p "$pref" - "$i"
       fi
diff -u oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files	Tue Mar  9 11:31:45 1999
+++ Completion/Core/_path_files	Tue Mar  9 11:49:15 1999
@@ -22,7 +22,7 @@
 local tmp1 collect tmp2 suffixes i ignore matchflags opt group sopt pats gopt
 local addpfx addsfx expl orig ostr nm=$compstate[nmatches] menu
 
-setopt localoptions nullglob rcexpandparam globdots extendedglob
+setopt localoptions nullglob rcexpandparam extendedglob
 unsetopt markdirs globsubst shwordsplit nounset
 
 prepaths=('')

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


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

end of thread, other threads:[~1999-03-09 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-08 10:31 PATCH: _long_options Sven Wischnowsky
1999-03-08 11:15 ` Peter Stephenson
1999-03-08 14:27   ` PATCH: _tar, again Peter Stephenson
1999-03-09 11:16 Sven Wischnowsky

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).