[treemacs] Complete treemacs + persp-mode integration.

- Introduce configuration option to determine scope.
 - Activate treemacs-persp synchronization if opted in.
 - Document changes.
This commit is contained in:
Alexander Miller 2020-04-09 13:09:03 +02:00 committed by duianto
parent c3f13d0391
commit 3a1bfc2a91
4 changed files with 31 additions and 1 deletions

View file

@ -3248,6 +3248,9 @@ Other:
- Deleted default values to track upstream behavior
(thanks to Michael Peyton Jones)
- Removed obsolete options (thanks to Michael Peyton Jones)
- Finished =treemacs-persp= integration and made it opt-in. Using the layer
variable: =treemacs-use-scope-type= with the possible values:
='Frames= (default) or ='Perspectives= (thanks to Alexander Miller)
**** Typescript
- Call tsfmt with extension of current buffer for TSX formatting
(thanks to Victor Andrée)

View file

@ -11,6 +11,7 @@
- [[#configuration][Configuration]]
- [[#follow-mode][Follow mode]]
- [[#file-watch][File watch]]
- [[#scope-settings][Scope Settings]]
- [[#git-mode][Git mode]]
- [[#flattening-of-directories][Flattening of directories]]
- [[#locking-width][Locking width]]
@ -73,6 +74,23 @@ part of the file system shown by treemacs set the layer variable
Default is =t=.
** Scope Settings
By default treemacs buffers and their workspaces will be uniquely scoped within
the current frame. As an alternative it is possible to scope treemacs to the
currently active perspective, including the automatic creation of a workspace
for every perspective. The scope type is determined by setting the layer
variable =treemacs-use-scope-type= to either ='Frames= or ='Perspectives=.
Note that persective-based scoping will only take effect when =persp-mode= is
actually first used.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(treemacs :variables treemacs-use-persp-scope 'Perspectives)))
#+END_SRC
Default is ='Frames=.
** Git mode
To enable Treemacs to check for the git status information of files and directories
and highlight them accordingly, set the layer variable =treemacs-use-git-mode=

View file

@ -15,6 +15,12 @@
(defvar treemacs-use-filewatch-mode t
"When non-nil use `treemacs-filewatch-mode'.")
(defvar treemacs-use-scope-type 'Frames
"Determines the scope of treemacs buffers and workspaces.
Possible values are:
- `Frames' - to scope treemacs to the current frame
- `Perspectives' - to scope treemacs in conjunction with `persp-mode'.")
(defvar treemacs-use-git-mode
(pcase (cons (not (null (executable-find "git")))
(not (null (executable-find "python3"))))

View file

@ -89,7 +89,10 @@
:init (require 'treemacs-projectile)))
(defun treemacs/init-treemacs-persp ()
(use-package treemacs-persp :after treemacs))
(use-package treemacs-persp
:after treemacs persp-mode
:config (when (eq treemacs-use-scope-type 'Perspectives)
(treemacs-set-scope-type 'Perspectives))))
(defun treemacs/pre-init-winum ()
(spacemacs|use-package-add-hook winum