Skip to content

Commit

Permalink
Add citar-select-multiple option
Browse files Browse the repository at this point in the history
When nil, all citar commands will use `completing-read` instead of
`completing-read-multiple`.

Closes #492
  • Loading branch information
roshanshariff authored and bdarcus committed Dec 17, 2021
1 parent 5d0a2f9 commit ce5219c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion citar.el
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ of all citations in the current buffer."

;;; Completion functions

(defcustom citar-select-multiple t
"Use `completing-read-multiple' for selecting citation keys.
When nil, all citar commands will use `completing-read`."
:type 'boolean
:group 'citar)

(defun citar--completion-table (candidates &optional filter)
"Return a completion table for CANDIDATES.
Expand Down Expand Up @@ -378,7 +384,7 @@ FILTER: if non-nil, should be a predicate function taking
(completions (citar--completion-table candidates filter))
(embark-transformer-alist (citar--embark-transformer-alist candidates))
(crm-separator "\\s-*&\\s-*")
(chosen (if multiple
(chosen (if (and multiple citar-select-multiple)
(completing-read-multiple "References: " completions nil nil nil
'citar-history citar-presets nil)
(completing-read "Reference: " completions nil nil nil
Expand Down

0 comments on commit ce5219c

Please sign in to comment.