Function: projectile--embark-setup

projectile--embark-setup is a byte-compiled function defined in projectile.el.

Signature

(projectile--embark-setup)

Documentation

Wire Projectile's transformer and action keymap into Embark.

Run from a with-eval-after-load on Embark, and idempotent so loading Projectile again doesn't stack wrappers.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--embark-setup ()
  "Wire Projectile's transformer and action keymap into Embark.
Run from a `with-eval-after-load' on Embark, and idempotent so loading
Projectile again doesn't stack wrappers."
  ;; inherit Embark's generic actions (collect, export, ...)
  (set-keymap-parent projectile-embark-project-map embark-general-map)
  ;; Augment - never replace - Embark's `project-file' handling.  Our
  ;; transformer only claims a candidate that actually lives under the
  ;; Projectile root; anything else defers to whatever transformer Embark
  ;; already had, so non-Projectile `project-file' completions are unaffected.
  ;; The `eq' guard keeps re-loading Projectile from wrapping our own wrapper.
  (let ((prev (alist-get 'project-file embark-transformer-alist)))
    (unless (eq prev #'projectile--embark-project-file-transform)
      (setq projectile--embark-project-file-prev-transform prev)
      (setf (alist-get 'project-file embark-transformer-alist)
            #'projectile--embark-project-file-transform)))
  (add-to-list 'embark-keymap-alist
               '(projectile-project . projectile-embark-project-map))
  ;; A worktree candidate is a project directory too, so the same actions
  ;; apply to it.
  (add-to-list 'embark-keymap-alist
               '(projectile-worktree . projectile-embark-project-map)))