allow dynamic width lock setup for treemacs

Following #11384

Right now treemacs-lock-width variable affects width lock only during treemacs
initialisation. Any later modifications have no effect on treemacs behaviour.
This commit changes it by moving evaluation of treemacs-lock-width to the
treemacs-mode-hook.
This commit is contained in:
Boris Buliga 2018-10-11 19:58:53 +03:00
parent b8d5555340
commit 53f5121a03
No known key found for this signature in database
GPG Key ID: 027328150F064FA8
2 changed files with 6 additions and 6 deletions

View File

@ -21,8 +21,9 @@
(treemacs-do-add-project-to-workspace path name)
(treemacs-select-window))))
(defun spacemacs/treemacs-toggle-locked-width-off ()
"Unlock the manual resizing of the treemacs window."
(defun spacemacs/treemacs-setup-width-lock ()
"Setup the width lock of treemacs buffer based on
`treemacs-lock-width'."
(interactive)
(when treemacs--width-is-locked
(when (xor treemacs--width-is-locked treemacs-lock-width)
(treemacs-toggle-fixed-width)))

View File

@ -41,9 +41,8 @@
treemacs-never-persist nil
treemacs-goto-tag-strategy 'refetch-index
treemacs-collapse-dirs treemacs-use-collapsed-directories)
(unless treemacs-lock-width
(add-hook 'treemacs-mode-hook
'spacemacs/treemacs-toggle-locked-width-off))
(add-hook 'treemacs-mode-hook
#'spacemacs/treemacs-setup-width-lock)
(spacemacs/set-leader-keys
"ft" 'treemacs
"fB" 'treemacs-bookmark