core-popups: refactor
This commit is contained in:
parent
8dcd382186
commit
a73c82fc3f
1 changed files with 29 additions and 28 deletions
|
@ -347,24 +347,31 @@ the command buffer."
|
||||||
|
|
||||||
|
|
||||||
(after! neotree
|
(after! neotree
|
||||||
(defun doom*popups-save-neotree (orig-fn &rest args)
|
(defun doom*popups-save-neotree (orig-fn &rest args)
|
||||||
"Prevents messing up the neotree buffer on window changes."
|
"Prevents messing up the neotree buffer on window changes."
|
||||||
(let ((neo-p (and (featurep 'neotree)
|
(let ((neo-p (and (featurep 'neotree)
|
||||||
(neo-global--window-exists-p))))
|
(neo-global--window-exists-p))))
|
||||||
|
(when neo-p
|
||||||
|
(neotree-hide))
|
||||||
|
(unwind-protect (apply orig-fn args)
|
||||||
(when neo-p
|
(when neo-p
|
||||||
(neotree-hide))
|
(save-selected-window
|
||||||
(unwind-protect (apply orig-fn args)
|
(neotree-show))))))
|
||||||
(when neo-p
|
|
||||||
(save-selected-window
|
|
||||||
(neotree-show))))))
|
|
||||||
|
|
||||||
;; Prevents messing up the neotree buffer on window changes
|
;; Prevents messing up the neotree buffer on window changes
|
||||||
(advice-add '+evil-window-move :around 'doom*popups-save-neotree)
|
(advice-add '+evil-window-move :around 'doom*popups-save-neotree)
|
||||||
;; Don't let neotree interfere with moving, splitting or rebalancing windows
|
;; 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-bottom :around 'doom*popups-save-neotree)
|
||||||
(advice-add 'evil-window-move-very-top :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-left :around 'doom*popups-save-neotree)
|
||||||
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
|
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
|
||||||
|
|
||||||
|
|
||||||
|
(after! mu4e
|
||||||
|
(advice-add 'mu4e~temp-window :override 'doom*mu4e~temp-window)
|
||||||
|
(defun doom*mu4e~temp-window (buf height)
|
||||||
|
(doom-popup-buffer buf :size 10 :noselect t)
|
||||||
|
buf))
|
||||||
|
|
||||||
|
|
||||||
(after! twittering-mode
|
(after! twittering-mode
|
||||||
|
@ -391,8 +398,9 @@ the command buffer."
|
||||||
'("^CAPTURE.*\\.org$" :regexp t :size 20))
|
'("^CAPTURE.*\\.org$" :regexp t :size 20))
|
||||||
|
|
||||||
;; Org tries to do its own popup management, causing buffer/window config
|
;; Org tries to do its own popup management, causing buffer/window config
|
||||||
;; armageddon when paired with shackle. To fix this, first we suppress
|
;; armageddon when paired with shackle. To fix this, we must make a couple modifications:
|
||||||
;; delete-other-windows in org functions:
|
|
||||||
|
;; Suppress `delete-other-windows' in org functions:
|
||||||
(defun doom*suppress-delete-other-windows (orig-fn &rest args)
|
(defun doom*suppress-delete-other-windows (orig-fn &rest args)
|
||||||
(cl-flet ((silence (&rest args) (ignore)))
|
(cl-flet ((silence (&rest args) (ignore)))
|
||||||
(advice-add 'delete-other-windows :around #'silence)
|
(advice-add 'delete-other-windows :around #'silence)
|
||||||
|
@ -404,11 +412,11 @@ the command buffer."
|
||||||
(advice-add 'org-add-log-note :around #'doom*suppress-delete-other-windows)
|
(advice-add 'org-add-log-note :around #'doom*suppress-delete-other-windows)
|
||||||
(advice-add 'org-export--dispatch-ui :around #'doom*suppress-delete-other-windows)
|
(advice-add 'org-export--dispatch-ui :around #'doom*suppress-delete-other-windows)
|
||||||
|
|
||||||
;; Tell org-src-edit to open another window, which shackle can intercept.
|
;; Tell `org-src-edit' to open another window, which shackle can intercept.
|
||||||
(setq org-src-window-setup 'other-window)
|
(setq org-src-window-setup 'other-window)
|
||||||
|
|
||||||
;; Then, we tell org functions to use pop-to-buffer instead of
|
;; Tell org functions to use `pop-to-buffer' instead of switch-to-buffer-*.
|
||||||
;; switch-to-buffer-*. Buffers get handed off to shackle properly this way.
|
;; Buffers get handed off to shackle properly this way.
|
||||||
(defun doom*org-switch-to-buffer-other-window (&rest args)
|
(defun doom*org-switch-to-buffer-other-window (&rest args)
|
||||||
(pop-to-buffer (car args)))
|
(pop-to-buffer (car args)))
|
||||||
(advice-add 'org-switch-to-buffer-other-window :override 'doom*org-switch-to-buffer-other-window)
|
(advice-add 'org-switch-to-buffer-other-window :override 'doom*org-switch-to-buffer-other-window)
|
||||||
|
@ -425,12 +433,5 @@ the command buffer."
|
||||||
(define-key map "q" 'org-agenda-Quit)
|
(define-key map "q" 'org-agenda-Quit)
|
||||||
(define-key map "Q" 'org-agenda-Quit)))))
|
(define-key map "Q" 'org-agenda-Quit)))))
|
||||||
|
|
||||||
|
|
||||||
(after! mu4e
|
|
||||||
(advice-add 'mu4e~temp-window :override 'doom*mu4e~temp-window)
|
|
||||||
(defun doom*mu4e~temp-window (buf height)
|
|
||||||
(doom-popup-buffer buf :size 10 :noselect t)
|
|
||||||
buf))
|
|
||||||
|
|
||||||
(provide 'core-popups)
|
(provide 'core-popups)
|
||||||
;;; core-popups.el ends here
|
;;; core-popups.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue