Don't mess up popups/neotree buffer when moving/swapping buffers
This commit is contained in:
parent
fb25f716f9
commit
a5ff60224d
4 changed files with 31 additions and 4 deletions
|
@ -68,9 +68,16 @@
|
|||
|
||||
;; There is no shackle-popup hook, so I hacked one in
|
||||
(advice-add 'shackle-display-buffer :after 'narf|run-popup-hooks)
|
||||
;; Keep track of popups
|
||||
(add-hook! 'shackle-popup-hook '(narf|popup-init narf|hide-mode-line))
|
||||
|
||||
(add-hook 'shackle-popup-hook 'narf|popup-init) ; Keep track of popups
|
||||
(add-hook 'shackle-popup-hook 'narf|hide-mode-line) ; No mode line in popups
|
||||
|
||||
;; Prevents popups from messaging with windows-moving functions
|
||||
(after! defuns-popup
|
||||
(defun narf*save-popups (orig-fun &rest args)
|
||||
(narf/popup-save (apply orig-fun args)))
|
||||
(advice-add 'narf--evil-window-move :around 'narf*save-popups)
|
||||
(advice-add 'narf--evil-swap-windows :around 'narf*save-popups))
|
||||
|
||||
;;
|
||||
;; Hacks
|
||||
|
|
|
@ -124,9 +124,11 @@
|
|||
(apply orig-fun args)))
|
||||
(advice-add 'neotree-create-node :around 'narf*neotree-create-node)
|
||||
|
||||
(defun narf*save-neotree (orig-fun &rest args)
|
||||
(narf/neotree-save (apply orig-fun args)))
|
||||
;; Prevents messing up the neotree buffer on window changes
|
||||
(advice-add 'narf--evil-window-move :before 'narf|neotree-close-on-window-change)
|
||||
(advice-add 'narf--evil-swap-windows :before 'narf|neotree-close-on-window-change)
|
||||
(advice-add 'narf--evil-window-move :around 'narf*save-neotree)
|
||||
(advice-add 'narf--evil-swap-windows :around 'narf*save-neotree)
|
||||
|
||||
;; A custom and simple theme for neotree
|
||||
(advice-add 'neo-buffer--insert-fold-symbol :override 'narf*neo-buffer-fold-symbol))
|
||||
|
|
|
@ -17,6 +17,15 @@
|
|||
(neotree-dir project-root))
|
||||
(neotree-find path project-root)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro narf/neotree-save (&rest body)
|
||||
`(let ((neo-p (neo-global--window-exists-p)))
|
||||
(when neo-p (neotree-hide))
|
||||
,@body
|
||||
(when neo-p
|
||||
(save-selected-window
|
||||
(neotree-show)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|neotree-close-on-window-change (&rest _)
|
||||
"Close neotree to prevent ensuing mindow buggery."
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
(-any? (lambda (w) (eq window w)) narf-popup-windows)
|
||||
t)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro narf/popup-save (&rest body)
|
||||
`(let ((popup-p (narf/popup-p)))
|
||||
(when popup-p (narf/popup-close-all t))
|
||||
,@body
|
||||
(when popup-p
|
||||
(save-selected-window
|
||||
(narf/popup-last-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-buffer (buffer &optional plist)
|
||||
"Display BUFFER in a shackle popup."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue