GNU bug report logs -
#74631
30.0.92; [PATCH] autoload project-recompile and set default-directory
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74631 in the body.
You can then email your comments to 74631 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
dmitry <at> gutov.dev, bug-gnu-emacs <at> gnu.org
:
bug#74631
; Package
emacs
.
(Sun, 01 Dec 2024 10:49:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
New bug report received and forwarded. Copy sent to
dmitry <at> gutov.dev, bug-gnu-emacs <at> gnu.org
.
(Sun, 01 Dec 2024 10:49:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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
Reply sent
to
Dmitry Gutov <dmitry <at> gutov.dev>
:
You have taken responsibility.
(Tue, 10 Dec 2024 02:11:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
bug acknowledged by developer.
(Tue, 10 Dec 2024 02:11:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 74631-done <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74631
; Package
emacs
.
(Tue, 10 Dec 2024 07:50:03 GMT)
Full text and
rfc822 format available.
Message #13 received at 74631 <at> debbugs.gnu.org (full text, mbox):
>> 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.
Agreed, this is the right thing to do.
> 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.
Isn't bug#68570 solved by bug#70136?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74631
; Package
emacs
.
(Tue, 10 Dec 2024 15:39:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 74631-done <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> 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.
Thanks for installing the patch! I just saw that the docstring should
probably also updated accordingly. Maybe like this:
"Run `recompile' in the project root with an appropriate buffer."
Daniel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74631
; Package
emacs
.
(Tue, 10 Dec 2024 23:28:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 74631 <at> debbugs.gnu.org (full text, mbox):
On 10/12/2024 09:40, Juri Linkov wrote:
>> 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.
> Isn't bug#68570 solved by bug#70136?
Now that you mention it, the solution proposed in bug#70136 does seem
like the right direction. So we can hope for having it resolved there.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74631
; Package
emacs
.
(Tue, 10 Dec 2024 23:30:03 GMT)
Full text and
rfc822 format available.
Message #22 received at 74631-done <at> debbugs.gnu.org (full text, mbox):
On 10/12/2024 17:38, Daniel Mendler wrote:
> I just saw that the docstring should
> probably also updated accordingly. Maybe like this:
>
> "Run `recompile' in the project root with an appropriate buffer."
Thank you, pushed now too.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74631
; Package
emacs
.
(Wed, 18 Dec 2024 17:19:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 74631 <at> debbugs.gnu.org (full text, mbox):
>>> 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.
>> Isn't bug#68570 solved by bug#70136?
>
> Now that you mention it, the solution proposed in bug#70136 does seem like
> the right direction. So we can hope for having it resolved there.
Indeed, bug#70136 solves many problems. Using dir-local variables
in non-file buffers will for example fix such cases that when
need to add the "-a" switch to ripgrep to find files that
accidentally contain a null byte, then I see no other way
than to do this on per-project basis by adding to .dir-locals.el:
((nil . ((xref-search-program-alist
. ((ripgrep . "xargs -0 rg <C> -a --null -nH -e <R>"))))))
But currently it has no effect.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 16 Jan 2025 12:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 148 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.