aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-10-26 10:51:51 +0200
committerMattias EngdegÄrd2022-10-26 10:51:51 +0200
commite54c3959827eeee3ea60ccaa4918d22b9dce9cc5 (patch)
tree129b3a30df477be897f7f9f91c9189774c783699
parent0367208e6e9cb7621eb5faa3c44b94948207c5c7 (diff)
downloademacs-e54c3959827eeee3ea60ccaa4918d22b9dce9cc5.tar.gz
emacs-e54c3959827eeee3ea60ccaa4918d22b9dce9cc5.zip
Dynamic validation of styles in completion-category-overrides
The type of the defcustom completion-category-overrides must be able to accommodate dynamic changes to completion-styles-alist, because some packages (eglot) make their own additions. This change fixes a failure in test-custom-opts. See discussion at: https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01969.html * lisp/minibuffer.el (completion--styles-type): Add an "Other" case that accepts any symbol which is then validated dynamically against completion-styles-alist.
-rw-r--r--lisp/minibuffer.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a9f72d600de..fd878e077a1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -975,7 +975,19 @@ and DOC describes the way this style of completion works.")
975(defconst completion--styles-type 975(defconst completion--styles-type
976 `(repeat :tag "insert a new menu to add more styles" 976 `(repeat :tag "insert a new menu to add more styles"
977 (choice ,@(mapcar (lambda (x) (list 'const (car x))) 977 (choice ,@(mapcar (lambda (x) (list 'const (car x)))
978 completion-styles-alist)))) 978 completion-styles-alist)
979 (symbol :tag "Other"
980 :validate
981 ,(lambda (widget)
982 (let ((value (widget-value widget)))
983 (if (assq value completion-styles-alist)
984 nil ; Valid.
985 (widget-put
986 widget :error
987 (format "Invalid completion style: %S"
988 value))
989 widget)))))))
990
979(defconst completion--cycling-threshold-type 991(defconst completion--cycling-threshold-type
980 '(choice (const :tag "No cycling" nil) 992 '(choice (const :tag "No cycling" nil)
981 (const :tag "Always cycle" t) 993 (const :tag "Always cycle" t)