[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 08d3738d566d842d74736e435f1a201bd360cb9f

Ville Skyttä ville.skytta at iki.fi
Mon Apr 13 18:15:10 UTC 2009


The following commit has been merged in the master branch:
commit 08d3738d566d842d74736e435f1a201bd360cb9f
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Mon Apr 13 21:15:02 2009 +0300

    Improve aspell dictionary completion: don't hardcode data-dir, get canonical dicts from 'aspell dicts'.

diff --git a/CHANGES b/CHANGES
index 69cd27d..3bbf1b0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -17,6 +17,8 @@ bash-completion (1.x)
   * Parse top level mplayer and friends option completions from -list-options.
   * Fix dir-only completion for make to include only dirs, not files.
   * Remove unused variable RELEASE.
+  * Improve aspell dictionary completion: don't hardcode data-dir, get
+    canonical dicts from "aspell dicts".
 
   [ Todd Zullinger ]
   * Make yum complete on filenames after install, deplist, update and upgrade
diff --git a/bash_completion b/bash_completion
index 6570e7c..e50da69 100644
--- a/bash_completion
+++ b/bash_completion
@@ -6784,10 +6784,14 @@ have aspell && {
 _aspell_dictionary()
 {
 	local datadir
-	datadir=/usr/lib/aspell
-	COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
-	COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
-	COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
+	datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell )
+	# First, get aliases (dicts dump does not list them)
+	COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) )
+	COMPREPLY=( ${COMPREPLY[@]%.alias} )
+	COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
+	# Then, add the canonical dicts
+	COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
+	COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
 }
 
 _aspell()

-- 
bash-completion



More information about the Bash-completion-commits mailing list