From be51f13491ddb5eb4f281a79fa7e76ef30147cb1 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 1 Dec 2024 11:43:48 +0100 Subject: [PATCH] project-recompile: Autoload and run in project root * lisp/progmodes/project.el (project-recompile): Autoload and use project root as `default-directory' (bug#74631). --- lisp/progmodes/project.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ed6be453274..d4a1832b234 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1486,15 +1486,14 @@ If non-nil, it overrides `compilation-buffer-name-function' for compilation-buffer-name-function))) (call-interactively #'compile))) +;;;###autoload (defun project-recompile (&optional edit-command) "Run `recompile' with appropriate buffer." (declare (interactive-only recompile)) (interactive "P") - (let ((compilation-buffer-name-function + (let ((default-directory (project-root (project-current t))) + (compilation-buffer-name-function (or project-compilation-buffer-name-function - ;; Should we error instead? When there's no - ;; project-specific naming, there is no point in using - ;; this command. compilation-buffer-name-function))) (recompile edit-command)))