Add my/project-compile-or-default

This commit is contained in:
Alexander Rosenberg 2024-07-31 23:50:59 -08:00
parent 1580c691e4
commit c6c7468eb9
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -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)