core-popups: refactor/cleanup hacks

This commit is contained in:
Henrik Lissner 2017-03-04 18:55:47 -05:00
parent 2dc1c616d1
commit e835d089c8

View file

@ -220,12 +220,10 @@ properties."
;; Hacks
;;
;; Run these as late as possible, to give a chance for other modules to
;; customize these settings in their own hooks.
(add-hook! 'window-setup-hook
(after! evil
(after! evil
(let ((map doom-popup-mode-map))
(define-key map [remap evil-window-delete] 'doom/popup-close)
(define-key map [remap evil-save-modified-and-close] 'doom/popup-close)
(define-key map [remap evil-window-move-very-bottom] 'ignore)
(define-key map [remap evil-window-move-very-top] 'ignore)
(define-key map [remap evil-window-move-far-left] 'ignore)
@ -297,7 +295,7 @@ the command buffer."
(advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups))
(after! help-mode
(after! help-mode
;; Help buffers use `other-window' to decide where to open followed links,
;; which can be unpredictable. It should *only* replace the original buffer we
;; opened the popup from. To fix this these three button types need to be
@ -335,12 +333,12 @@ the command buffer."
(doom--switch-from-popup (find-function-search-for-symbol fun 'defface file)))))
;; (after! magit
;; ;; Don't open files (from magit) within the magit popup
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save))
;; (after! magit
;; ;; Don't open files (from magit) within the magit popup
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save))
(after! neotree
(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)
@ -361,6 +359,9 @@ the command buffer."
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
;; Ensure these settings are attached to org-load-hook as late as possible,
;; giving other modules to add their own hooks.
(add-hook! 'after-init-hook
(add-hook! 'org-load-hook
(set! :popup
'("*Calendar*" :size 0.4 :noselect t)
@ -408,12 +409,7 @@ the command buffer."
:m "ESC" 'org-agenda-Quit))
(let ((map org-agenda-mode-map))
(define-key map "q" 'org-agenda-Quit)
(define-key map "Q" 'org-agenda-Quit))))
(after! repl-toggle
(add-hook! doom-popup-close
(setq rtog/--last-buffer nil))))
(define-key map "Q" 'org-agenda-Quit)))))
(provide 'core-popups)
;;; core-popups.el ends here