* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
@ 2024-12-01 10:46 Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 2:10 ` Dmitry Gutov
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-01 10:46 UTC (permalink / raw)
To: 74631; +Cc: Dmitry Gutov
[-- Attachment #1: Type: text/plain, Size: 861 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-project-recompile-Autoload-and-run-in-project-root.patch --]
[-- Type: text/x-diff, Size: 1355 bytes --]
From a330baaaf7a50f3bdf665b32efadb27283453f7f Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
2024-12-01 10:46 bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-10 2:10 ` Dmitry Gutov
2024-12-10 7:40 ` Juri Linkov
2024-12-10 15:38 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Gutov @ 2024-12-10 2:10 UTC (permalink / raw)
To: Daniel Mendler, 74631-done, Juri Linkov
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
2024-12-10 2:10 ` Dmitry Gutov
@ 2024-12-10 7:40 ` Juri Linkov
2024-12-10 23:27 ` Dmitry Gutov
2024-12-10 15:38 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2024-12-10 7:40 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Daniel Mendler, 74631
>> 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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
2024-12-10 2:10 ` Dmitry Gutov
2024-12-10 7:40 ` Juri Linkov
@ 2024-12-10 15:38 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 23:29 ` Dmitry Gutov
1 sibling, 1 reply; 7+ messages in thread
From: Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-10 15:38 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 74631-done, Juri Linkov
Dmitry Gutov <dmitry@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
2024-12-10 7:40 ` Juri Linkov
@ 2024-12-10 23:27 ` Dmitry Gutov
2024-12-18 17:12 ` Juri Linkov
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2024-12-10 23:27 UTC (permalink / raw)
To: Juri Linkov; +Cc: Daniel Mendler, 74631
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
2024-12-10 15:38 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-10 23:29 ` Dmitry Gutov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2024-12-10 23:29 UTC (permalink / raw)
To: Daniel Mendler; +Cc: 74631-done, Juri Linkov
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
2024-12-10 23:27 ` Dmitry Gutov
@ 2024-12-18 17:12 ` Juri Linkov
0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2024-12-18 17:12 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 74631
>>> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-18 17:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-01 10:46 bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 2:10 ` Dmitry Gutov
2024-12-10 7:40 ` Juri Linkov
2024-12-10 23:27 ` Dmitry Gutov
2024-12-18 17:12 ` Juri Linkov
2024-12-10 15:38 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 23:29 ` Dmitry Gutov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).