zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: Re: completion but extra options allowed
Date: Fri, 11 Feb 2000 18:45:26 +0000	[thread overview]
Message-ID: <1000211184527.ZM32351@candle.brasslantern.com> (raw)
In-Reply-To: <20000210195143.A26109@br-online.de>

On Feb 10,  7:51pm, Andy Spiegl wrote:
} Subject: Re: completion but extra options allowed
}
} > This means that you type "mutt -f +<TAB>" and zsh will complete files in
} > your $HOME/Mail directory following the + sign.  Mutt understands the + as
} > an abbreviation for the mail directory.  In the absence of a +, zsh just
} > completes file names after "mutt -f".
} This is exactly what I am trying to teach zsh-3.1.6.pws16 to do.

The follow only sort of accomplishes it.  I now get:

zagzig[166] mutt -f +z<TAB>
zagzig[166] mutt -f /home/schaefer/Mail/z<TAB>
/home/schaefer/Mail/zanshin           /home/schaefer/Mail/zsh-maintenance 
/home/schaefer/Mail/zsh
<BEEP>

That is, the first TAB replaces the + with the $maildirectory path, the
second TAB lists the completions.

There has to be a better way.

One thing that makes this difficult is that _path_files does not accept
the -i option of compadd, only the -P option.  However, even calling

compadd -i + -f -W ~/Mail

directly does not accomplish what I expected it to.  Is this a bug, or am
I missing something?  What IS the compadd equivalent of

compctl -x 's[+] c[-1,-f],s[-f+]' -W ~/Mail -f ...

Index: Completion/User/_mailboxes
===================================================================
@@ -38,5 +38,9 @@
   _mailbox_cache=($_mailbox_cache $mboxes $maildirboxes $MHboxes)
 fi
 
-_wanted files expl 'mailbox specification' &&
+if _wanted files expl 'mailbox specification'; then
+    local opre=$PREFIX
+    [[ $PREFIX = +* ]] && PREFIX="$~maildirectory/${PREFIX#+}"
     compadd "$@" "$expl[@]" - "$_mailbox_cache[@]"
+    PREFIX=$opre
+fi

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


       reply	other threads:[~2000-02-11 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20000210153411.A27005@fruitcom.com>
     [not found] ` <1000210175857.ZM6927@candle.brasslantern.com>
     [not found]   ` <20000210195143.A26109@br-online.de>
2000-02-11 18:45     ` Bart Schaefer [this message]
2000-02-14 11:56 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=1000211184527.ZM32351@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --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).