From: "Philip K." <philip@warpmail.net>
To: 41408@debbugs.gnu.org
Subject: bug#41408: Add a project-compile command
Date: Tue, 19 May 2020 20:24:48 +0200 [thread overview]
Message-ID: <87blmjbx5b.fsf@warpmail.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
Hi,
this patch adds a `compile' command for project.el. It's nothing fancy,
just sets the first directory of `project-roots' as `default-directory',
and then calls the regular compile.
The TODOs mention a `project-build' command, and from my interpretation,
this is a slimmed down version (hence the other name, but also because
it just called compile in a different environment).
--
Philip K.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-project-compile-command.patch --]
[-- Type: text/x-diff, Size: 1213 bytes --]
From d4aa98e6b01e95f50dc9c6ec02792d4fce542b22 Mon Sep 17 00:00:00 2001
From: Philip K <philip@warpmail.net>
Date: Tue, 19 May 2020 19:30:14 +0200
Subject: [PATCH] Add project-compile command
---
lisp/progmodes/project.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 44259990bb..15b5899140 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -590,6 +590,18 @@ project-read-file-name-function
(function :tag "Custom function" nil))
:version "27.1")
+;;;###autoload
+(defun project-compile ()
+ "Run `compile' in the project root."
+ (interactive)
+ (let* ((pr (project-current t))
+ (roots (project-roots pr))
+ ;; TODO: be more intelligent when choosing a directory. This
+ ;; currently isn't a priority, since no `project-roots'
+ ;; implementation returns more that one directory.
+ (default-directory (car roots)))
+ (call-interactively 'compile)))
+
(defun project--read-file-cpd-relative (prompt
all-files &optional predicate
hist default)
--
2.20.1
next reply other threads:[~2020-05-19 18:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 18:24 Philip K. [this message]
2020-05-19 19:59 ` bug#41408: Add a project-compile command Dmitry Gutov
2020-05-19 20:07 ` Philip K.
2020-05-19 21:55 ` Dmitry Gutov
2020-05-19 22:17 ` Kévin Le Gouguec
2020-05-19 23:02 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87blmjbx5b.fsf@warpmail.net \
--to=philip@warpmail.net \
--cc=41408@debbugs.gnu.org \
/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 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).