GNU bug report logs - #74631
30.0.92; [PATCH] autoload project-recompile and set default-directory

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sun, 1 Dec 2024 10:49:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.92

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Daniel Mendler <mail <at> daniel-mendler.de>
Subject: bug#74631: closed (Re: bug#74631: 30.0.92; [PATCH] autoload
 project-recompile and set default-directory)
Date: Tue, 10 Dec 2024 02:11:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 74631 <at> debbugs.gnu.org.

-- 
74631: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74631
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Daniel Mendler <mail <at> daniel-mendler.de>, 74631-done <at> debbugs.gnu.org,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#74631: 30.0.92; [PATCH] autoload project-recompile and set
 default-directory
Date: Tue, 10 Dec 2024 04:10:08 +0200
Hi Daniel,

On 01/12/2024 12:46, Daniel Mendler wrote:
> In order to make `project-recompile' symmetric to `recompile' it should
> be autoloaded and it should run in the project root. This makes it
> possible to call `project-recompile' directly without calling `compile'
> first.
> 
>      ;;;###autoload
>      (defun project-recompile (&optional edit-command)
>        "Run `recompile' with appropriate buffer."
>        (declare (interactive-only recompile))
>        (interactive "P")
>        (let ((default-directory (project-root (project-current t)))
>              (compilation-buffer-name-function
>               (or project-compilation-buffer-name-function
>                   compilation-buffer-name-function)))
>          (recompile edit-command)))
> 
> This change also resolves the comment in project-recompile:
> 
>      ;; Should we error instead?  When there's no
>      ;; project-specific naming, there is no point in using
>      ;; this command.

Thanks, I've pushed this to master.

The comment is related to the previous thread (bug#68570), and it's 
still unresolved, but IIUC this doesn't make things worse, at least.

Cc'ing Juri just in case.

[Message part 3 (message/rfc822, inline)]
From: Daniel Mendler <mail <at> daniel-mendler.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.92; [PATCH] autoload project-recompile and set default-directory
Date: Sun, 01 Dec 2024 11:46:30 +0100
[Message part 4 (text/plain, inline)]
In order to make `project-recompile' symmetric to `recompile' it should
be autoloaded and it should run in the project root. This makes it
possible to call `project-recompile' directly without calling `compile'
first.

    ;;;###autoload
    (defun project-recompile (&optional edit-command)
      "Run `recompile' with appropriate buffer."
      (declare (interactive-only recompile))
      (interactive "P")
      (let ((default-directory (project-root (project-current t)))
            (compilation-buffer-name-function
             (or project-compilation-buffer-name-function
                 compilation-buffer-name-function)))
        (recompile edit-command)))

This change also resolves the comment in project-recompile:

    ;; Should we error instead?  When there's no
    ;; project-specific naming, there is no point in using
    ;; this command.

[0001-project-recompile-Autoload-and-run-in-project-root.patch (text/x-diff, inline)]
From a330baaaf7a50f3bdf665b32efadb27283453f7f Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail <at> daniel-mendler.de>
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'.
---
 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 ba5a6b6f056..d47b732712f 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1455,15 +1455,14 @@ project-compile
              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)))
 
-- 
2.45.2


This bug report was last modified 149 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.