follow the calling convention of `completion-all-completions'),
and DOC describes the way this style of completion works.")
+(defun completion--update-styles-options (widget)
+ "Function to keep updated the options in `completion-category-overrides'."
+ (let ((lst (mapcar (lambda (x)
+ (list 'const (car x)))
+ completion-styles-alist)))
+ (widget-put widget :args (mapcar #'widget-convert lst))
+ widget))
+
(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)
- (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)))))))
+ (choice :convert-widget completion--update-styles-options)))
(defconst completion--cycling-threshold-type
'(choice (const :tag "No cycling" nil)