Function: projectile--resolve-backend
projectile--resolve-backend is a byte-compiled function defined in
projectile.el.
Signature
(projectile--resolve-backend BACKENDS PREFERENCE FAMILY)
Documentation
Return a usable backend from BACKENDS, honouring PREFERENCE.
BACKENDS is an alist of (NAME . PLIST). PREFERENCE is a backend name, or
auto to pick the first available backend, or prompt to ask. FAMILY
is a noun used in prompts and errors, e.g. "search". Signals a
user-error when no suitable backend is available.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--resolve-backend (backends preference family)
"Return a usable backend from BACKENDS, honouring PREFERENCE.
BACKENDS is an alist of (NAME . PLIST). PREFERENCE is a backend name, or
`auto' to pick the first available backend, or `prompt' to ask. FAMILY
is a noun used in prompts and errors, e.g. \"search\". Signals a
`user-error' when no suitable backend is available."
(let ((available (seq-filter #'projectile--backend-available-p backends)))
(cond
((null available)
(user-error "No %s backend is available" family))
((eq preference 'auto)
(car available))
((eq preference 'prompt)
(assq (intern (completing-read
(format "%s backend: " (capitalize family))
(mapcar (lambda (b) (symbol-name (car b))) available)
nil t))
backends))
(t
(let ((backend (assq preference backends)))
(cond
((null backend)
(user-error "Unknown %s backend: %s" family preference))
((projectile--backend-available-p backend)
backend)
(t
(user-error "The %s backend `%s' is not available" family preference))))))))