zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _mailboxes
@ 1999-09-20 16:41 Clint Adams
  1999-09-20 23:58 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 1999-09-20 16:41 UTC (permalink / raw)
  To: zsh-workers

Because [[ -f "${~muttrc}" ]] never returns true (the expansion does not
occur when quoted), I changed it to test ${~muttrc} && [[ -f ${~muttrc} ]].

Also, since the special folders ! < > are also used in elm, I added a
check for a ~/.elm directory.  Perhaps it would be better to look for
an .elmrc.  I can't think of a good way to do this.  Also, the check
for muttboxes should probably be replaced by a check for a muttrc,
since it is possible that a user will have a muttrc without
specifying mailboxes but impossible to specify mailboxes without
a muttrc (I hope), though I would guess that a substantial chunk
of users have neither.

Finally, I included $mailpath, since it seems like a good place to
find mailboxes that a user cares about.

This reminds me that the mailcheck functionality is still not
comprehensive.  I wonder if it would be beneficial for the mailbox
detection we're using in _mailboxes to be moved elsewhere and
used by both the completion system and checkmailpath.


*** Completion/User/_mailboxes.old	Mon Sep 20 05:06:27 1999
--- Completion/User/_mailboxes	Mon Sep 20 12:25:10 1999
***************
*** 12,18 ****
  
  if (( ! $+_mailbox_cache )) then
  
! [[ -f "${~muttrc}" ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
  
  mboxes=( ${~maildirectory}/*(^/) ${~pinedirectory}/**/*(.) )
  dirboxes=( ${~maildirectory}/*(/) )
--- 12,18 ----
  
  if (( ! $+_mailbox_cache )) then
  
! test ${~muttrc} && [[ -f ${~muttrc} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
  
  mboxes=( ${~maildirectory}/*(^/) ${~pinedirectory}/**/*(.) )
  dirboxes=( ${~maildirectory}/*(/) )
***************
*** 33,40 ****
      fi
  done
  
! [[ -n "$muttboxes" ]] &&
      _mailbox_cache=(\! \< \> $muttboxes)
  _mailbox_cache=($_mailbox_cache $mboxes $maildirboxes $MHboxes)
  
  fi
--- 33,43 ----
      fi
  done
  
! [[ -n "$muttboxes" ]] || [[ -d ~/.elm ]] &&
      _mailbox_cache=(\! \< \> $muttboxes)
+ [[ -n "$mailpath" ]] &&
+     _mailbox_cache=($_mailbox_cache ${mailpath//\?*/})
+ 
  _mailbox_cache=($_mailbox_cache $mboxes $maildirboxes $MHboxes)
  
  fi


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

* Re: PATCH: _mailboxes
  1999-09-20 16:41 PATCH: _mailboxes Clint Adams
@ 1999-09-20 23:58 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-09-20 23:58 UTC (permalink / raw)
  To: zsh-workers

On Sep 20, 12:41pm, Clint Adams wrote:
> Subject: PATCH: _mailboxes
> Because [[ -f "${~muttrc}" ]] never returns true (the expansion does not
> occur when quoted), I changed it to test ${~muttrc} && [[ -f ${~muttrc} ]].

Oops.  I still think the extra "test" is wasteful ...

> Also, since the special folders ! < > are also used in elm, I added a
> check for a ~/.elm directory.  Perhaps it would be better to look for
> an .elmrc.  I can't think of a good way to do this.

Running "strings =mutt" on a machine where it's installed indicates that it
has some (undocumented?) support for a ~/.mutt/ directory as well.  So ...

Index: _mailboxes
===================================================================
@@ -12,7 +12,7 @@
 
 if (( ! $+_mailbox_cache )) then
 
-test ${~muttrc} && [[ -f ${~muttrc} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
+[[ -f ${~muttrc:-.} ]] && muttboxes=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
 
 mboxes=( ${~maildirectory}/*(^/) ${~pinedirectory}/**/*(.) )
 dirboxes=( ${~maildirectory}/*(/) )
@@ -33,7 +33,7 @@
     fi
 done
 
-[[ -n "$muttboxes" ]] || [[ -d ~/.elm ]] &&
+[[ -n "$muttboxes" || -d ~/.elm || -d ~/.mutt ]] &&
     _mailbox_cache=(\! \< \> $muttboxes)
 [[ -n "$mailpath" ]] &&
     _mailbox_cache=($_mailbox_cache ${mailpath//\?*/})
  


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

end of thread, other threads:[~1999-09-20 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-20 16:41 PATCH: _mailboxes Clint Adams
1999-09-20 23:58 ` Bart Schaefer

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