Home > linux > Follow-up on mplayer’s tab-completion

Follow-up on mplayer’s tab-completion

March 23rd, 2009

So after a big of Googling and finding this bug (after several others), I was made aware of three things (in response to my previous post):

  1. mplayer’s tab-completion support does in fact come from bashcomp
  2. this support is covered in the “base” module
  3. the appropriate file uses strange regular expressions

At the time this bug was filed, the appropriate file to edit was (or was in) /etc/bash_completion. Since bash-completion-20081218, the bug was fixed, but the package also underwent some changes that seemingly caused locations of config files to change. (Apologies if this is incorrect, but I never went diving into the configs of bashcomp before now!)

In any case, the bashcomp configuration files are now in /usr/share/bash-completion. Since mplayer’s support is in base, the file that handles mplayer is “base” in that directory.

Now as for the “strange” regular expressions, that deserves some qualification. I’ve already seen lots of regular expressions on my (albeit rather short) day, but the reason I consider these ones strange is because they seem both unnecessary and redundant. The line in question is currently 5983 on my version 20081219-r1:

_filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|...|fl[iv]|FL[IV]...'

The two ellipses are my own adding, since the actual expression is one humongous line that ends up looking rather horrible here. My problems with this are both the explicit writing out of upper and lower case alternatives and the the bothering to do things like fl[iv]. Actually, I don’t have a problem with the latter except in the presence of the former. And to be fair, I probably wouldn’t have ever cared or noticed if I hadn’t been able to find “flv” when grepping numerous files. Not that “greppability” is necessarily a goal for configuration files, but it’s certainly annoying when it’s specifically hindered by regular expressions that save negligible space like the ones in this file.

As a final note, I’m going to disclaim that I’m no expert on bash scripting and the various intricacies of handling regular expressions therein, so I’d be happy to hear from anyone who knows better about why I should lay off the poor bash-completion folks. :-P

External Links

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Technorati

linux ,

  1. March 24th, 2009 at 09:58 | #1

    Hi,
    I read your previous post too.

    I’m new to maintaining bash-completion but I am planning a version bump soon to fix at least one other issue. If you have an issue, please file it to Gentoo’s bugzilla and I will also consult upstream so it can get fixed there as well.

    (I have never watched a .flv movie, heh)

    As for the file moves and configuration change. Yes, it is kind of annoying but we were doing it wrong before and since the inception of b-c, many other distros starting changing things around too. Gentoo (with its eselect support) is at the forefront for how to “properly” handle b-c modules. =)

    Otherwise, I’m glad that you like the new b-c support.

  1. No trackbacks yet.