unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Re: project-mode vs projectile
Date: Sun, 05 Sep 2021 13:35:49 +0200	[thread overview]
Message-ID: <86sfyjl0fe.fsf@dod.no> (raw)
In-Reply-To: <2d559b9c-8466-a3d9-bd24-78e2a64c03ca@yandex.ru> (Dmitry Gutov's message of "Sun, 27 Jun 2021 03:20:42 +0300")

>>>>> 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	other threads:[~2021-09-05 11:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 17:11 How to profile restoring from .emacs.desktop Steinar Bang
2021-01-27 17:42 ` Stefan Monnier
2021-01-28 17:51   ` Steinar Bang
2021-01-28 19:08     ` Stefan Monnier
2021-01-28 22:31       ` Steinar Bang
2021-01-28 22:58         ` Stefan Monnier
2021-01-28 23:33           ` Dmitry Gutov
2021-06-19  9:02             ` project-mode vs projectile (Was: How to profile restoring from .emacs.desktop) Steinar Bang
2021-06-27  0:20               ` Dmitry Gutov
2021-09-05 11:35                 ` Steinar Bang [this message]
2021-09-05 14:56                   ` project-mode vs projectile Nikolay Kudryavtsev
2021-10-07  2:39                   ` Dmitry Gutov
2021-01-29 22:05           ` How to profile restoring from .emacs.desktop Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86sfyjl0fe.fsf@dod.no \
    --to=sb@dod.no \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).