Files
sydnix/users/crumb/programs/emacs/modules/syd-projects.el
2025-02-19 18:05:59 -07:00

57 lines
2.1 KiB
EmacsLisp
Executable File

;;; syd-projects.el -*- lexical-binding: t; -*-
(require 'syd-constants)
(use-package project
:custom ((project-list-file (file-name-concat syd-cache-dir
"known-projects"))))
;; 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))
(use-package skeletor
:commands (skeletor-create-project-at skeletor-create-project)
:custom ((skeletor-project-directory (expand-file-name "~/src"))
(skeletor-completing-read-function #'completing-read))
:general (:keymaps 'syd-leader-project-map
"n" #'skeletor-create-project
"N" #'skeletor-create-project-at)
:config
(skeletor-define-template "clj-nix"
:substitutions
'(("__PROJECT-OWNER__" . (lambda ()
(read-no-blanks-input "Project owner: "))))
:before-git
(lambda (dir)
;; Use underscores instead of hyphens in clj file names.
(let ((default-directory (file-name-concat dir "src")))
(dolist (f (directory-files "." nil "-" t))
(rename-file
f
(string-replace "-" "_" f))))
;; REVIEW: Is it safe to make this be async? We require that the command
;; has finished before Git initialises.
(skeletor-shell-command "nix run github:jlesquembre/clj-nix#deps-lock"
dir))))
(provide 'syd-projects)