* 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
* bug#41408: Add a project-compile command
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 23:02 ` Dmitry Gutov
1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2020-05-19 19:59 UTC (permalink / raw)
To: Philip K., 41408
Hey Philip,
On 19.05.2020 21:24, Philip K. wrote:
> 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).
Is this a command you'd be using yourself? If so, we'll add it happily.
I'm just asking because it's indeed bare-bones, and I basically never
use 'M-x compile' directly.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#41408: Add a project-compile command
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
0 siblings, 2 replies; 6+ messages in thread
From: Philip K. @ 2020-05-19 20:07 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 41408
Dmitry Gutov <dgutov@yandex.ru> writes:
> Hey Philip,
>
> On 19.05.2020 21:24, Philip K. wrote:
>> 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).
>
> Is this a command you'd be using yourself? If so, we'll add it happily.
I wrote it because I needed it, otherwise I wouldn't have suggested it,
hoping others to do. And I assume others do, since projectile has a
similar command (projectile-compile-project).
> I'm just asking because it's indeed bare-bones, and I basically never
> use 'M-x compile' directly.
Hmm, I regularly use compile/recompile, but maybe that's my mistake. If
you don't mind me asking, how do you invoke compile or related
functions? If I'm doing it the "wrong way", maybe it might not be worth
applying this patch.
--
Philip K.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#41408: Add a project-compile command
2020-05-19 20:07 ` Philip K.
@ 2020-05-19 21:55 ` Dmitry Gutov
2020-05-19 22:17 ` Kévin Le Gouguec
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2020-05-19 21:55 UTC (permalink / raw)
To: Philip K.; +Cc: 41408
On 19.05.2020 23:07, Philip K. wrote:
>>> 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).
Regarding the "build" command, I had a bigger idea with a set of
abstractions and per-project customizations. But so far nobody's needed
that, it seems.
>> Is this a command you'd be using yourself? If so, we'll add it happily.
>
> I wrote it because I needed it, otherwise I wouldn't have suggested it,
> hoping others to do.
That's what's important.
> And I assume others do, since projectile has a
> similar command (projectile-compile-project).
Projectile has a great many commands, we'll probably refrain from adding
them all.
>> I'm just asking because it's indeed bare-bones, and I basically never
>> use 'M-x compile' directly.
>
> Hmm, I regularly use compile/recompile, but maybe that's my mistake. If
> you don't mind me asking, how do you invoke compile or related
> functions?
Someone could give some pointers, but don't mind me: I usually work with
Ruby, where the main "compilation" is running the tests. And we do that
(to take advantage of compilation-mode) via a certain abstraction that
builds up the list of arguments, and uses a mode derived from
compilation-mode.
> If I'm doing it the "wrong way", maybe it might not be worth
> applying this patch.
If you find it helpful, then most likely there will be others that do.
So please don't worry about that.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#41408: Add a project-compile command
2020-05-19 20:07 ` Philip K.
2020-05-19 21:55 ` Dmitry Gutov
@ 2020-05-19 22:17 ` Kévin Le Gouguec
1 sibling, 0 replies; 6+ messages in thread
From: Kévin Le Gouguec @ 2020-05-19 22:17 UTC (permalink / raw)
To: Philip K.; +Cc: 41408, Dmitry Gutov
philip@warpmail.net (Philip K.) writes:
> I wrote it because I needed it, otherwise I wouldn't have suggested it,
> hoping others to do. And I assume others do, since projectile has a
> similar command (projectile-compile-project).
FWIW I have written a similar function in my .emacs, which your command
would replace handily. Thank you for suggesting this 👍
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#41408: Add a project-compile command
2020-05-19 18:24 bug#41408: Add a project-compile command Philip K.
2020-05-19 19:59 ` Dmitry Gutov
@ 2020-05-19 23:02 ` Dmitry Gutov
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2020-05-19 23:02 UTC (permalink / raw)
To: Philip K., 41408-done
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!
^ permalink raw reply [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).