all of the functions return non-nil."
:type 'hook)
-(defvar completion-preview-predicate #'always
- "Completion predicate to use for completion preview.")
+(defvar completion-preview-default-predicate #'always
+ "Completion predicate to use for completion preview by default.
+
+If a member of `completion-at-point-functions' returns a non-nil
+`:predicate' completion property, then that predicate overrides
+the default value that you specify in this option.")
(defvar completion-preview-sort-function #'completion-preview--sort-by-length-alpha
"Sort function to use for choosing a completion candidate to preview.")
#'completion--capf-wrapper 'all)))
(pcase res
(`(,_ ,beg ,end ,table . ,plist)
- (let* ((string (buffer-substring beg end))
- (md (completion-metadata string table completion-preview-predicate))
+ (let* ((pred (or (plist-get plist :predicate)
+ completion-preview-default-predicate))
+ (string (buffer-substring beg end))
+ (md (completion-metadata string table pred))
(sort-fn (or (completion-metadata-get md 'cycle-sort-function)
(completion-metadata-get md 'display-sort-function)
completion-preview-sort-function))
- (all (completion-all-completions string table
- (or (plist-get plist :predicate)
- completion-preview-predicate)
+ (all (completion-all-completions string table pred
(- (point) beg) md))
(last (last all))
(base (or (cdr last) 0))