; (completion-preview--try-table): Propagate extra properties.
* lisp/completion-preview.el (completion-preview--try-table): Let-bind 'completion-extra-properties' to completion properties that the completion backend (capf) provides, so that these properties take effect when querying the completion table. * test/lisp/completion-preview-tests.el (completion-preview-propagates-properties): Add test.
This commit is contained in:
parent
828e08a996
commit
365a91622e
2 changed files with 14 additions and 0 deletions
|
@ -293,6 +293,7 @@ candidates or if there are multiple matching completions and
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(let* ((pred (plist-get props :predicate))
|
||||
(string (buffer-substring beg end))
|
||||
(completion-extra-properties props)
|
||||
(md (completion-metadata string table pred))
|
||||
(sort-fn (or (completion-metadata-get md 'cycle-sort-function)
|
||||
(completion-metadata-get md 'display-sort-function)
|
||||
|
|
|
@ -306,4 +306,17 @@ instead."
|
|||
(should exit-fn-called)
|
||||
(should (equal exit-fn-args '("foobar" finished))))))
|
||||
|
||||
(ert-deftest completion-preview-propagates-properties ()
|
||||
"Test the completion metadata handling of Completion Preview mode."
|
||||
(with-temp-buffer
|
||||
(setq-local
|
||||
completion-preview-sort-function #'minibuffer-sort-alphabetically
|
||||
completion-at-point-functions
|
||||
(list (completion-preview-tests--capf '("foobaz" "foobar")
|
||||
:display-sort-function #'identity)))
|
||||
(insert "foo")
|
||||
(let ((this-command 'self-insert-command))
|
||||
(completion-preview--post-command))
|
||||
(completion-preview-tests--check-preview "baz" 'completion-preview-common)))
|
||||
|
||||
;;; completion-preview-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue