help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: project-mode vs projectile


From: Steinar Bang
Subject: Re: project-mode vs projectile
Date: Sun, 05 Sep 2021 13:35:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt)

>>>>> Dmitry Gutov <dgutov@yandex.ru>:

> First of all, it's not a mode. A recent enough version of project.el
> just installs a global keymap and lets you use its bindings.

Hm... ok. I've seen some bindings mentioned in a google hit, but when I
tried using them on emacs 27 (I don't have a reference to the google hit
handy).

Is this for emacsen newer than 27.1?

> One advantage is it doesn't run any code (e.g. root-finding code)
> until you actually use one of the related commands.

An advantage in performance?

I don't know what projectile does here, but I suspect that, with the
correct configuration (which is *not*, as I found, "scan everything on
startup"...), projectile doesn't do much either, until the commands are
used.

>> Is there an overview on what kind of commands are available in the emacs
>> 28 project-mode?

> 'C-x p C-h' should give you a reasonably complete list.

I get "C-x p is undefined" on emacs 27.1, so I guess I need something
newer than that?

> I've used it for years, it's a handy package. project.el started out
> as a kind of backdoor to be able to use projectile indirectly in core
> Emacs commands. That still hasn't panned out exactly, but I'm hopeful
> on that front too.

Hm... are you saying project.el and projectile are releated somehow?

Up until reading the above I had been thinking they were two
implementations of similar functionality, with project.el being the
native emacs version?

[snip!]
>> projectile-find-dir command (the find file and find dir commands stay
>> within a project).

> There is still no 'project-find-dir' command, but we should add
> one. There is a related bug report somewhere in debbugs.

>> Other useful commands:
>> - projectile-grep which rgreps inside a project useful
>> - projectile-compile-project (very useful for maven projects, where the
>> mvn command must be run at the top directory of the project far from
>> the file being edited)
>> - projectile-find-tag (very useful, once I was able to make CTAGS
>> recognize ES6 javascript)

> There are counterparts to the first two, but what does the last one
> do? It's it basically the same as xref-find-definitions?

I've never used xref-find-definitions, but from the description it looks
to be the same.

[snip1]
>> Does project-mode have a concept of modules? (the maven concept of
>> modules is what's in my mind)

> No concept of modules as such

Ok.

> (though there is a defcustom to decide whether to treat "git
> submodules" as separate projects, but those are different kind of
> modules).

Yes.  Maven modules have the same form as the entire maven project they
are part of.  And they can be run separately by cd'ing into the module
diretory and running the mvn build command (if their dependencies are
fulfilled). 

> If you want some dedicated support, we'll need to clarify the
> requirements. For instance, would you be happy if mvn modules were
> treated as separate projects?

Ideally I would like the project level commands to remain as they are.

But I would like to have a similar set of commands that operate on the
specified module only (search, replace, build, at least).

And maybe a simple way to navigate to a specified module.

> I think that leaves only the "module compile command", and that seems
> somewhat maven-specific. You could create a new command which would
> look up what kind of project the current file is in, and invoke some
> corresponding action.

What I currently do, is have a text file in each project, not commited
to git, and containing canned commands for building each project.

And then I just go to that file, copy them, and then feed them to "M-x
compile" to build a specific project.

But this is cumbersome, and error prone (I have may times built the
wrong module and not understood why my changes weren't showing up) and
cd followed by a command, doesn't work on windows emacs.

Here's an example of such a text file:
 cd ~/workspaces/sampleapp/sampleapp.web.frontend/; mvn -B install -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true
 cd ~/workspaces/sampleapp/sampleapp.db.liquibase.test/; mvn -B install 
-DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
 cd ~/workspaces/sampleapp/sampleapp.backend/; mvn -B install -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true
 cd ~/workspaces/sampleapp/sampleapp.web.api/; mvn -B install -DskipTests 
-Dmaven.javadoc.skip=true -Dmaven.source.skip=true

> Or if you want project-compile to provide different behaviors, what
> would it do? Perhaps you'd want to customize compilation-read-command
> instead?

No, I think what I would like to see, is a concept of "current-module"
(e.g. based on the currently visisted file or directory) and then a
module-compile command

Thanks for responding! :-)


- Steinar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]