zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Re: pws-10 RE: zsh-3.1.5-pws-9: _path_files and symbolic links
Date: Mon, 01 Mar 1999 15:46:28 +0100	[thread overview]
Message-ID: <9903011446.AA41271@ibmth.df.unipi.it> (raw)
In-Reply-To: "Sven Wischnowsky"'s message of "Mon, 01 Mar 1999 14:45:59 NFT." <199903011345.OAA15191@beta.informatik.hu-berlin.de>

(Phew, I hope I don't have to rewrite all my completions again...
Just have to wait and see if Bart excoriates `compgen'.)

Sven Wischnowsky wrote:
> This uses `compgen' (i.e. the former `complist'), not `_files'. Was
> the reason for this that `_path_files' didn't handle ignored prefixes
> correctly? My big patch made `_path_files' give `IPREFIX' to `compadd' 
> so this should work now.

Not sure if that was part of the problem, but there was an earlier problem,
also now fixed, where _path_files was less than happy about producing only
directories.  Since there's no point in having files other than
directories, I've made it just call _path_files rather than _files.  There
was also a bit of over-compensation in _mh: the perl code to generate
options using the -help output now uses $words instead of backreferences,
which is a little baroque.  Also, there was a bit missing from _zftp.
Finally, while I'm here, I've upgraded _most_recent_file to handle ~'s
properly (that ${.../#.../...} feature is neater than I realised it was
going to be).

Also

> Ah, tricky. The patch below makes path components be left unchanged
> only if the rest of the string would produce a match below that
> directory.

Was that all that needed doing?  I knew about this, but didn't complain
about this because I thought it was a feature which would need a lot of
work to alter.

--- Completion/Builtins/_zftp.bak	Mon Mar  1 13:50:33 1999
+++ Completion/Builtins/_zftp	Mon Mar  1 15:26:08 1999
@@ -15,8 +15,10 @@
       putat get getat append appendat ls dir local remote mkdir rmdir
     return
   fi
+  subcom=$words[2]
+else
+  subcom=$words[1]
 fi
-subcom=$words[2]
 
 case $subcom in
   *(cd|ls|dir))
--- Completion/Commands/_most_recent_file.bak	Mon Mar  1 13:50:34 1999
+++ Completion/Commands/_most_recent_file	Mon Mar  1 15:45:41 1999
@@ -1,4 +1,11 @@
 #defkeycomp complete-word \C-xm
-local file
-compgen -g '*(om[1])'
-(( $#file )) && compadd -f $file
+local file tilde exptilde
+if [[ $PREFIX = \~*/ ]]; then
+  tilde=${PREFIX%%/*}
+  etilde=${~tilde}
+  file=($~PREFIX*$~SUFFIX(om[1]N))
+  file=(${file/#$etilde/$tilde})
+else
+  file=($~PREFIX*$~SUFFIX(om[1]N))
+fi
+(( $#file )) && compadd -f -Q $file
--- Completion/User/_mh.bak	Mon Mar  1 13:50:35 1999
+++ Completion/User/_mh	Mon Mar  1 15:40:59 1999
@@ -1,4 +1,4 @@
-#defcomp folder comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath mhpatch
+#defcomp folder folders comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath
 
 # Completion for all possible MH commands.
 # Alter the following two to your own mh directory and the directory
@@ -17,9 +17,9 @@
   # awk is just too icky to use for this, sorry.  send me one if
   # you come up with it.
   compadd - $($words[1] -help | perl -ne 'if (/^\s*-\(?(\S+)/) {
-    $n = $words[2];
+    $n = $1;
     $n =~ s/\)//g;
-    print $n =~ s/^\[([a-z]+)\]// ? "$n\n${words[2]}$n\n" : "$n\n";
+    print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n";
   }')
   return
 elif [[ -iprefix '+' || -iprefix '@' || "$prev" = -draftfolder ]]; then
@@ -33,7 +33,7 @@
   fi
 
   # painless, or what?
-  compgen -W mhpath -/
+  _path_files -W mhpath -/
 elif [[ "$prev" = -(editor|(whatnow|rmm|show|more)proc) ]]; then
   compgen -c
 elif [[ "$prev" = -file ]]; then
@@ -50,7 +50,7 @@
 elif [[ "$prev" = -(no|)cc ]]; then
   compadd all to cc me
 elif [[ "$prev" = -[rw]cache ]]; then
-  compadd  public private never ask
+  compadd public private never ask
 else
   # Generate sequences.
   local foldnam folddir f
@@ -66,7 +66,7 @@
     # leaving foldnam empty works here
   fi
 
-  compgen -s '$(mark $foldnam | awk -F: '\''{ print $1 }'\'')'
-  compadd  reply next cur prev first last all unseen
+  compgen -s '$(mark $foldnam 2>/dev/null | awk -F: '\''{ print $1 }'\'')'
+  compadd reply next cur prev first last all unseen
   compgen -W folddir -g '<->'
 fi

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-03-01 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-01 13:45 Sven Wischnowsky
1999-03-01 14:46 ` Peter Stephenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-03-01 15:46 Sven Wischnowsky
1999-03-01 14:45 Sven Wischnowsky
1999-03-01 13:39 Sven Wischnowsky
1999-03-01 13:03 Sven Wischnowsky
1999-03-01 13:24 ` Andrej Borsenkow
1999-03-01 14:26 ` Andrej Borsenkow

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=9903011446.AA41271@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --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).