51 lines
1.9 KiB
EmacsLisp
Executable File
51 lines
1.9 KiB
EmacsLisp
Executable File
;;; syd-projects.el -*- lexical-binding: t; -*-
|
|
|
|
(require 'syd-constants)
|
|
|
|
(with-eval-after-load 'project ; Built-in
|
|
;; Stay out of my config directory!
|
|
(setq project-list-file (file-name-concat syd-cache-dir "known-projects"))
|
|
;; For each command in `project-switch-commands' will assign it the key found
|
|
;; in `project-prefix-map'. We emulate that behaviour but for our own
|
|
;; `syd-leader-project-map'.
|
|
(let* ((project-key
|
|
(lambda (f)
|
|
(key-description
|
|
(where-is-internal
|
|
f
|
|
;; If the keymap is not wrapped in a list,
|
|
;; `where-is-internal' will also search the
|
|
;; global ;; keymaps
|
|
(list syd-leader-project-map)
|
|
;; First result only.
|
|
t))))
|
|
(switch-cmd (lambda (command name &optional key)
|
|
(append (list command name)
|
|
(list (or key (funcall project-key command)))))))
|
|
(add-to-list 'project-switch-commands
|
|
(funcall switch-cmd #'project-root-find-file "Browse"))))
|
|
|
|
;; Projection provides a Projectile-like project management library atop
|
|
;; Emacs built-in project.el. It's more lightweight, while still featureful.
|
|
(use-package projection
|
|
;; Enable the `projection-hook' feature.
|
|
:hook (after-init . global-projection-hook-mode)
|
|
;; Require projections immediately after project.el.
|
|
:config
|
|
(with-eval-after-load 'project
|
|
(require 'projection)))
|
|
|
|
;; Allow interactively selecting available compilation targets from the
|
|
;; current project type.
|
|
(use-package projection-multi
|
|
:after projection)
|
|
|
|
;; Embark integration for projection-multi.
|
|
(use-package projection-multi-embark
|
|
:after (embark projection-multi)
|
|
;; Add the projection set-command bindings to
|
|
;; `compile-multi-embark-command-map'.
|
|
:config (projection-multi-embark-setup-command-map))
|
|
|
|
(provide 'syd-projects)
|