Treemacs: Why does treemacs-projectile ask for project name?

Created on 21 Jun 2018  路  12Comments  路  Source: Alexander-Miller/treemacs

https://github.com/Alexander-Miller/treemacs/blob/900d335d584a107edb45041770b6e9da0ae50a86/src/elisp/treemacs-projectile.el#L32
How can I make it optional? It should be context aware. If I am in a project then that specific folder should open up in the side pane. Why ask for project and then give a name to project?! It should be more automatic than manual.

Bug Enhancement

All 12 comments

Or it would be better if treemacs--init took another argument for the name of the project.

How about we only explicitly ask for a name with a prefix arg?

That would be cool.

I saw that name of projects isn't taken care of. I could somehow create two projects under the same name. And when I removed one of the projects both of them were removed.

It would also be better to check for whether the project exists or not. I was writing some custom emacs lisp to tightly integrate with my workflow and it didn't seem to get what I was telling it to do and would mess up some or the other way. Its not horrible though. I have got it working to some degree but manual input is something I would like to skip.

The problem might be because I dirtied the default-directory variable.

I could somehow create two projects under the same name.

DOH!

It would also be better to check for whether the project exists or not.

This already happens somewhat. You cannot create a project for a directory that's part of another project.

The problem might be because I dirtied the default-directory variable.

Touching default-directory in the treemacs buffer will not go as planned. There's a post command hook always setting it to the current node's path (or home) so functions like magit-status and helm-projectile-ag will "do the right thing" for the current context.

So, I found a better way to add a project to treemacs buffer. @Alexander-Miller Why didn't you point out treemacs-add-project-at function when I asked for a second argument to treemacs--init here?

Sorry, I guess I didn't look into this hard enough.

My current priority is work my way through my issues oldest-first, so it'll be a while until I'll get to this one. If you'd rather not wait this long you're welcome to make the changes yourself. Both the name only with prefix arg change and name validation are what I would consider good first issues for treemacs and relatively easy picking.

I think I am happy with what I can do using just treemacs-add-project-at. IMO you can just improve that function so that duplicate names or paths are not added in the same workspace. If possible just throw a message or silent error. Or you could uniquely rename the project name intelligently for different paths.

@Alexander-Miller You should always resolve full symlinks to a directory root. This prevents projects having same tree contents.

Would it be possible to just use emacs's built-in project.el functionality for this (i.e. project-find-functions)?

Sure. I've been playing around with the idea of adding a "quickly add current project I'm in to the workspace" function, like treemacs-projectile but without the selection. project.el can simply be added as a source to determine the current project. If that's what you mean, then yes, it's on my todo list.

Change to stop asking for a name has just been pushed. Project's paths will also be resolved. Idea from the last comment can be followed in https://github.com/Alexander-Miller/treemacs/issues/322.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxwedwards picture maxwedwards  路  3Comments

zoechi picture zoechi  路  6Comments

ianpan870102 picture ianpan870102  路  5Comments

simurgh9 picture simurgh9  路  3Comments

TheKashe picture TheKashe  路  13Comments