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

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

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()
 _muttfiledir()
 {
     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()
 _mutt()
 {
     local cur prev
- cur=`_get_cword`
+ cur=`_get_cword =`
     prev=${COMP_WORDS[COMP_CWORD-1]}
+ # mg: fix mutt -f =FOO<tab>
+ if [[ $prev == "=" ]]; then
+ prev=${COMP_WORDS[COMP_CWORD-2]}
+ fi

     COMPREPLY=()

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: bash-completion 1:1.1-3ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-41.89-server 2.6.32.59+drm33.24
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):
- https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/655849

Upstream bugs:
- https://alioth.debian.org/tracker/?group_id=100114&atid=413095&func=detail&aid=312184
- https://alioth.debian.org/tracker/?group_id=100114&atid=413095&func=detail&aid=312760
- https://alioth.debian.org/tracker/?group_id=100114&atid=413095&func=detail&aid=313189

Marius Gedminas (mgedmin) wrote :

Bug still present in 14.04.

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

Forwarded the fix upstream: https://alioth.debian.org/tracker/index.php?group_id=100114&atid=413095

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