]> git.eshelyaron.com Git - emacs.git/commitdiff
project-recompile: Autoload and run in project root
authorDaniel Mendler <mail@daniel-mendler.de>
Sun, 1 Dec 2024 10:43:48 +0000 (11:43 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 12 Dec 2024 15:47:26 +0000 (16:47 +0100)
* lisp/progmodes/project.el (project-recompile): Autoload and
use project root as `default-directory' (bug#74631).

(cherry picked from commit be51f13491ddb5eb4f281a79fa7e76ef30147cb1)

lisp/progmodes/project.el

index f18c5ed18a07e01e54b40d0062accb7da1c31795..0971a0bb8f5a7c2937e50fcb24c74e1d55e39af0 100644 (file)
@@ -1488,15 +1488,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)))