Fix company-mode doc-buffer support with reverse query contact element in all contacts list.

This commit is contained in:
stardiviner 2021-11-18 15:52:08 +08:00
parent 3ea7298670
commit 8f008e1b70

View file

@ -633,9 +633,13 @@ description."
(defun org-contacts-org-complete--doc-function (candidate) (defun org-contacts-org-complete--doc-function (candidate)
"Return org-contacts content of contact candidate." "Return org-contacts content of contact candidate."
(let ((name (plist-get candidate :name)) (let* ((candidate (substring-no-properties candidate 1 nil))
(file (plist-get candidate :file)) (contact (seq-find
(position (plist-get candidate :position))) (lambda (contact) (string-equal (plist-get contact :name) candidate))
(org-contacts--all-contacts)))
(name (plist-get contact :name))
(file (plist-get contact :file))
(position (plist-get contact :position)))
(company-doc-buffer (company-doc-buffer
;; get org-contact headline and property drawer. ;; get org-contact headline and property drawer.
(with-current-buffer (find-file-noselect file) (with-current-buffer (find-file-noselect file)