GNU bug report logs - #41408
Add a project-compile command

Previous Next

Package: emacs;

Reported by: "Philip K." <philip <at> warpmail.net>

Date: Tue, 19 May 2020 18:26:02 UTC

Severity: normal

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Philip K." <philip <at> warpmail.net>
To: 41408 <at> debbugs.gnu.org
Subject: bug#41408: Add a project-compile command
Date: Tue, 19 May 2020 20:24:48 +0200
[Message part 1 (text/plain, inline)]
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.

[0001-Add-project-compile-command.patch (text/x-diff, inline)]
From d4aa98e6b01e95f50dc9c6ec02792d4fce542b22 Mon Sep 17 00:00:00 2001
From: Philip K <philip <at> 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


This bug report was last modified 5 years and 1 day ago.

Previous Next


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