about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2005-06-08 12:07:48 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2005-06-08 12:07:48 +0000
commitf478a8b75eaa1a83edb7960b383892043e918f61 (patch)
tree1edcb77f6139c2f396a8f518bc7769f20ffd7794
parent57879ec4295839be9ed42b920b5727fc0b34855e (diff)
downloadzsh-f478a8b75eaa1a83edb7960b383892043e918f61.tar.gz
zsh-f478a8b75eaa1a83edb7960b383892043e918f61.tar.xz
zsh-f478a8b75eaa1a83edb7960b383892043e918f61.zip
21313: make code for extracting mutt aliases do a better job of finding rc files
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_email_addresses18
2 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 98f1374a7..8072ec978 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-08  Oliver Kiddle  <opk@zsh.org>
+
+	* 21313: Completion/Unix/Type/_email_addresses: make code for
+	extracting mutt aliases do a better job of finding rc files
+
 2005-06-08  Doug Kearns  <djkea2@gus.gscit.monash.edu.au>
 
 	* 21306: Completion/Zsh/Command/_disable: add -s option for removing
diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses
index 8c17ed066..ffff87163 100644
--- a/Completion/Unix/Type/_email_addresses
+++ b/Completion/Unix/Type/_email_addresses
@@ -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-local() {
 _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 @@ _email_addresses() {
   fi
 
   # 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 )
   plugins=( 
     ${${(k)functions[(I)_email-*]#*-}:#(${(kj.|.)~files})}
     $files(Ne:'REPLY=( ${(k)files[(r)$REPLY]} ):')