Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: can't run _email-mutt

On 2 Jun, Marc Chantreux wrote:
> a pure zsh solution is trying to parse all files that are sourced (
> using the source command ) by .muttrc.

Following patch is an attempt to do that. I'd be interested in any
feedback on how well this copes with your setup and if it breaks for
anyone's mutt/mush/zmail/whatever setup.

Has anyone got any ideas on how to narrow the context for the plugin
tag-order. Currently, if you want to specify a list of plugins as a
global setting, you need a context like ':completion:*'. That's not
nice  but the best alternative is listing commands:
Ideally, _tags should allow me to put 'email-addresses' in as a tag. It
should perhaps use $curtag.


Index: Completion/Unix/Type/_email_addresses
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_email_addresses,v
retrieving revision 1.3
diff -u -r1.3 _email_addresses
--- Completion/Unix/Type/_email_addresses	15 Jan 2004 16:56:56 -0000	1.3
+++ Completion/Unix/Type/_email_addresses	6 Jun 2005 16:26:35 -0000
@@ -14,7 +14,16 @@
 # plugins
 (( $+functions[_email-mail] )) ||
 _email-mail() {
-  reply=( ${${${(M)${(f)"$(<$files[$plugin])"}:#alias*}##alias[[:blank:]]##}/[[:blank:]]##/:} )
+  local rc rcfiles i
+  rcfiles=( $files[$plugin] )
+  for ((i=1;i<=$#rcfiles;i++)); do
+    rcfiles+=( ${~${(M)${(f)"$(<$rcfiles[i])"}:#source*}##source[[:blank:]]##}(N) )
+  done
+  reply=()
+  for rc in $rcfiles; do
+    reply+=( ${${${(M)${(f)"$(<$rc)"}:#alias*}##alias[[:blank:]]##}/[[:blank:]]##/:} )
+  done
   return 300
 (( $+functions[_email-mutt] )) || _email-mutt() { _email-mail }
@@ -79,7 +88,7 @@
 _email_addresses() {
   local -a plugins reply list args
   local -A opts files
-  local plugin rcfile expl ret fret
+  local plugin rcfile muttrc expl ret fret
   local __specialx='][()<>@,;:\\".'
   local __spacex=" 	"				# Space, tab
@@ -119,7 +128,10 @@
   # get list of all plugins except any with missing config files
-  files=( MH ${MH:-~/.mh_profile} mutt ~/.muttrc mush ~/.mushrc mail ${MAILRC:-~/.mailrc} pine ~/.addressbook )
+  if ! zstyle -s ":completion:${curcontext}:email-addresses" muttrc muttrc; then
+    [[ -e ~/mutt/muttrc ]] && muttrc="~/mutt/muttrc" || muttrc="~/.muttrc"
+  fi
+  files=( MH ${MH:-~/.mh_profile} mutt $muttrc mush ~/.mushrc mail ${MAILRC:-~/.mailrc} pine ~/.addressbook )
     $files(Ne:'REPLY=( ${(k)files[(r)$REPLY]} ):')

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

Messages sorted by: Reverse Date, Date, Thread, Author