diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 29 |
2 files changed, 28 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f413526c0b2..df760f20a7e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-01-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuffer.el (completion-category-defaults): New var. | ||
| 4 | Set unicode-name to use substring completion. | ||
| 5 | (completion-category-defaults): Set it to nil. | ||
| 6 | |||
| 1 | 2015-01-04 Dmitry Gutov <dgutov@yandex.ru> | 7 | 2015-01-04 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 8 | ||
| 3 | Add mouse interaction to xref. | 9 | Add mouse interaction to xref. |
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." | |||
| 826 | :type completion--styles-type | 826 | :type completion--styles-type |
| 827 | :version "23.1") | 827 | :version "23.1") |
| 828 | 828 | ||
| 829 | (defcustom completion-category-overrides | 829 | (defvar completion-category-defaults |
| 830 | '((buffer (styles . (basic substring)))) | 830 | '((buffer (styles . (basic substring))) |
| 831 | "List of `completion-styles' overrides for specific categories. | 831 | (unicode-name (styles . (basic substring)))) |
| 832 | "Default settings for specific completion categories. | ||
| 833 | Each entry has the shape (CATEGORY . ALIST) where ALIST is | ||
| 834 | an association list that can specify properties such as: | ||
| 835 | - `styles': the list of `completion-styles' to use for that category. | ||
| 836 | - `cycle': the `completion-cycle-threshold' to use for that category. | ||
| 837 | Categories are symbols such as `buffer' and `file', used when | ||
| 838 | completing buffer and file names, respectively.") | ||
| 839 | |||
| 840 | (defcustom completion-category-overrides nil | ||
| 841 | "List of category-specific user overrides for completion styles. | ||
| 832 | Each override has the shape (CATEGORY . ALIST) where ALIST is | 842 | Each override has the shape (CATEGORY . ALIST) where ALIST is |
| 833 | an association list that can specify properties such as: | 843 | an association list that can specify properties such as: |
| 834 | - `styles': the list of `completion-styles' to use for that category. | 844 | - `styles': the list of `completion-styles' to use for that category. |
| 835 | - `cycle': the `completion-cycle-threshold' to use for that category. | 845 | - `cycle': the `completion-cycle-threshold' to use for that category. |
| 836 | Categories are symbols such as `buffer' and `file', used when | 846 | Categories are symbols such as `buffer' and `file', used when |
| 837 | completing buffer and file names, respectively." | 847 | completing buffer and file names, respectively. |
| 838 | :version "24.1" | 848 | This overrides the defaults specified in `completion-category-defaults'." |
| 849 | :version "25.1" | ||
| 839 | :type `(alist :key-type (choice :tag "Category" | 850 | :type `(alist :key-type (choice :tag "Category" |
| 840 | (const buffer) | 851 | (const buffer) |
| 841 | (const file) | 852 | (const file) |
| @@ -851,9 +862,13 @@ completing buffer and file names, respectively." | |||
| 851 | (const :tag "Select one value from the menu." cycle) | 862 | (const :tag "Select one value from the menu." cycle) |
| 852 | ,completion--cycling-threshold-type)))) | 863 | ,completion--cycling-threshold-type)))) |
| 853 | 864 | ||
| 865 | (defun completion--category-override (category tag) | ||
| 866 | (or (assq tag (cdr (assq category completion-category-overrides))) | ||
| 867 | (assq tag (cdr (assq category completion-category-defaults))))) | ||
| 868 | |||
| 854 | (defun completion--styles (metadata) | 869 | (defun completion--styles (metadata) |
| 855 | (let* ((cat (completion-metadata-get metadata 'category)) | 870 | (let* ((cat (completion-metadata-get metadata 'category)) |
| 856 | (over (assq 'styles (cdr (assq cat completion-category-overrides))))) | 871 | (over (completion--category-override cat 'styles))) |
| 857 | (if over | 872 | (if over |
| 858 | (delete-dups (append (cdr over) (copy-sequence completion-styles))) | 873 | (delete-dups (append (cdr over) (copy-sequence completion-styles))) |
| 859 | completion-styles))) | 874 | completion-styles))) |
| @@ -967,7 +982,7 @@ completion candidates than this number." | |||
| 967 | 982 | ||
| 968 | (defun completion--cycle-threshold (metadata) | 983 | (defun completion--cycle-threshold (metadata) |
| 969 | (let* ((cat (completion-metadata-get metadata 'category)) | 984 | (let* ((cat (completion-metadata-get metadata 'category)) |
| 970 | (over (assq 'cycle (cdr (assq cat completion-category-overrides))))) | 985 | (over (completion--category-override cat 'cycle))) |
| 971 | (if over (cdr over) completion-cycle-threshold))) | 986 | (if over (cdr over) completion-cycle-threshold))) |
| 972 | 987 | ||
| 973 | (defvar-local completion-all-sorted-completions nil) | 988 | (defvar-local completion-all-sorted-completions nil) |