From 043282c55a874232e84ebb6397f09259615dc5f8 Mon Sep 17 00:00:00 2001
From: Daanturo <daanturo@gmail.com>
Date: Sat, 15 Mar 2025 12:46:45 +0000
Subject: [PATCH] org-cite-basic--complete-key: use completing-read-multiple

---
 lisp/oc-basic.el | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 32a99e987..1721d42a1 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -895,24 +895,16 @@ Raise an error when no bibliography is set in the buffer."
   (let* ((table
           (or (org-cite-basic--key-completion-table)
               (user-error "No bibliography set")))
-         (prompt
-          (lambda (text)
-            (completing-read text table nil t))))
+         (choice-to-citation
+          (lambda (choice)
+            (let ((key (gethash choice table)))
+              (org-string-nw-p key)))))
     (if (null multiple)
-        (let ((key (gethash (funcall prompt "Key: ") table)))
-          (org-string-nw-p key))
-      (let* ((keys nil)
-             (build-prompt
-              (lambda ()
-                (if keys
-                    (format "Key (empty input exits) %s: "
-                            (mapconcat #'identity (reverse keys) ";"))
-                  "Key (empty input exits): "))))
-        (let ((key (funcall prompt (funcall build-prompt))))
-          (while (org-string-nw-p key)
-            (push (gethash key table) keys)
-            (setq key (funcall prompt (funcall build-prompt)))))
-        keys))))
+        (funcall choice-to-citation
+                 (completing-read "Key: " table nil t))
+      (mapcar
+       choice-to-citation
+       (completing-read-multiple "Keys: " table nil t)))))
 
 
 ;;; Register processor
-- 
2.48.1

