1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-28 10:56:36 +00:00

* lisp/minibuffer.el (completion-category-defaults): Default to nil.

(completion-category-defaults): New var.
Set unicode-name to use substring completion.
This commit is contained in:
Stefan Monnier 2015-01-05 11:34:06 -05:00
parent c477f20730
commit d2cf05d1ba
3 changed files with 30 additions and 7 deletions

View File

@ -166,6 +166,8 @@ characters, which can be used for geometry-related calculations.
* Editing Changes in Emacs 25.1 * Editing Changes in Emacs 25.1
** Unicode names entered via C-x 8 RET now use substring completion by default.
** New minor mode global-eldoc-mode is enabled by default. ** New minor mode global-eldoc-mode is enabled by default.
** Emacs now supports "bracketed paste mode" when running on a terminal ** Emacs now supports "bracketed paste mode" when running on a terminal

View File

@ -1,3 +1,9 @@
2015-01-05 Stefan Monnier <monnier@iro.umontreal.ca>
* minibuffer.el (completion-category-defaults): New var.
Set unicode-name to use substring completion.
(completion-category-defaults): Set it to nil.
2015-01-04 Dmitry Gutov <dgutov@yandex.ru> 2015-01-04 Dmitry Gutov <dgutov@yandex.ru>
Add mouse interaction to xref. Add mouse interaction to xref.

View File

@ -826,16 +826,27 @@ styles for specific categories, such as files, buffers, etc."
:type completion--styles-type :type completion--styles-type
:version "23.1") :version "23.1")
(defcustom completion-category-overrides (defvar completion-category-defaults
'((buffer (styles . (basic substring)))) '((buffer (styles . (basic substring)))
"List of `completion-styles' overrides for specific categories. (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 Each override has the shape (CATEGORY . ALIST) where ALIST is
an association list that can specify properties such as: an association list that can specify properties such as:
- `styles': the list of `completion-styles' to use for that category. - `styles': the list of `completion-styles' to use for that category.
- `cycle': the `completion-cycle-threshold' 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 Categories are symbols such as `buffer' and `file', used when
completing buffer and file names, respectively." completing buffer and file names, respectively.
:version "24.1" This overrides the defaults specified in `completion-category-defaults'."
:version "25.1"
:type `(alist :key-type (choice :tag "Category" :type `(alist :key-type (choice :tag "Category"
(const buffer) (const buffer)
(const file) (const file)
@ -851,9 +862,13 @@ completing buffer and file names, respectively."
(const :tag "Select one value from the menu." cycle) (const :tag "Select one value from the menu." cycle)
,completion--cycling-threshold-type)))) ,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) (defun completion--styles (metadata)
(let* ((cat (completion-metadata-get metadata 'category)) (let* ((cat (completion-metadata-get metadata 'category))
(over (assq 'styles (cdr (assq cat completion-category-overrides))))) (over (completion--category-override cat 'styles)))
(if over (if over
(delete-dups (append (cdr over) (copy-sequence completion-styles))) (delete-dups (append (cdr over) (copy-sequence completion-styles)))
completion-styles))) completion-styles)))
@ -967,7 +982,7 @@ completion candidates than this number."
(defun completion--cycle-threshold (metadata) (defun completion--cycle-threshold (metadata)
(let* ((cat (completion-metadata-get metadata 'category)) (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))) (if over (cdr over) completion-cycle-threshold)))
(defvar-local completion-all-sorted-completions nil) (defvar-local completion-all-sorted-completions nil)