mutt -f =FOO<tab> and mutt -f +FOO<tab> are broken

Bug #1008380 reported by Marius Gedminas on 2012-06-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)

Bug Description

Here are two closely-related bugs in Mutt tab-completion. My muttrc sets folder=~/Mail, and I've a mailbox named UNKNOWN-LIST. I can open it by typing either 'mutt -f =UNKNOWN-LIST' or 'mutt -f +UNKNOWN-LIST'. As you can imagine, that's more typing than I like. I want tab-completion.

Bug #1: 'mutt -f +U<tab>' completes to 'mutt -f UNKNOWN-LIST', i.e. it loses the leading '+'. Fix:

--- a/bash_completion.d/mutt
+++ b/bash_completion.d/mutt
@@ -87,6 +87,10 @@ _muttfiledir()
         # (minus the leading '=' sign).
         COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
         COMPREPLY=( ${COMPREPLY[@]#$folder/} )
+ # mg: fix mutt -f +FOO<tab>
+ if [[ $cur == [+]* ]]; then
+ COMPREPLY=( +${COMPREPLY[@]#$folder/} )
+ fi
         return 0
     elif [ "$cur" == !* ]; then
         spoolfile="$( $muttcmd -Q spoolfile | \

Bug #2: 'mutt -f =U<tab>' fails to complete folder names (instead it tries to complete aliases). Fix:

--- a/bash_completion.d/mutt
+++ b/bash_completion.d/mutt

@@ -75,7 +75,7 @@ _muttquery()
     local cur folder spoolfile muttcmd=${COMP_WORDS[0]}
- cur=`_get_cword`
+ cur=`_get_cword =`

     # This is currently not working so well. Perhaps this function should
     # just call _filedir() for the moment.

@@ -101,8 +105,12 @@ _muttfiledir()
     local cur prev
- cur=`_get_cword`
+ cur=`_get_cword =`
+ # mg: fix mutt -f =FOO<tab>
+ if [[ $prev == "=" ]]; then
+ fi


ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: bash-completion 1:1.1-3ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-41.89-server
Uname: Linux 2.6.32-41-server x86_64
Architecture: amd64
Date: Mon Jun 4 11:12:53 2012
PackageArchitecture: all
SourcePackage: bash-completion

Marius Gedminas (mgedmin) wrote :
Marius Gedminas (mgedmin) wrote :

On Ubuntu 13.10, with bash-completion 1:2.0-1ubuntu3:

- mutt -f =U<tab> completes to mutt -f UNKNOWN-LIST

- mutt -f +U<tab> completes to mutt -f UNKNOWN-LIST

In both cases the prefix is lost.

Related bugs (probably duplicates):

Upstream bugs:

Marius Gedminas (mgedmin) wrote :

Bug still present in 14.04.

Marius Gedminas (mgedmin) wrote :
Marius Gedminas (mgedmin) wrote :

Forwarded the fix upstream:

(The three older upstream bugs remain open and totally unclear. I'm assuming I should ignore them just like upstream maintainers already do.)

The attachment "Patch against upstream git master" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Marius Gedminas (mgedmin) wrote :

Ubuntu 16.10 still has the 1st bug ('mutt -f +U<tab>' completes to 'mutt -f UNKNOWN-LIST' without the + prefix), but the 2nd bug is gone ('mutt -f =U<tab>' completes correctly).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.