Function: embark--targets
embark--targets is a byte-compiled function defined in embark.el.
Signature
(embark--targets)
Documentation
Retrieve current targets.
An initial guess at the current targets and their types is
determined by running the functions in embark-target-finders.
Each function should either return nil, a pair of a type symbol
and target string or a triple of a type symbol, target string and
target bounds.
In the minibuffer only the first target finder returning non-nil is taken into account. When finding targets at point in other buffers, all target finder functions are executed.
For each target, the type is then looked up as a key in the
variable embark-transformer-alist. If there is a transformer
for the type, it is called with the type and target, and must
return a cons of the transformed type and transformed target.
The return value of embark--targets is a list of plists. Each
plist concerns one target, and has keys :type, :target,
:orig-type, :orig-target and :bounds.
Source Code
;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark--targets ()
"Retrieve current targets.
An initial guess at the current targets and their types is
determined by running the functions in `embark-target-finders'.
Each function should either return nil, a pair of a type symbol
and target string or a triple of a type symbol, target string and
target bounds.
In the minibuffer only the first target finder returning non-nil
is taken into account. When finding targets at point in other
buffers, all target finder functions are executed.
For each target, the type is then looked up as a key in the
variable `embark-transformer-alist'. If there is a transformer
for the type, it is called with the type and target, and must
return a `cons' of the transformed type and transformed target.
The return value of `embark--targets' is a list of plists. Each
plist concerns one target, and has keys `:type', `:target',
`:orig-type', `:orig-target' and `:bounds'."
(let (targets)
(run-hook-wrapped
'embark-target-finders
(lambda (fun)
(dolist (found (when-let* ((result (funcall fun)))
(if (consp (car result)) result (list result))))
(let* ((type (or (car found) 'general))
(target+bounds (cdr found))
(target (if (consp target+bounds)
(car target+bounds)
target+bounds))
(bounds (and (consp target+bounds) (cdr target+bounds)))
(full-target
(append
(list :orig-type type :orig-target target :bounds bounds)
(if-let* ((transform (alist-get type embark-transformer-alist)))
(let ((trans (funcall transform type target)))
(list :type (car trans) :target (cdr trans)))
(list :type type :target target)))))
(push full-target targets)))
(and targets (minibufferp))))
(nreverse
(cl-delete-duplicates ; keeps last duplicate, but we reverse
targets
:test (lambda (t1 t2)
(and (equal (plist-get t1 :target) (plist-get t2 :target))
(eq (plist-get t1 :type) (plist-get t2 :type))))))))