diff options
| author | Daniel Mendler | 2022-01-04 21:08:04 +0100 |
|---|---|---|
| committer | Stefan Monnier | 2022-01-04 19:16:37 -0500 |
| commit | 30d4cfc0806ee1de5a8e5091f0cc5bce22830460 (patch) | |
| tree | 9abb29d376e2a669069d426ceab964792140352f | |
| parent | c899d9742a3dee2069eb3a4ee9380833b5574a95 (diff) | |
| download | emacs-30d4cfc0806ee1de5a8e5091f0cc5bce22830460.tar.gz emacs-30d4cfc0806ee1de5a8e5091f0cc5bce22830460.zip | |
completion--nth-completion: Throw meaningful error
If a configured completion style does not exist, throw a meaningful
error. Also make completion-styles-alist a defvar, since completion
styles like orderless extend it.
* lisp/minibuffer.el (completion-styles-alist): Make it a defvar.
(completion--nth-completion): Give a more meaningful error.
| -rw-r--r-- | lisp/minibuffer.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 1d596694e4a..ab760a42d15 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -900,7 +900,7 @@ If the value is `lazy', the *Completions* buffer is only displayed after | |||
| 900 | the second failed attempt to complete." | 900 | the second failed attempt to complete." |
| 901 | :type '(choice (const nil) (const t) (const lazy))) | 901 | :type '(choice (const nil) (const t) (const lazy))) |
| 902 | 902 | ||
| 903 | (defconst completion-styles-alist | 903 | (defvar completion-styles-alist |
| 904 | '((emacs21 | 904 | '((emacs21 |
| 905 | completion-emacs21-try-completion completion-emacs21-all-completions | 905 | completion-emacs21-try-completion completion-emacs21-all-completions |
| 906 | "Simple prefix-based completion. | 906 | "Simple prefix-based completion. |
| @@ -1076,9 +1076,10 @@ This overrides the defaults specified in `completion-category-defaults'." | |||
| 1076 | (result-and-style | 1076 | (result-and-style |
| 1077 | (completion--some | 1077 | (completion--some |
| 1078 | (lambda (style) | 1078 | (lambda (style) |
| 1079 | (let ((probe (funcall (nth n (assq style | 1079 | (let ((probe (funcall |
| 1080 | completion-styles-alist)) | 1080 | (or (nth n (assq style completion-styles-alist)) |
| 1081 | string table pred point))) | 1081 | (error "Invalid completion style %s" style)) |
| 1082 | string table pred point))) | ||
| 1082 | (and probe (cons probe style)))) | 1083 | (and probe (cons probe style)))) |
| 1083 | (completion--styles md))) | 1084 | (completion--styles md))) |
| 1084 | (adjust-fn (get (cdr result-and-style) 'completion--adjust-metadata))) | 1085 | (adjust-fn (get (cdr result-and-style) 'completion--adjust-metadata))) |