From dda390450e634fa7581c384486267c95d85954bb Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 10 Jul 2024 09:50:38 -0500 Subject: [PATCH] adding justl --- README.org | 26 +++++++++++++++++++++++++- init.el | 23 ++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index d4f21afd..35c59947 100644 --- a/README.org +++ b/README.org @@ -3691,6 +3691,9 @@ Let's make sure docker is capable of using tramp. Still need dockerfile-mode in order to be able to edit dockerfiles. *** Just +:PROPERTIES: +:ID: 20240705T095129.209161 +:END: Let's use just-mode #+begin_src emacs-lisp (use-package just-mode @@ -3698,7 +3701,28 @@ Let's use just-mode #+end_src #+begin_src emacs-lisp -(use-package justl) +(use-package justl + :config + (defun chris/justl-exec-recipe () + "Execute a recipe in the justfile from the minibuffer" + (interactive) + (let* ((justfile (justl--find-justfile (project-root (eglot--current-project)))) + (recipes (cl-loop for recipe in (justl--get-recipes justfile) + collect (cdr (assoc 'name recipe)))) + (recipe (completing-read "Which recipe to run: " recipes))) + (if (get-buffer "*just*") + (justl--exec "just1" recipe `(,recipe)) + (justl--exec justl-executable recipe `(,recipe))) + (message "%s" recipe))) + :general + (general-def 'normal justl-mode-map + "e" 'justl-exec-recipe + "E" 'justl-exec-eshell + "" 'justl-exec-recipe) + (chris/leader-keys + :states 'normal + :keymaps 'rustic-mode-map + "gj" 'chris/justl-exec-recipe)) #+end_src *** Fish diff --git a/init.el b/init.el index f2ea9af4..2e8aa59f 100644 --- a/init.el +++ b/init.el @@ -2708,7 +2708,28 @@ targets." (use-package just-mode :mode ("\\.just\\'" . just-mode)) -(use-package justl) +(use-package justl + :config + (defun chris/justl-exec-recipe () + "Execute a recipe in the justfile from the minibuffer" + (interactive) + (let* ((justfile (justl--find-justfile (project-root (eglot--current-project)))) + (recipes (cl-loop for recipe in (justl--get-recipes justfile) + collect (cdr (assoc 'name recipe)))) + (recipe (completing-read "Which recipe to run: " recipes))) + (if (get-buffer "*just*") + (justl--exec "just1" recipe `(,recipe)) + (justl--exec justl-executable recipe `(,recipe))) + (message "%s" recipe))) + :general + (general-def 'normal justl-mode-map + "e" 'justl-exec-recipe + "E" 'justl-exec-eshell + "" 'justl-exec-recipe) + (chris/leader-keys + :states 'normal + :keymaps 'rustic-mode-map + "gj" 'chris/justl-exec-recipe)) (use-package fish-mode :mode ("\\.fish\\'" . fish-mode))