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 + [ ] 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) + [ ] 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 + [ ] Update screenshots
+ [ ] Fix ~+eval/region~ failing only on first invokation. + [ ] Fix ~+eval/region~ failing only on first invokation.
+ [ ] send-to-REPL workflow: does it still work? (see ~:repl~ & ~+eval/repl-send-region~) + [ ] 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 ~0/0~ displaying in modeline (caused by leftover anzu state)
+ [ ] Fix: Neotree forgets it's a neotree window when switching perspectives + [X] Fix: Neotree forgets it's a neotree window when switching perspectives
+ Restore neotree state on perspective switch + +Restore neotree state on perspective switch+
+ Or close neotree before switching/creating perspectives + +Or close neotree before switching/creating perspectives+
+ Or hand neotree window management off to shackle + 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/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) + [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 (after! neotree
(defun doom*popups-save-neotree (orig-fn &rest args) ;; Neotree has its own window/popup management built-in, which is difficult to
"Prevents messing up the neotree buffer on window changes." ;; police. For example, switching perspectives will cause neotree to forget it
(let ((neo-p (and (featurep 'neotree) ;; is a neotree pane.
(neo-global--window-exists-p)))) ;;
(when neo-p ;; By handing neotree over to shackle, which is better integrated into the
(neotree-hide)) ;; rest of my config (and persp-mode), this is no longer a problem.
(unwind-protect (apply orig-fn args) (setq neo-display-action '(+evil-neotree-display-fn))
(when neo-p (set! :popup " *NeoTree*" :align 'left :size 25)
(save-selected-window
(neotree-show))))))
;; Prevents messing up the neotree buffer on window changes (defun +evil-neotree-display-fn (buf _alist)
(advice-add #'+evil-window-move :around #'doom*popups-save-neotree) (doom-popup-buffer buf)))
;; 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))
(after! mu4e (after! mu4e