core-popups: attach popup hacks to window-setup-hook (fix #29)

This commit is contained in:
Henrik Lissner 2017-02-26 02:18:03 -05:00
parent ccabb9f6ee
commit 2a9a1ef186

View file

@ -212,7 +212,8 @@ properties."
;; Hacks ;; Hacks
;; ;;
(after! evil (add-hook! 'window-setup-hook
(after! evil
(let ((map doom-popup-mode-map)) (let ((map doom-popup-mode-map))
(define-key map [remap evil-window-delete] 'doom/popup-close) (define-key map [remap evil-window-delete] 'doom/popup-close)
(define-key map [remap evil-window-move-very-bottom] 'ignore) (define-key map [remap evil-window-move-very-bottom] 'ignore)
@ -277,7 +278,7 @@ the command buffer."
(advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups)) (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, ;; Help buffers use `other-window' to decide where to open followed links,
;; which can be unpredictable. It should *only* replace the original buffer we ;; 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 ;; opened the popup from. To fix this these three button types need to be
@ -315,12 +316,12 @@ the command buffer."
(doom--switch-from-popup (find-function-search-for-symbol fun 'defface file))))) (doom--switch-from-popup (find-function-search-for-symbol fun 'defface file)))))
;; (after! magit ;; (after! magit
;; ;; Don't open files (from magit) within the magit popup ;; ;; Don't open files (from magit) within the magit popup
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save)) ;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save))
(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)
@ -341,7 +342,7 @@ the command buffer."
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree)) (advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
(add-hook! org-load (add-hook! 'org-load-hook
(set! :popup (set! :popup
'("*Calendar*" :size 0.4 :noselect t) '("*Calendar*" :size 0.4 :noselect t)
'(" *Org todo*" :size 5 :noselect t) '(" *Org todo*" :size 5 :noselect t)
@ -391,9 +392,9 @@ the command buffer."
(define-key map "Q" 'org-agenda-Quit)))) (define-key map "Q" 'org-agenda-Quit))))
(after! repl-toggle (after! repl-toggle
(add-hook! doom-popup-close (add-hook! doom-popup-close
(setq rtog/--last-buffer nil))) (setq rtog/--last-buffer nil))))
(provide 'core-popups) (provide 'core-popups)
;;; core-popups.el ends here ;;; core-popups.el ends here