Emacs: Rewrite my/switch-project() so that it works.

Call projectile-find-file before treemacs.
This commit is contained in:
tastytea 2020-02-12 14:39:47 +01:00
parent fbe6e0bd06
commit 21a1d3a158

View File

@ -1,6 +1,6 @@
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*- ;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-02-11T23:37:35+0100> ;; Time-stamp: <2020-02-12T14:39:05+0100>
;;; Commentary: ;;; Commentary:
@ -132,13 +132,14 @@
(substring (shell-command-to-string "nproc --ignore=1") 0 -1))) (substring (shell-command-to-string "nproc --ignore=1") 0 -1)))
(defun my/switch-project () (defun my/switch-project ()
"Open `treemacs', add project to workspace and find file in project." "Find file in project, add project to `treemacs' and
(treemacs-add-and-display-current-project) collapse other projects."
(treemacs-collapse-other-projects)
(treemacs-toggle-node)
(if (member 'counsel-projectile-mode minor-mode-list) (if (member 'counsel-projectile-mode minor-mode-list)
(counsel-projectile-find-file) (counsel-projectile-find-file)
(projectile-find-file))) (projectile-find-file))
(treemacs-add-and-display-current-project)
(treemacs-collapse-other-projects)
(other-window 1))
(defun my/projectile-kill-buffers () (defun my/projectile-kill-buffers ()
"Kill project buffers and delete other windows." "Kill project buffers and delete other windows."