From ac590845f9d00dab13b1da1ccfe6ec1861d79308 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 8 May 2017 10:32:49 +0200 Subject: [PATCH] Fix neotree forgetting it's a neotree window when switching perspectives --- TODO.org | 8 ++++---- core/core-popups.el | 27 ++++++++++----------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/TODO.org b/TODO.org index 08c4360f7..a64148ccb 100644 --- a/TODO.org +++ b/TODO.org @@ -93,14 +93,14 @@ + [ ] Fix invisible buffer-info in modeline for terminal Emacs + [ ] tools/upload: add ~+upload/open-remote-file~ command to open current file on the remote (with TRAMP) -** 2.0.2 [53/58] +** 2.0.2 [54/58] + [ ] Update screenshots + [ ] Fix ~+eval/region~ failing only on first invokation. + [ ] send-to-REPL workflow: does it still work? (see ~:repl~ & ~+eval/repl-send-region~) + [ ] Fix ~0/0~ displaying in modeline (caused by leftover anzu state) -+ [ ] Fix: Neotree forgets it's a neotree window when switching perspectives - + Restore neotree state on perspective switch - + Or close neotree before switching/creating perspectives ++ [X] Fix: Neotree forgets it's a neotree window when switching perspectives + + +Restore neotree state on perspective switch+ + + +Or close neotree before switching/creating perspectives+ + Or hand neotree window management off to shackle + [X] feature/version-control: add [[https://github.com/sshaw/git-link][git-link]] (replacement for browse-at-remote) + [X] feature/version-control: add [[https://github.com/pidu/git-timemachine][git-timemachine]] (replacement for vc-annotate) diff --git a/core/core-popups.el b/core/core-popups.el index 4bf7f965a..a1ccf673f 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -357,24 +357,17 @@ the command buffer." (after! neotree - (defun doom*popups-save-neotree (orig-fn &rest args) - "Prevents messing up the neotree buffer on window changes." - (let ((neo-p (and (featurep 'neotree) - (neo-global--window-exists-p)))) - (when neo-p - (neotree-hide)) - (unwind-protect (apply orig-fn args) - (when neo-p - (save-selected-window - (neotree-show)))))) + ;; Neotree has its own window/popup management built-in, which is difficult to + ;; police. For example, switching perspectives will cause neotree to forget it + ;; is a neotree pane. + ;; + ;; By handing neotree over to shackle, which is better integrated into the + ;; rest of my config (and persp-mode), this is no longer a problem. + (setq neo-display-action '(+evil-neotree-display-fn)) + (set! :popup " *NeoTree*" :align 'left :size 25) - ;; Prevents messing up the neotree buffer on window changes - (advice-add #'+evil-window-move :around #'doom*popups-save-neotree) - ;; Don't let neotree interfere with moving, splitting or rebalancing windows - (advice-add #'evil-window-move-very-bottom :around #'doom*popups-save-neotree) - (advice-add #'evil-window-move-very-top :around #'doom*popups-save-neotree) - (advice-add #'evil-window-move-far-left :around #'doom*popups-save-neotree) - (advice-add #'evil-window-move-far-right :around #'doom*popups-save-neotree)) + (defun +evil-neotree-display-fn (buf _alist) + (doom-popup-buffer buf))) (after! mu4e