zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: _long_options
Date: Mon, 8 Mar 1999 11:31:42 +0100 (MET)	[thread overview]
Message-ID: <199903081031.LAA11761@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Mon, 8 Mar 1999 11:03:38 +0100 (MET)


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


             reply	other threads:[~1999-03-08 10:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-08 10:31 Sven Wischnowsky [this message]
1999-03-08 11:15 ` Peter Stephenson
1999-03-08 14:27   ` PATCH: _tar, again Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
1999-03-08 10:03 PATCH: _long_options Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199903081031.LAA11761@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).