summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2015-01-05 11:34:06 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2015-01-05 11:34:06 -0500
commitd2cf05d1bac19d8564d0806f515b9f40fe57f4df (patch)
tree061c33d524e476bfeba63d1d6b4ec2842f3fd527 /lisp/minibuffer.el
parentc477f2073018ed4deb3810059c1032c1709164fa (diff)
downloademacs-d2cf05d1bac19d8564d0806f515b9f40fe57f4df.tar.gz
* lisp/minibuffer.el (completion-category-defaults): Default to nil.
(completion-category-defaults): New var. Set unicode-name to use substring completion.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el29
1 files changed, 22 insertions, 7 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 16312444e3c..538bd974256 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -826,16 +826,27 @@ styles for specific categories, such as files, buffers, etc."
:type completion--styles-type
:version "23.1")
-(defcustom completion-category-overrides
- '((buffer (styles . (basic substring))))
- "List of `completion-styles' overrides for specific categories.
+(defvar completion-category-defaults
+ '((buffer (styles . (basic substring)))
+ (unicode-name (styles . (basic substring))))
+ "Default settings for specific completion categories.
+Each entry has the shape (CATEGORY . ALIST) where ALIST is
+an association list that can specify properties such as:
+- `styles': the list of `completion-styles' to use for that category.
+- `cycle': the `completion-cycle-threshold' to use for that category.
+Categories are symbols such as `buffer' and `file', used when
+completing buffer and file names, respectively.")
+
+(defcustom completion-category-overrides nil
+ "List of category-specific user overrides for completion styles.
Each override has the shape (CATEGORY . ALIST) where ALIST is
an association list that can specify properties such as:
- `styles': the list of `completion-styles' to use for that category.
- `cycle': the `completion-cycle-threshold' to use for that category.
Categories are symbols such as `buffer' and `file', used when
-completing buffer and file names, respectively."
- :version "24.1"
+completing buffer and file names, respectively.
+This overrides the defaults specified in `completion-category-defaults'."
+ :version "25.1"
:type `(alist :key-type (choice :tag "Category"
(const buffer)
(const file)
@@ -851,9 +862,13 @@ completing buffer and file names, respectively."
(const :tag "Select one value from the menu." cycle)
,completion--cycling-threshold-type))))
+(defun completion--category-override (category tag)
+ (or (assq tag (cdr (assq category completion-category-overrides)))
+ (assq tag (cdr (assq category completion-category-defaults)))))
+
(defun completion--styles (metadata)
(let* ((cat (completion-metadata-get metadata 'category))
- (over (assq 'styles (cdr (assq cat completion-category-overrides)))))
+ (over (completion--category-override cat 'styles)))
(if over
(delete-dups (append (cdr over) (copy-sequence completion-styles)))
completion-styles)))
@@ -967,7 +982,7 @@ completion candidates than this number."
(defun completion--cycle-threshold (metadata)
(let* ((cat (completion-metadata-get metadata 'category))
- (over (assq 'cycle (cdr (assq cat completion-category-overrides)))))
+ (over (completion--category-override cat 'cycle)))
(if over (cdr over) completion-cycle-threshold)))
(defvar-local completion-all-sorted-completions nil)