(cons 'metadata
(cons (cons 'adjust-base-function
(lambda (base)
- (funcall (or (alist-get 'adjust-base-function md)
- #'identity)
- (substring base beg))))
+ ;; When TABLE is nil and point is after
+ ;; separator, we may get empty `base' from
+ ;; `completion-all-sorted-completions',
+ ;; because `completion-all-completions'
+ ;; returns nil with no base length.
+ (if (string-empty-p base) base
+ (funcall (or (alist-get 'adjust-base-function md)
+ #'identity)
+ (substring base beg)))))
(cdr-safe md)))))
('nil (let ((comp (complete-with-action a table (substring s beg) p)))
(if (stringp comp) (concat (substring s 0 beg) comp) comp)))