<<< Date Index >>>     <<< Thread Index >>>

Re: [Mutt] #2058: browser and account-hook are poorly documented



#2058: browser and account-hook are poorly documented
------------------------------------+---------------------------------------
  Reporter:  reich@xxxxxxxxxxxxxxx  |       Owner:  mutt-dev
      Type:  defect                 |      Status:  closed  
  Priority:  minor                  |   Milestone:          
 Component:  mutt                   |     Version:          
Resolution:  fixed                  |    Keywords:          
------------------------------------+---------------------------------------
Changes (by pdmef):

  * status:  new => closed
  * resolution:  => fixed


Old description:

> {{{
> I have, let's say, two IMAP accounts, imap.fas.harvard.edu and
> math.harvard.edu.  I manage them both by an extensive system of account-
> hooks; do not accuse me of forgetting variables, for I have not.  The
> hooks are:
>
> account-hook . '\
>  unset imap_home_namespace; \
>  set mbox="=saved-messages"; \
>  set postponed="=postponed"; \
>  set record="=sent-mail" '
>
> account-hook imap://imap\.fas\.harvard\.edu '\
>  set folder="imap://imap.fas.harvard.edu"; \
>  set mbox="=saved-messages"; \
>  set postponed="=postponed"; \
>  set record="=sent-mail"; \
>  set spoolfile="=INBOX" '
>
> account-hook imap://math\.harvard\.edu '\
>  set folder="imap://math.harvard.edu"; \
>  set imap_home_namespace="mail"; \
>  set mbox="=saved-messages"; \
>  set postponed="=postponed"; \
>  set record="=sent-mail" '
>
> I start my session by logging in to imap.fas.harvard.edu and checking the
> various folders there via the browser (i.e. hitting c-<tab> various
> times).  Then I switch to math.harvard.edu, but lo, pressiing c-<tab>
> continues to display the imap.fas.harvard.edu folders.  In fact, it
> manages to re-activate that account-hook, so that I must re-change
> folders to get back to math.harvard.edu, signing in again.
>
> It appears that mutt maintains two parallel "current directories": the
> first, the current IMAP folder, and the second, the current directory in
> the browser file hierarchy.  Changing the first does not change the
> second, though changing the second changes the first.  Hence, if I enter
> an IMAP folder through the browser, then change IMAP accounts via a
> folder change without using the browser, I can no longer use the browser
> conveniently.
>
> There are invonvenient workarounds, naturally.  I could type c-=-<tab> to
> force completing the current $folder, but this has a surprise drawback.
> It doesn't bring me to the browser if there is an unambiguous (partial)
> completion available; instead, it substitutes the completion.  This is
> true _even_if_the_current_directory_is_the_base_, and if the unambiguous
> completion would be elided by an application of $imap_home_namespace.
> That is, if we have
>
> folder=imap://imap.fas.harvard.edu
> imap_home_namespace=mail
>
> and if the only subdirectory of the server's root is mail, then pressing
> c-=-<tab> will display imap://imap.fas.harvard.edu/mail and the cursor on
> the editor's line, whereas pressing c-<tab> (before screwing up the
> browser) will correctly display the _contents_ of mail and not the folder
> itself.  In other words, the editor ignores settings which are relevant
> to the browser even though it also precludes the use of the browser in
> some circumstances, so that these settings are, in fact, unreliable.
>
> This makes a meaningful "display folders" macro nigh-on impossible in a
> situation with multiple accounts.  c-<tab> is unreliable, and c-=-<tab>
> is reliable but inaccurate.  The apparently sole solution is to decorate
> each account-hook with a new macro definition for the desired command,
> according to the particular nature of the server.  Though this is
> technically correct, perhaps the more useful solution is to implement a
> <show-folders> function that does what it's supposed to and displays the
> root namespace of the current account, with $imap_home_namespace properly
> interpreted and without indirecting through the editor.  The current
> browser is little more than a glorified tab-completion mechanism and is
> apparently not quite in agreement with the editor as to what, exactly, is
> being completed.
> >How-To-Repeat:
> >Fix:
> }}}

New description:

 {{{
 I have, let's say, two IMAP accounts, imap.fas.harvard.edu and
 math.harvard.edu.  I manage them both by an extensive system of account-
 hooks; do not accuse me of forgetting variables, for I have not.  The
 hooks are:

 account-hook . '\
  unset imap_home_namespace; \
  set mbox="=saved-messages"; \
  set postponed="=postponed"; \
  set record="=sent-mail" '

 account-hook imap://imap\.fas\.harvard\.edu '\
  set folder="imap://imap.fas.harvard.edu"; \
  set mbox="=saved-messages"; \
  set postponed="=postponed"; \
  set record="=sent-mail"; \
  set spoolfile="=INBOX" '

 account-hook imap://math\.harvard\.edu '\
  set folder="imap://math.harvard.edu"; \
  set imap_home_namespace="mail"; \
  set mbox="=saved-messages"; \
  set postponed="=postponed"; \
  set record="=sent-mail" '

 I start my session by logging in to imap.fas.harvard.edu and checking the
 various folders there via the browser (i.e. hitting c-<tab> various
 times).  Then I switch to math.harvard.edu, but lo, pressiing c-<tab>
 continues to display the imap.fas.harvard.edu folders.  In fact, it
 manages to re-activate that account-hook, so that I must re-change folders
 to get back to math.harvard.edu, signing in again.

 It appears that mutt maintains two parallel "current directories": the
 first, the current IMAP folder, and the second, the current directory in
 the browser file hierarchy.  Changing the first does not change the
 second, though changing the second changes the first.  Hence, if I enter
 an IMAP folder through the browser, then change IMAP accounts via a folder
 change without using the browser, I can no longer use the browser
 conveniently.

 There are invonvenient workarounds, naturally.  I could type c-=-<tab> to
 force completing the current $folder, but this has a surprise drawback.
 It doesn't bring me to the browser if there is an unambiguous (partial)
 completion available; instead, it substitutes the completion.  This is
 true _even_if_the_current_directory_is_the_base_, and if the unambiguous
 completion would be elided by an application of $imap_home_namespace.
 That is, if we have

 folder=imap://imap.fas.harvard.edu
 imap_home_namespace=mail

 and if the only subdirectory of the server's root is mail, then pressing
 c-=-<tab> will display imap://imap.fas.harvard.edu/mail and the cursor on
 the editor's line, whereas pressing c-<tab> (before screwing up the
 browser) will correctly display the _contents_ of mail and not the folder
 itself.  In other words, the editor ignores settings which are relevant to
 the browser even though it also precludes the use of the browser in some
 circumstances, so that these settings are, in fact, unreliable.

 This makes a meaningful "display folders" macro nigh-on impossible in a
 situation with multiple accounts.  c-<tab> is unreliable, and c-=-<tab> is
 reliable but inaccurate.  The apparently sole solution is to decorate each
 account-hook with a new macro definition for the desired command,
 according to the particular nature of the server.  Though this is
 technically correct, perhaps the more useful solution is to implement a
 <show-folders> function that does what it's supposed to and displays the
 root namespace of the current account, with $imap_home_namespace properly
 interpreted and without indirecting through the editor.  The current
 browser is little more than a glorified tab-completion mechanism and is
 apparently not quite in agreement with the editor as to what, exactly, is
 being completed.
 >How-To-Repeat:
 >Fix:
 }}}

--

Comment:

 Closing, as documentation with example was added in [22f21b558f57], see
 http://dev.mutt.org/doc/manual.html#account-hook

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/2058#comment:11>
Mutt <http://www.mutt.org/>
The Mutt mail user agent