branch: externals/org-contacts
commit 74043e8db1597a0372130b1f7ff7845d9189e185
Author: stardiviner <numbch...@gmail.com>
Commit: stardiviner <numbch...@gmail.com>

    update get target file name buffer logic
---
 org-contacts.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index 13e9626712..ce5bd7f859 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -1435,8 +1435,8 @@ are effectively trimmed.  If nil, all zero-length 
substrings are retained."
                              :complete #'org-contacts-link-complete
                              :store #'org-contacts-link-store
                              :face 'org-contacts-link-face)
-  (if (fboundp 'org-add-link-type)
-      (org-add-link-type "org-contact" 'org-contacts-link-open)))
+  (when (fboundp 'org-add-link-type)
+    (org-add-link-type "org-contact" 'org-contacts-link-open)))
 
 ;;;###autoload
 (defun org-contacts-link-store ()
@@ -1502,9 +1502,9 @@ Each element has the form (NAME . (FILE . POSITION))."
 ;;;###autoload
 (defun org-contacts-link-open (query)
   "Open contacts: link type with jumping or searching."
-  (let* ((f (car (org-contacts-files)))
-         (fname (file-name-nondirectory f))
-         (buf (if (buffer-live-p (get-buffer fname)) (get-buffer fname) 
(find-file f))))
+  (let* ((file-path (car (org-contacts-files)))
+         (file-name (file-name-nondirectory file-path))
+         (buf (or (get-buffer file-name) (get-buffer (find-file-noselect 
file-path)))))
     (cond
      ;; /query/ format searching
      ((string-match "/.*/" query)

Reply via email to