]> git.eshelyaron.com Git - emacs.git/commitdiff
project-recompile: New command
authorDmitry Gutov <dmitry@gutov.dev>
Sun, 21 Jan 2024 05:08:11 +0000 (07:08 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 21 Jan 2024 07:32:07 +0000 (08:32 +0100)
* lisp/progmodes/project.el (project-recompile):
New command (bug#68570).

(cherry picked from commit 0a07603ae8db41f69e83b1bfec6e28a92f737852)

lisp/progmodes/project.el

index 7fbf04d98c199e567e1d4d1ab7a06d48016d6746..325e207b70d4924e90359920bfca005a7c637a59 100644 (file)
@@ -1358,6 +1358,7 @@ If you exit the `query-replace', you can later continue the
 
 (defvar compilation-read-command)
 (declare-function compilation-read-command "compile")
+(declare-function recompile "compile")
 
 (defun project-prefixed-buffer-name (mode)
   (concat "*"
@@ -1391,6 +1392,18 @@ If non-nil, it overrides `compilation-buffer-name-function' for
              compilation-buffer-name-function)))
     (call-interactively #'compile)))
 
+(defun project-recompile (&optional edit-command)
+  "Run `recompile' with appropriate buffer."
+  (declare (interactive-only recompile))
+  (interactive "P")
+  (let ((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)))
+
 (defcustom project-ignore-buffer-conditions nil
   "List of conditions to filter the buffers to be switched to.
 If any of these conditions are satisfied for a buffer in the