[Bash-completion-devel] [bash-completion-Bugs][313189] mutt completion: file names instead of mailboxes

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Thu Jun 23 17:12:50 UTC 2011


Bugs item #313189, was opened at 23.06.2011 17:12
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313189&group_id=100114

Status: Open
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: mutt completion: file names instead of mailboxes 
Distribution: None
Originally reported in: None
Milestone: None
Status: None
Original bug number: #312760


Initial Comment:
I can confirm this behaviour!





PART 1, workaround:



After reading parts of the source code I managed to use bash_completion for mutt. The following modifications have to be done:



1.)

Mutt uses '=' and '+' as synonyms for the users mail directory. Make sure the character you use is not in $COMP_WORDBREAKS. According to the source code you remove '=' and/or '+' from $COMP_WORDBREAKS by putting 'COMP_WORDBREAKS=${COMP_WORDBREAKS//=}' and/or 'COMP_WORDBREAKS=${COMP_WORDBREAKS//+}' in your local .bashrc or the system /etc/bash.bashrc file.



2.)

The leading '=' or '+' character now disappears when pressing <TAB>. Keep the leading character in place by editing line 128 in /etc/bash_completion.d/mutt, part of _muttfiledir():



original line: COMPREPLY=( ${COMPREPLY[@]/#$folder\//=} )

new line: COMPREPLY=( ${COMPREPLY[@]/#$folder\//${cur:0:1}} )





PART 2: more description:



The following holds when '=' and '+' are part of $COMP_WORDBREAKS.



Line 301 of file /etc/bash_completion, part of __reassemble_comp_words_by_ref(), is not doing fine:



---snip line 301---

[ $j -ge 2 ] && ((j--))

---snip---



This line tears together the '-f' option from "mutt -f =xy<TAB>" with the following argument '=xy'. As a consequence no hits can be found anymore. The given example 'mutt -f =xy<TAB>' needs '[ $j -ge 3 ]' for successful completion. In case we use more option like in 'mutt -R -f =xy<TAB>', '[ $j -ge 4 ]' is right.



Last not least, the static '[ $j -ge .. ]' - test keeps bash_completion from expanding filenames with a '=' or '+' character in its name.





I hope this is helpful,

Christian





My system: mostly Debian GNU/Linux 6.0.1 (squeeze), bash 4.1-3, bash-completion 1:1.3-1

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313189&group_id=100114



More information about the Bash-completion-devel mailing list