From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 74631@debbugs.gnu.org
Cc: Dmitry Gutov <dmitry@gutov.dev>
Subject: bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory
Date: Sun, 01 Dec 2024 11:46:30 +0100 [thread overview]
Message-ID: <87zflffzp5.fsf@daniel-mendler.de> (raw)
[-- 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
next reply other threads:[~2024-12-01 10:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 10:46 Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-10 2:10 ` bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zflffzp5.fsf@daniel-mendler.de \
--to=bug-gnu-emacs@gnu.org \
--cc=74631@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=mail@daniel-mendler.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.