From c6c7468eb9be7f98084b76958e2781a6e1e7407d Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Wed, 31 Jul 2024 23:50:59 -0800 Subject: [PATCH] Add my/project-compile-or-default --- init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/init.el b/init.el index 0c2032c..28fb9dc 100644 --- a/init.el +++ b/init.el @@ -706,6 +706,7 @@ to `posframe-show' if the display is graphical." ;; project.el (use-package project :bind (("C-c v" . my/project-eshell-or-default) + ([remap project-compile] . my/project-compile-or-default) :map project-prefix-map ("s" . my/project-eshell) ("u" . my/project-run)) @@ -724,6 +725,12 @@ to `posframe-show' if the display is graphical." (interactive "P") (unless (my/project-eshell nil arg) (eshell arg))) + (defun my/project-compile-or-default () + "If in a project, run `project-compile', otherwise run `compile'." + (interactive) + (if (project-current) + (call-interactively 'project-compile) + (call-interactively 'compile))) (defvar my/project-run-command nil "Command to run with `my/project-run'.") (put 'my/project-run-command 'safe-local-variable (lambda (val)