unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41408: Add a project-compile command
@ 2020-05-19 18:24 Philip K.
  2020-05-19 19:59 ` Dmitry Gutov
  2020-05-19 23:02 ` Dmitry Gutov
  0 siblings, 2 replies; 6+ messages in thread
From: Philip K. @ 2020-05-19 18:24 UTC (permalink / raw)
  To: 41408

[-- 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-19 23:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-19 18:24 bug#41408: Add a project-compile command Philip K.
2020-05-19 19:59 ` 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

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).