Simple treemacs backend for project.el:
- Projects in Treemacs map to project.el projects.
- Workspaces in Treemacs map to project.el projects + their external roots.
project-find-file,project-switch-to-buffer,project-find-regexpet al operate on the current treemacs project.project-or-external-find-file,project-or-external-find-regexpoperate on the current treemacs workspace.
Install project-treemacs directly from MELPA
Manually:
(with-eval-after-load 'treemacs
(require 'project-treemacs)
(project-treemacs-mode))With use-package:
(use-package project-treemacs
:demand t
:after treemacs
:config
(project-treemacs-mode))Enable the mode by calling project-treemacs-mode.
Use treemacs as you normally would, creating workspaces, projects, etc.
Use project.el commands as you normally would, with your current project.el project defined by the current treemacs project, and your project external roots defined by the current treemacs workspace.
project-treemacs-mode- enables and disables theproject-treemacsbackend.
project-treemacs-ignores- list of patterns to add toproject-ignores.project-treemacs-prefer-backend- Whether or not to prefer the project-treemacs backend over others. See the commentary in project.el for more information, and the documentation forproject-find-functionsin particular.
For the moment, the project-treemacs backend depends on the treemacs side panel being visible.
For the moment, project.el commands are still based on the buffer from which they are called, although the latest version of project.el includes a TODO for allowing the user to "pick the current project for the whole Emacs session, independent of the current directory".
Using
project-find-file to search for files within the current treemacs project.
Using
project-or-external-find-file to search for files within the current treemacs workspace.