zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: 3.1.6-pws-3: _man
Date: Thu, 09 Sep 1999 11:44:30 +0200	[thread overview]
Message-ID: <199909090944.LAA10206@paris.ifh.de> (raw)

Unless my brain is even softer than usual, manual completion currently
doesn't work with correction and approximation, because it generates
the patterns itself.  This does the trick, but perhaps there is a more
standardised way we could invent.

--- Completion/User/_man.old	Mon Aug 30 13:28:34 1999
+++ Completion/User/_man	Thu Sep  9 11:02:49 1999
@@ -2,12 +2,23 @@
 
 setopt localoptions rcexpandparam
 
-local rep expl
+local rep expl star approx
+
+if [[ $compstate[pattern_match] != [^*] ]]; then
+  # If a string other than *, we just want correction, so no `*'.
+  star='*'
+fi
+
+if [[ -n $_comp_correct ]]; then
+  # If this is set, we are correcting with this many approximations.
+  approx="(#a${_comp_correct})"
+fi
 
 if [[ $words[2] = (<->*|ln) ]]; then
-  rep=( $manpath/(man|cat)${words[2]}/$PREFIX*$SUFFIX.<->*(N:t:r) )
+  rep=(
+  $manpath/(man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) )
 else
-  rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) )
+  rep=( $manpath/(man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.<->*(N:t:r) )
 fi
 
 _description expl 'manual page'

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


             reply	other threads:[~1999-09-09  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-09  9:44 Peter Stephenson [this message]
1999-09-09 11:21 ` Tanaka Akira

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=199909090944.LAA10206@paris.ifh.de \
    --to=pws@ifh.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).