This email may be sent multiple times;
I attempted to send it from a different address,
but it appears that it did not go through.

Context: I have 2 files in org-contacts-files

- What happened: When inserting a contact link via =org-insert-link=,
  completion lists contact entries only from the first file in
  =org-contacts-files=.
- Why I think it happens: the function =org-contacts--all-contacts=
  appears to return contacts only from the first file and explicitly
  ignores the contacts from other files. (E.g. It was using =car=)
- Expected behavior: =org-contacts--all-contacts= (and therefore
  =org-insert-link= completion) should include contact entries from all
  files listed in 'org-contacts-files', not just the first one.
- My solution is:
  - from =(car (mapcar ... (org-contacts-files)))=
  - to   =(mapcan ...     (org-contacts-files))=
    in the the function definition of =org-contacts--all-contacts=.

Best regards
From a4d88b11a83d2d63f985cdb95baf838e564e084b Mon Sep 17 00:00:00 2001
From: garid_on_x13 <[email protected]>
Date: Thu, 19 Feb 2026 22:07:21 +0900
Subject: [PATCH 1/2] Fix org-contacts--all-contacts to return contacts from
 all configured files, not just the first org-contacts-files entry.

---
 org-contacts.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index 31f0ccc..1385390 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -1616,7 +1616,7 @@ are effectively trimmed.  If nil, all zero-length substrings are retained."
 (defun org-contacts--all-contacts ()
   "Return a list of all contacts in `org-contacts-files'.
 Each element has the form (NAME . (FILE . POSITION))."
-  (car (mapcar
+  (mapcan
         (lambda (file)
           (unless (buffer-live-p (get-buffer (file-name-nondirectory file)))
             (find-file-noselect file))
@@ -1643,7 +1643,7 @@ Each element has the form (NAME . (FILE . POSITION))."
                        :mobile property-email
                        :wechat property-wechat
                        :qq property-qq))))))
-        (org-contacts-files))))
+        (org-contacts-files)))
 
 ;;;###autoload
 (defun org-contacts-link-open (query)
-- 
2.51.2

Reply via email to