Fix neotree forgetting it's a neotree window when switching perspectives

This commit is contained in:
Henrik Lissner 2017-05-08 10:32:49 +02:00
parent 5900906651
commit ac590845f9
2 changed files with 14 additions and 21 deletions

View file

@ -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)

View file

@ -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