On Sat, Nov 01, 2014 at 08:35:59AM +0200, Ville wrote:
> for. The profile.d snippet we ship contains a hook to load
> ~/.config/bash_completion, and you can do whatever you like in it, for
> example load completions. At that time bash_completion has not been
> sourced though which might or might not be a problem.

Right, I overlooked it.
Well actually on wheezy:
- /etc/profile.d/bash_completion.sh loads
${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion}
(before)

- /usr/share/bash-completion/bash_completion load
~/.bash_completion
(after)


Attached a quick patch.
As personal completions could probably be stored in a versioned
directory under ~/.dotfiles/.bash_completion thus I put:
> $BASH_COMPLETION_USER_DIR           overrides
> $XDG_DATA_HOME/bash-completion      overrides
> $HOME/.local/share/bash-completion
But the completions path is forced to end with an "completions"
directory. I agreed on this thinking about any further improvements over
possibilities of further user customization..

I'd just have preferred to reuse the $BASH_COMPLETION_DIR variable
as while technically a bit different, the semantic is the same.



-- 
GPG id: 0xD7F62B21
--- /usr/share/bash-completion/bash_completion.save	2014-11-02 13:08:27.587677524 -0300
+++ /usr/share/bash-completion/bash_completion	2014-11-02 14:06:54.713068420 -0300
@@ -1918,7 +1918,12 @@
 # set up dynamic completion loading
 _completion_loader()
 {
-    local compdir=./completions
+    local compdir
+
+    compdir=${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
+    . "$compdir/${1##*/}" &>/dev/null && return 124
+
+    compdir=./completions
     [[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
 
     # Try basename.
_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel

Reply via email to