core-popups: refactor

This commit is contained in:
Henrik Lissner 2017-04-09 22:09:33 -04:00
parent 8dcd382186
commit a73c82fc3f

View file

@ -367,6 +367,13 @@ the command buffer."
(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
(setq twittering-pop-to-buffer-function 'pop-to-buffer))
@ -391,8 +398,9 @@ the command buffer."
'("^CAPTURE.*\\.org$" :regexp t :size 20))
;; Org tries to do its own popup management, causing buffer/window config
;; armageddon when paired with shackle. To fix this, first we suppress
;; delete-other-windows in org functions:
;; armageddon when paired with shackle. To fix this, we must make a couple modifications:
;; Suppress `delete-other-windows' in org functions:
(defun doom*suppress-delete-other-windows (orig-fn &rest args)
(cl-flet ((silence (&rest args) (ignore)))
(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-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)
;; Then, we tell org functions to use pop-to-buffer instead of
;; switch-to-buffer-*. Buffers get handed off to shackle properly this way.
;; Tell org functions to use `pop-to-buffer' instead of switch-to-buffer-*.
;; Buffers get handed off to shackle properly this way.
(defun doom*org-switch-to-buffer-other-window (&rest args)
(pop-to-buffer (car args)))
(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)))))
(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)
;;; core-popups.el ends here