Closed bridgesense closed 1 year ago
I remember seeing something like this as well, but that was many commits ago, and I can't reproduce it locally. Try pulling the latest treemacs version. If that doesn't help I'll need a detailed reproduction recipe - what does your workspace layout look like when you first start (what does treemacs-edit-workspaces
show)? What file are you trying to open? Is it already in one of your workspaces? Is treemacs already loaded?
It seems to work more consistently for me than treemacs-select-window in focusing only at the project at hand.
Select-window doesn't really do that. Treemacs expects you to consciously decide what your workspaces look like - it even has an editor based on org-mode just for that. What select-window does is it tries to pick a workspace that contains the current file when treemacs starts for the first time. If there's no such workspace, or if there's no file, it'll pick the fallback workspace, which is just the first one in the list. So it tries to pick the right thing for you, but it won't add anything new.
What kind of detail do you need, so that I can provide it?
Let's assume that we are using projects that lie anywhere within the user directory.
The .emacs file is commonly placed in the user root directory at the very base level. Edit that file first. If you run the command treemacs-display-current-project-exclusively, you should see a display of the current root directory.
I'm mainly referring to projects that are hosted on a repository, such as GitHub. I have several projects that I've cloned in several places in my user directory. Open any file in emacs that was cloned using a repository.
That command is designed to snap to the current project, which in this case starts at the root of the cloned repository -- wherever that is. This command is no longer working, and should be reproducible in just about any situation.
Instead of seeing a treemacs window showing the files in the project (directory cloned using a repository) its showing the whole user root directory based on the fact that the .emacs file is also opened in another buffer.
If we run treemacs-display-current-project-exclusively, it should snap to the directory containing the project of the currently focused buffer. It used to do that. It doesn't now.
I'm running on the latest treemacs release from Melpa.
You mentioned something about a file we can edit in org-mode that instructs treemacs how to interpret what a workspace looks like. That's interesting! Coul d I get a link to the documentation on that?
As a sidenote, I use the repository to manage my projects -- not treemacs. I use treemacs as a file explorer to view files in the project of the currently focused buffer. That's why I really appreciate the treemacs-display-current-project-exclusively command. That's the way it used to work.
I wish there was a treemacs "simple mode" where users didn't have to manage an extra layer of obfuscation for project management. That's why I loved the treemacs-display-current-project-exclusively command. It was my work-around. :)
Here is the treemacs-edit-workspaces command:
If you open a file in the user root first, it doesn't appear that the follow-mode works. Maybe that's the issue?
However, if you open a file in the project first - everything works as intended.
Once a file is open in the user root directory -- or somewhere below the project files, the follow-mode is broken. A new treemacs window should always snap to the project of the currently selected buffer.
treemacs-follow-mode and treemacs-project-follow-mode are both set to t.
Sorry for the late response, other stuff piled up and I've had little time.
Instead of seeing a treemacs window showing the files in the project (directory cloned using a repository) its showing the whole user root directory based on the fact that the .emacs file is also opened in another buffer.
That should be taken care of now. The switch was avoided because the new project is part of the old one for the sake of performance, but it's a no-go for a scenario where your current project is $HOME.
You mentioned something about a file we can edit in org-mode that instructs treemacs how to interpret what a workspace looks like. That's interesting! Coul d I get a link to the documentation on that?
https://github.com/Alexander-Miller/treemacs#conveniently-editing-your-projects-and-workspaces
BTW you might also be interested in treemacs-project-follow-mode
.
BTW you might also be interested in
treemacs-project-follow-mode
.
I have that toggled on, but maybe I don't understand the intention fully in relation to how the rest of the project functions. I'll review the docs. Thanks!
It's a mode that was made for people who wanted automation for the kind of workflow you described - always just show the project for the current file, but without having to make the switch manually.
I wouldn't say there is a relation of other project management functions, while project-following is on it supersedes any manual control of yours.
I can have several projects open at the same time. I use the treemacs-display-current-project-exclusively command to pull up treemacs when editing a file. It seems to work more consistently for me than treemacs-select-window in focusing only at the project at hand.
This command appears to be broken now, when it was working before.
To reproduce:
Treemacs should display files only in the current project with that command. Instead, it is showing the whole user root directory, despite what git resources are employed inside the project.
System: Emacs 27.1 Ubuntu 22.04.1 LTS