zsh-users
 help / color / mirror / code / Atom feed
* completion but extra options allowed
@ 2000-02-10 13:34 Eric Smith
  2000-02-10 17:58 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Smith @ 2000-02-10 13:34 UTC (permalink / raw)
  To: zsh-users

Hi

I have the following rule

compctl -k "(vim perl32 dbi xml xsl lists mutt-dev mutt-users vim flexfax hyla)"  -P " -f /home/eric/Mail/" mutt

This works file except that it does not allow tabbing completing outside
of the values specified in the array.

Is it possible to allow these options and then any other option in the
same rule?

thanx

-- 
Eric Smith
eric@fruitcom.com
00 27 21 4265311

If I had a sig it would be fun.
 The quest for the Holy Sig has begun.
 I have not yet a clue,
 What will you see next issue?


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

* Re: completion but extra options allowed
  2000-02-10 13:34 completion but extra options allowed Eric Smith
@ 2000-02-10 17:58 ` Bart Schaefer
  2000-02-10 18:51   ` Andy Spiegl
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2000-02-10 17:58 UTC (permalink / raw)
  To: Eric Smith, zsh-users

On Feb 10,  3:34pm, Eric Smith wrote:
} Subject: completion but extra options allowed
}
} Is it possible to allow these options and then any other option in the
} same rule?

Yes, in all sorts of ways.

For mutt specifically, you might try this (taken from Misc/compctl-examples
in 3.0.7 and edited to replace "elm" with "mutt"):

compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' - \
        's[-f],c[-1,-f]' -f -- mutt

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

In the more general case, you don't have to use -k all by itself; you can
simply add more options to the "compctl" command line and zsh will try
each of them until it finds one that works.  Misc/compctl-examples has a
large number of samples.

Finally, if you're using zsh-3.1.6*, you can get this and more "for free"
by enabling the new completion system.  Look up "compinit" in the manual.

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


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

* Re: completion but extra options allowed
  2000-02-10 17:58 ` Bart Schaefer
@ 2000-02-10 18:51   ` Andy Spiegl
  2000-02-11 17:55     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Spiegl @ 2000-02-10 18:51 UTC (permalink / raw)
  To: zsh-users

Hi Bart,

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

> Finally, if you're using zsh-3.1.6*, you can get this and more "for free"
> by enabling the new completion system.  Look up "compinit" in the manual.
Hm, not here. :-(

eule:~>mutt -<TAB>
option
-F -- init file
-H -- draft file
-R -- open in read-only mode
[...]

eule:~>mutt -f <TAB>
/home/spiegl/Mail/aaa
/home/spiegl/Mail/bbb
/home/spiegl/Mail/ccc
[...]

eule:~>mutt -f +<TAB>
<BEEP>

I guess the '+' is not implemented (yet), right?
Looking at _mutt (as a zsh-novice) I can't find anything like it.

And it doesn't expand local filenames either:
eule:~>cd Mail
eule:~/Mail>mutt -f a<TAB>
<BEEP>

BTW, _mailboxes expects the "mailboxes" definition to be in ~/.muttrc.  I
had to change it, because I've got it in ~/.mutt/local, which is sourced
from ~/.muttrc.  The same goes for the aliases. :-(

Bye,
 Andy.

-- 
 E-Mail: Andy@spiegl.de     URL: http://andy.spiegl.de
 PGP/GPG: see headers
                                o      _     _         _
  --------- __o       __o      /\_   _ \\o  (_)\__/o  (_)
  ------- _`\<,_    _`\<,_    _>(_) (_)/<_    \_| \   _|/' \/
  ------ (_)/ (_)  (_)/ (_)  (_)        (_)   (_)    (_)'  _\o_
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Smile... Tomorrow will be worse.


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

* Re: completion but extra options allowed
  2000-02-10 18:51   ` Andy Spiegl
@ 2000-02-11 17:55     ` Bart Schaefer
  2000-02-14 14:00       ` Andy Spiegl
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2000-02-11 17:55 UTC (permalink / raw)
  To: Andy Spiegl, zsh-users

On Feb 10,  7:51pm, Andy Spiegl wrote:
} Subject: Re: completion but extra options allowed
}
} Hi Bart,
} 
} > 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.

Yes, I noticed just after posting that this isn't actually handled by
_mutt and _mailboxes.  In attempting to do something with this, I found
some rather strange things going on in the guts of the completion.

_mutt calls _arguments in the expected way.

_arguments calls "_description arguments expl mailbox" which sets expl
to (-J -default-).

_arguments then calls "_mailboxes -J -default-" which (after setting up
the cache) calls "_wanted files expl 'mailbox specification'" which again
sets expl to (-J -default-).

_mailboxes then calls "compadd -J -default- -J -default- - ..." which
seems a bit odd.  The first -J -default- is from "$@" and the second is
of course "$expl[@]".  Is that really doing the right thing?

} And it doesn't expand local filenames either:
} eule:~>cd Mail
} eule:~/Mail>mutt -f a<TAB>

I think that's intentional on the grounds that files not in the mail
directory are not likely to be mail files.  It should probably be set
by a style, if the 'mailbox' style won't already work.

} BTW, _mailboxes expects the "mailboxes" definition to be in ~/.muttrc.  I
} had to change it, because I've got it in ~/.mutt/local, which is sourced
} from ~/.muttrc.  The same goes for the aliases. :-(

You don't need to edit _mailboxes, you just need

	set muttrc=~/.mutt/local

somewhere in your startup files.  You can do the same for pinedirectory
and maildirectory if they aren't ~/mail and ~/Mail (respectively).

Oh, wait -- _mutt is itself stomping $muttrc.  That's wrong;  I can at
least fix that part:

Index: Completion/User/_mutt
===================================================================
@@ -1,6 +1,6 @@
 #compdef mutt
 
-local curcontext="$curcontext" state line muttrc="~/.muttrc" ret=1
+local curcontext="$curcontext" state line ret=1
 
  _arguments -C \
  '::recipient:->userhost' \


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


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

* Re: completion but extra options allowed
  2000-02-11 17:55     ` Bart Schaefer
@ 2000-02-14 14:00       ` Andy Spiegl
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Spiegl @ 2000-02-14 14:00 UTC (permalink / raw)
  To: zsh-users

Hi Bart,

> In attempting to do something with this, I found some rather strange
> things going on in the guts of the completion.
Oops, interesting.

[...]
> _mailboxes then calls "compadd -J -default- -J -default- - ..." which
> seems a bit odd.  The first -J -default- is from "$@" and the second is
> of course "$expl[@]".  Is that really doing the right thing?
Uh, oh, don't ask me.  I hardly know anything about the zsh completion
system (yet).  Anyone else want to comment Barts discoveries?

> } And it doesn't expand local filenames either:
> } eule:~>cd Mail
> } eule:~/Mail>mutt -f a<TAB>
> 
> I think that's intentional on the grounds that files not in the mail
> directory are not likely to be mail files.  It should probably be set
> by a style, if the 'mailbox' style won't already work.
I wasn't able to find anything about the mailbox-style in the docs.  :-(
What can I set with it?

> You don't need to edit _mailboxes, you just need
> 	set muttrc=~/.mutt/local
Oh, okay...together with your patch (which is basically what I did too :-)
But of course that doesn't work for the aliases, which are in ~/.mutt/aliases.
Hm, while just looking at _mutt I see that mailaddresses are taken from
'recipient:->userhost', which I don't understand.  Where is that info
being set?  Or in other words: how can I influence the list of addressees?

Thanks,
 Andy.

-- 
 E-Mail: Andy@spiegl.de     URL: http://andy.spiegl.de
 PGP/GPG: see headers
                                o      _     _         _
  --------- __o       __o      /\_   _ \\o  (_)\__/o  (_)
  ------- _`\<,_    _`\<,_    _>(_) (_)/<_    \_| \   _|/' \/
  ------ (_)/ (_)  (_)/ (_)  (_)        (_)   (_)    (_)'  _\o_
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In a world without fences - who needs Gates?


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

end of thread, other threads:[~2000-02-14 14:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-10 13:34 completion but extra options allowed Eric Smith
2000-02-10 17:58 ` Bart Schaefer
2000-02-10 18:51   ` Andy Spiegl
2000-02-11 17:55     ` Bart Schaefer
2000-02-14 14:00       ` Andy Spiegl

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