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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: "Philip K." <philip <at> warpmail.net>
Subject: bug#41408: closed (Re: bug#41408: Add a project-compile command)
Date: Tue, 19 May 2020 23:03:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#41408: Add a project-compile command

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 41408 <at> debbugs.gnu.org.

-- 
41408: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41408
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Dmitry Gutov <dgutov <at> yandex.ru>
To: "Philip K." <philip <at> warpmail.net>, 41408-done <at> debbugs.gnu.org
Subject: Re: bug#41408: Add a project-compile command
Date: Wed, 20 May 2020 02:02:04 +0300
On 19.05.2020 21:24, Philip K. wrote:
> this patch adds a `compile' command for project.el

I've applied the patch, but moved the new command to the end.

Thanks!

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