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.
(defconst completion--styles-type
`(repeat :tag "insert a new menu to add more styles"
(choice ,@(mapcar (lambda (x) (list 'const (car x)))
- completion-styles-alist))))
+ completion-styles-alist)
+ (symbol :tag "Other"
+ :validate
+ ,(lambda (widget)
+ (let ((value (widget-value widget)))
+ (if (assq value completion-styles-alist)
+ nil ; Valid.
+ (widget-put
+ widget :error
+ (format "Invalid completion style: %S"
+ value))
+ widget)))))))
+
(defconst completion--cycling-threshold-type
'(choice (const :tag "No cycling" nil)
(const :tag "Always cycle" t)