Bump :ui treemacs
Alexander-Miller/treemacs@10c96c9 -> Alexander-Miller/treemacs@5c01829 The new treemacs-add-and-display-current-project command does what the old +treemacs/toggle did, now we just need +treemacs/toggle to do-what-I-mean with respect to projects (if not in a project, treemacs-add-and-display-current-project unhelpfully aborts with an error).
This commit is contained in:
parent
bd6405673e
commit
383bc03f4c
4 changed files with 7 additions and 34 deletions
|
@ -1,24 +1,5 @@
|
|||
;;; ui/treemacs/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +treemacs--init ()
|
||||
(require 'treemacs)
|
||||
(let ((origin-buffer (current-buffer)))
|
||||
;; Toggle treemacs without prompting for the first project.
|
||||
(cl-letf (((symbol-function 'treemacs-workspace->is-empty?)
|
||||
(symbol-function 'ignore)))
|
||||
(treemacs--init))
|
||||
(unless (bound-and-true-p persp-mode)
|
||||
(dolist (project (treemacs-workspace->projects (treemacs-current-workspace)))
|
||||
(treemacs-do-remove-project-from-workspace project)))
|
||||
(with-current-buffer origin-buffer
|
||||
(let ((project-root (or (doom-project-root) default-directory)))
|
||||
(treemacs-do-add-project-to-workspace
|
||||
(treemacs--canonical-path project-root)
|
||||
(doom-project-name project-root)))
|
||||
(setq treemacs--ready-to-follow t)
|
||||
(when (or treemacs-follow-after-init treemacs-follow-mode)
|
||||
(treemacs--follow)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +treemacs/toggle ()
|
||||
"Initialize or toggle treemacs.
|
||||
|
@ -28,16 +9,8 @@ been removed.
|
|||
|
||||
Use `treemacs' command for old functionality."
|
||||
(interactive)
|
||||
(require 'treemacs)
|
||||
(pcase (treemacs-current-visibility)
|
||||
(`visible (delete-window (treemacs-get-local-window)))
|
||||
(_ (+treemacs--init))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +treemacs/find-file (arg)
|
||||
"Open treemacs (if necessary) and find current file."
|
||||
(interactive "P")
|
||||
(let ((origin-buffer (current-buffer)))
|
||||
(+treemacs--init)
|
||||
(with-current-buffer origin-buffer
|
||||
(treemacs-find-file arg))))
|
||||
(_ (if (doom-project-p)
|
||||
(treemacs-add-and-display-current-project)
|
||||
(treemacs)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue