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)