From 8f008e1b7063f8abe122f6b53eef3a389bf82080 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Thu, 18 Nov 2021 15:52:08 +0800 Subject: [PATCH] Fix company-mode doc-buffer support with reverse query contact element in all contacts list. --- org-contacts.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org-contacts.el b/org-contacts.el index 2691351..8d8c48e 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -633,9 +633,13 @@ description." (defun org-contacts-org-complete--doc-function (candidate) "Return org-contacts content of contact candidate." - (let ((name (plist-get candidate :name)) - (file (plist-get candidate :file)) - (position (plist-get candidate :position))) + (let* ((candidate (substring-no-properties candidate 1 nil)) + (contact (seq-find + (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 ;; get org-contact headline and property drawer. (with-current-buffer (find-file-noselect file)