Details about my system: I am running Ubuntu 12.04.4 LTS on Oracle Virtual Box 4.3.6, from Windows 8.1 installed on an Asus Laptop. I'm using bash_completion version 1.3 release (I got this from the comments on the /etc/bash_completion file)
I thought bash always did auto complete for files and directories after a command. But after a google search and reading more about the bash_completion thing, I realized that this was different for different commands. But I'm facing a problem with this auto-completion feature of bash when using an alternate way to invoke emacs -nw
.
I have defined ee
as a function in my ~/.bash_aliases
file. I know this is not an alias, but I am just using a function to do what an alias would do:
function ee () {
emacs -nw "$@"
}
export -f ee
I thought that I could still use tab
completion with the ee function if I typed a partial file name. This just doesn't seem to work.
Whereas if I typed in emacs -nw
followed by a partial file name the tab completion works perfectly. I really don't understand what is missing here.
I checked the output of the command complete -p
and I get the following for both emacs
and ee
:
eakangk@eakan-u-vbox:~$ complete -p | grep 'ee'
complete -F _filedir_xspec ee
eakangk@eakan-u-vbox:~$ complete -p | grep 'emacs'
complete -F _filedir_xspec emacs
Wouldn't that mean both commands should give me the same sort of behaviour when attempting auto completion?
Edit: I hadn't seen the ee
line in the /etc/bash_completion
file when posting the question. But now I know it is there.
But the /etc/bash_completion file has the following lines:
complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx)' ee
complete -f -X '*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
What am I doing wrong here?