2017-01-16 23:15:48 -05:00
|
|
|
;;; core-popups.el --- taming sudden yet inevitable windows
|
|
|
|
|
2017-01-28 02:00:38 -05:00
|
|
|
;; I'd like certain buffers--like help windows, prompts or
|
2017-02-09 04:25:32 -05:00
|
|
|
;; informational/terminal/temporary buffers--to have less presence over my work
|
|
|
|
;; buffers (e.g. source code buffers). I'd also like them to be easy to both
|
|
|
|
;; dispose of quickly and invoke from anywhere. Also, hide the mode-line in
|
|
|
|
;; popups with `doom-hide-modeline-mode'
|
2017-01-16 23:15:48 -05:00
|
|
|
;;
|
2017-02-09 04:25:32 -05:00
|
|
|
;; I use `shackle' to make this as consistent as possible, which allows you
|
|
|
|
;; to specify rules on how to treat certain buffers.
|
2017-01-16 23:15:48 -05:00
|
|
|
;;
|
2017-01-28 02:00:38 -05:00
|
|
|
;; Be warned, there is a lot of hackery voodoo here that could break with an
|
|
|
|
;; emacs update, or an update to any of the packages it tries to tame (like helm
|
|
|
|
;; or org-mode).
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-02-03 08:03:48 -05:00
|
|
|
(defvar doom-popup-history nil
|
|
|
|
"A list of popups that were last closed. Used by `doom/popup-restore' and
|
2017-02-08 17:56:27 -05:00
|
|
|
`doom*popups-save'.")
|
2017-02-03 08:03:48 -05:00
|
|
|
|
|
|
|
(defvar doom-popup-remember-history t
|
|
|
|
"If non-nil, DOOM will remember the last popup(s) that were open in
|
|
|
|
`doom-popup-history'.")
|
|
|
|
|
|
|
|
(defvar doom-popup-other-window nil
|
|
|
|
"The last window selected before a popup was opened.")
|
|
|
|
|
|
|
|
(defvar-local doom-popup-rules nil
|
|
|
|
"The shackle rule that caused this buffer to be recognized as a popup.")
|
|
|
|
|
|
|
|
(defvar doom-popup-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(define-key map [escape] 'doom/popup-close-maybe)
|
|
|
|
(define-key map (kbd "ESC") 'doom/popup-close-maybe)
|
|
|
|
map)
|
|
|
|
"Active keymap in popup windows.")
|
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
(@def-setting :popup (&rest rules)
|
2017-02-04 21:09:33 -05:00
|
|
|
"Prepend a new popup rule to `shackle-rules'."
|
2017-02-19 18:02:40 -05:00
|
|
|
(if (cl-every 'listp rules)
|
|
|
|
`(nconc shackle-rules ',rules)
|
|
|
|
`(push ',rules shackle-rules)))
|
2017-02-04 21:09:33 -05:00
|
|
|
|
2017-02-03 08:03:48 -05:00
|
|
|
|
2017-02-04 02:53:57 -05:00
|
|
|
;;
|
|
|
|
;; Bootstrap
|
|
|
|
;;
|
2017-01-28 02:00:38 -05:00
|
|
|
|
2017-02-11 00:46:42 -05:00
|
|
|
(@def-package shackle :demand t
|
2017-02-04 02:53:57 -05:00
|
|
|
:init
|
|
|
|
(setq shackle-default-alignment 'below
|
2017-02-19 18:12:12 -05:00
|
|
|
;;; Baseline popup-window rules
|
|
|
|
;; :noesc and :modeline are custom settings and are not part of shackle. See
|
|
|
|
;; `doom*popup-init' and `doom-popup-buffer' for how they're used.
|
|
|
|
shackle-rules
|
|
|
|
'(("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t)
|
|
|
|
("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t)
|
|
|
|
("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t)
|
|
|
|
("*esup*" :size 0.4 :noselect t :noesc t)
|
|
|
|
("*minor-modes*" :size 0.5 :noselect t)
|
|
|
|
("*eval*" :size 16 :noselect t)
|
|
|
|
("*Pp Eval Output*" :size 0.3)
|
|
|
|
("*Apropos*" :size 0.3)
|
|
|
|
("*Backtrace*" :size 25 :noselect t)
|
|
|
|
("*Help*" :size 16)
|
|
|
|
("*Messages*" :size 10)
|
|
|
|
("*Warnings*" :size 10 :noselect t)
|
|
|
|
("*command-log*" :size 28 :noselect t :align right)
|
|
|
|
("*Shell Command Output*" :size 20 :noselect t)
|
2017-02-21 00:55:15 -05:00
|
|
|
("*Occur*" :size 30 :noselect t)
|
2017-02-19 18:12:12 -05:00
|
|
|
(compilation-mode :size 15 :noselect t :noesc t)
|
|
|
|
(ivy-occur-grep-mode :size 25 :noesc t)
|
|
|
|
(eww-mode :size 30)
|
|
|
|
(comint-mode :noesc t)
|
|
|
|
(tabulated-list-mode :noesc t)))
|
2017-02-04 02:53:57 -05:00
|
|
|
|
|
|
|
:config
|
2017-02-19 18:12:12 -05:00
|
|
|
(shackle-mode 1))
|
2017-02-08 01:58:11 -05:00
|
|
|
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
;;
|
|
|
|
;; Modifications
|
|
|
|
;;
|
|
|
|
|
2017-02-19 18:12:12 -05:00
|
|
|
(defun doom*shackle-always-align (plist)
|
|
|
|
"Ensure popups are always aligned and selected by default. Eliminates the need
|
|
|
|
for the obvious :align t on every rule."
|
|
|
|
(when plist
|
|
|
|
(unless (plist-member plist :align)
|
|
|
|
(plist-put plist :align t))
|
|
|
|
(unless (or (plist-member plist :select)
|
|
|
|
(plist-member plist :noselect))
|
|
|
|
(plist-put plist :select t)))
|
|
|
|
plist)
|
|
|
|
(advice-add 'shackle--match :filter-return 'doom*shackle-always-align)
|
|
|
|
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
;; Tell `window-state-get' and `current-window-configuration' to persist these
|
|
|
|
;; custom parameters. Allows `persp-mode' to remember popup states.
|
2017-02-19 18:12:12 -05:00
|
|
|
(nconc window-persistent-parameters
|
|
|
|
'((popup . writable)
|
|
|
|
(noesc . writable)))
|
2017-02-08 17:56:27 -05:00
|
|
|
|
|
|
|
|
2017-02-08 01:58:11 -05:00
|
|
|
(define-minor-mode doom-popup-mode
|
2017-02-08 17:56:27 -05:00
|
|
|
"Minor mode for popup windows."
|
2017-02-08 01:58:11 -05:00
|
|
|
:init-value nil
|
|
|
|
:keymap doom-popup-mode-map
|
|
|
|
(if (and (not doom-popup-mode)
|
|
|
|
doom-hide-modeline-mode)
|
|
|
|
(doom-hide-modeline-mode -1)
|
|
|
|
(let ((modeline (plist-get doom-popup-rules :modeline)))
|
2017-02-08 17:56:27 -05:00
|
|
|
(cond ((or (eq modeline 'nil)
|
|
|
|
(not modeline))
|
2017-02-08 01:58:11 -05:00
|
|
|
(doom-hide-modeline-mode +1))
|
|
|
|
((symbolp modeline)
|
|
|
|
(let ((doom--hidden-modeline-format (+doom-modeline modeline)))
|
|
|
|
(doom-hide-modeline-mode +1))))))
|
2017-02-08 17:56:27 -05:00
|
|
|
(unless doom-popup-mode
|
|
|
|
(mapc (lambda (cfg) (set-window-parameter nil cfg nil))
|
|
|
|
'(popup no-other-window noesc)))
|
2017-02-08 01:58:11 -05:00
|
|
|
(set-window-dedicated-p nil doom-popup-mode))
|
|
|
|
(put 'doom-popup-mode 'permanent-local t)
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
(defun doom-popup--init (window &optional plist)
|
|
|
|
"Initializes a window as a popup window. Sets custom window parameters and
|
|
|
|
enables `doom-popup-mode'."
|
|
|
|
(unless window
|
|
|
|
(error "No window was found for %s: %s" (car args) plist))
|
|
|
|
(unless plist
|
|
|
|
(setq plist (shackle-match (window-buffer window))))
|
|
|
|
(mapc (lambda (cfg) (set-window-parameter window (car cfg) (cdr cfg)))
|
|
|
|
(append `((popup . ,plist)
|
|
|
|
(no-other-window . ,t))
|
|
|
|
(when (plist-get plist :noesc)
|
|
|
|
`((noesc . ,t)))))
|
|
|
|
(with-selected-window window
|
|
|
|
(unless (eq plist t)
|
|
|
|
(setq-local doom-popup-rules plist))
|
|
|
|
(doom-popup-mode +1))
|
|
|
|
window)
|
|
|
|
|
2017-02-19 18:12:12 -05:00
|
|
|
;;
|
2017-02-08 01:58:11 -05:00
|
|
|
(defun doom*popup-init (orig-fn &rest args)
|
2017-02-08 17:56:27 -05:00
|
|
|
"Invokes `doom-popup--init' on windows that qualify as popups. Returns the window."
|
2017-02-08 01:58:11 -05:00
|
|
|
(unless (doom-popup-p)
|
|
|
|
(setq doom-popup-other-window (selected-window)))
|
2017-02-08 17:56:27 -05:00
|
|
|
(doom-popup--init (apply orig-fn args) (nth 2 args)))
|
2017-02-08 01:58:11 -05:00
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
(defun doom*popups-save (orig-fn &rest args)
|
2017-02-08 01:58:11 -05:00
|
|
|
"Puts aside all popups before executing the original function, usually to
|
2017-02-08 17:56:27 -05:00
|
|
|
prevent popups from messaging up the UI (or vice versa)."
|
2017-02-08 01:58:11 -05:00
|
|
|
(let ((in-popup-p (doom-popup-p))
|
|
|
|
(popups (doom-popup-windows))
|
|
|
|
(doom-popup-remember-history t))
|
|
|
|
(when popups
|
|
|
|
(mapc 'doom/popup-close popups))
|
|
|
|
(unwind-protect (apply orig-fn args)
|
2017-01-28 02:00:38 -05:00
|
|
|
(when popups
|
2017-02-08 01:58:11 -05:00
|
|
|
(let ((origin (selected-window)))
|
|
|
|
(doom/popup-restore)
|
|
|
|
(unless in-popup-p
|
|
|
|
(select-window origin)))))))
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
(defun doom*delete-popup-window (orig-fn &rest args)
|
|
|
|
"Ensure that popups are deleted properly."
|
2017-02-08 01:58:11 -05:00
|
|
|
(let ((window (car args)))
|
|
|
|
(when (doom-popup-p window)
|
|
|
|
(with-selected-window window
|
|
|
|
(doom-popup-mode -1)
|
|
|
|
(when doom-popup-remember-history
|
|
|
|
(setq doom-popup-history (list (doom--popup-data window)))))))
|
|
|
|
(apply orig-fn args))
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-02-19 18:12:12 -05:00
|
|
|
(advice-add 'shackle-display-buffer :around 'doom*popup-init)
|
|
|
|
(advice-add 'balance-windows :around 'doom*popups-save)
|
|
|
|
(advice-add 'delete-window :around 'doom*delete-popup-window)
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
|
|
|
;;
|
|
|
|
;; Hacks
|
|
|
|
;;
|
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
(@after evil
|
2017-01-28 02:00:38 -05:00
|
|
|
(let ((map doom-popup-mode-map))
|
|
|
|
(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-top] 'ignore)
|
|
|
|
(define-key map [remap evil-window-move-far-left] 'ignore)
|
|
|
|
(define-key map [remap evil-window-move-far-right] 'ignore)
|
|
|
|
(define-key map [remap evil-window-split] 'ignore)
|
|
|
|
(define-key map [remap evil-window-vsplit] 'ignore)
|
|
|
|
(define-key map [remap evil-force-normal-state] 'doom/popup-close-maybe))
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
;; Make evil-mode cooperate with popups
|
|
|
|
(advice-add 'evil-command-window :override 'doom*popup-evil-command-window)
|
|
|
|
(advice-add 'evil-command-window-execute :override 'doom*popup-evil-command-window-execute)
|
|
|
|
|
2017-01-28 02:00:38 -05:00
|
|
|
(defun doom*popup-evil-command-window (hist cmd-key execute-fn)
|
2017-01-16 23:15:48 -05:00
|
|
|
"The evil command window has a mind of its own (uses `switch-to-buffer'). We
|
2017-01-28 02:00:38 -05:00
|
|
|
monkey patch it to use pop-to-buffer, and to remember the previous window."
|
2017-01-16 23:15:48 -05:00
|
|
|
(when (eq major-mode 'evil-command-window-mode)
|
|
|
|
(user-error "Cannot recursively open command line window"))
|
|
|
|
(dolist (win (window-list))
|
|
|
|
(when (equal (buffer-name (window-buffer win))
|
|
|
|
"*Command Line*")
|
|
|
|
(kill-buffer (window-buffer win))
|
|
|
|
(delete-window win)))
|
|
|
|
(setq evil-command-window-current-buffer (current-buffer))
|
|
|
|
(ignore-errors (kill-buffer "*Command Line*"))
|
|
|
|
(with-current-buffer (pop-to-buffer "*Command Line*")
|
|
|
|
(setq-local evil-command-window-execute-fn execute-fn)
|
|
|
|
(setq-local evil-command-window-cmd-key cmd-key)
|
|
|
|
(evil-command-window-mode)
|
|
|
|
(evil-command-window-insert-commands hist)))
|
2017-01-28 02:00:38 -05:00
|
|
|
|
|
|
|
(defun doom*popup-evil-command-window-execute ()
|
2017-02-08 17:56:27 -05:00
|
|
|
"Execute the command under the cursor in the appropriate buffer, rather than
|
|
|
|
the command buffer."
|
2017-01-28 02:00:38 -05:00
|
|
|
(interactive)
|
|
|
|
(let ((result (buffer-substring (line-beginning-position)
|
|
|
|
(line-end-position)))
|
|
|
|
(execute-fn evil-command-window-execute-fn)
|
|
|
|
(popup (selected-window)))
|
|
|
|
(select-window doom-popup-other-window)
|
|
|
|
(unless (equal evil-command-window-current-buffer (current-buffer))
|
|
|
|
(user-error "Originating buffer is no longer active"))
|
|
|
|
;; (kill-buffer "*Command Line*")
|
|
|
|
(doom/popup-close popup)
|
|
|
|
(funcall execute-fn result)
|
|
|
|
(setq evil-command-window-current-buffer nil)))
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
;; Don't mess with popups
|
|
|
|
(advice-add 'doom-evil-window-move :around 'doom*popups-save)
|
|
|
|
(advice-add 'evil-window-move-very-bottom :around 'doom*popups-save)
|
|
|
|
(advice-add 'evil-window-move-very-top :around 'doom*popups-save)
|
|
|
|
(advice-add 'evil-window-move-far-left :around 'doom*popups-save)
|
|
|
|
(advice-add 'evil-window-move-far-right :around 'doom*popups-save)
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-01-28 02:00:38 -05:00
|
|
|
;; Don't block moving to/from popup windows
|
|
|
|
(defun doom*ignore-window-parameters-in-popups (dir &optional arg window)
|
|
|
|
(window-in-direction
|
|
|
|
(cond ((eq dir 'up) 'above)
|
|
|
|
((eq dir 'down) 'below)
|
|
|
|
(t dir))
|
|
|
|
window t arg windmove-wrap-around t))
|
|
|
|
(advice-add 'windmove-find-other-window :override 'doom*ignore-window-parameters-in-popups))
|
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
|
2017-02-19 19:05:23 -05:00
|
|
|
(@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 redefined to set aside the popup before following a link.
|
|
|
|
(define-button-type 'help-function-def
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function (lambda (fun file)
|
|
|
|
(require 'find-func)
|
|
|
|
(when (eq file 'C-source)
|
|
|
|
(setq file (help-C-file-name (indirect-function fun) 'fun)))
|
|
|
|
(let ((location (find-function-search-for-symbol fun nil file)))
|
|
|
|
(doom/popup-close)
|
|
|
|
(switch-to-buffer (car location) nil t)
|
|
|
|
(if (cdr location)
|
2017-02-21 00:52:45 -05:00
|
|
|
(progn
|
|
|
|
(goto-char (cdr location))
|
|
|
|
(recenter))
|
2017-02-19 19:05:23 -05:00
|
|
|
(message "Unable to find location in file")))))
|
|
|
|
|
|
|
|
(define-button-type 'help-variable-def
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function (lambda (var &optional file)
|
|
|
|
(when (eq file 'C-source)
|
|
|
|
(setq file (help-C-file-name var 'var)))
|
|
|
|
(let ((location (find-variable-noselect var file)))
|
|
|
|
(doom/popup-close)
|
|
|
|
(switch-to-buffer (car location) nil t)
|
|
|
|
(if (cdr location)
|
2017-02-21 00:52:45 -05:00
|
|
|
(progn
|
|
|
|
(goto-char (cdr location))
|
|
|
|
(recenter))
|
2017-02-19 19:05:23 -05:00
|
|
|
(message "Unable to find location in file")))))
|
|
|
|
|
|
|
|
(define-button-type 'help-face-def
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function (lambda (fun file)
|
|
|
|
(require 'find-func)
|
|
|
|
(let ((location
|
|
|
|
(find-function-search-for-symbol fun 'defface file)))
|
|
|
|
(doom/popup-close)
|
|
|
|
(switch-to-buffer (car location) nil t)
|
|
|
|
(if (cdr location)
|
2017-02-21 00:52:45 -05:00
|
|
|
(progn
|
|
|
|
(goto-char (cdr location))
|
|
|
|
(recenter))
|
2017-02-19 19:05:23 -05:00
|
|
|
(message "Unable to find location in file"))))))
|
|
|
|
|
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
;; (@after magit
|
2017-01-28 02:00:38 -05:00
|
|
|
;; ;; Don't open files (from magit) within the magit popup
|
2017-02-08 17:56:27 -05:00
|
|
|
;; (advice-add 'magit-display-file-buffer-traditional :around 'doom*popups-save))
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
(@after neotree
|
2017-02-20 00:10:56 -05:00
|
|
|
(defun doom*popups-save-neotree (orig-fn &rest args)
|
2017-01-16 23:15:48 -05:00
|
|
|
"Prevents messing up the neotree buffer on window changes."
|
2017-02-20 00:10:56 -05:00
|
|
|
(let ((neo-p (and (featurep 'neotree)
|
|
|
|
(neo-global--window-exists-p))))
|
2017-01-16 23:15:48 -05:00
|
|
|
(when neo-p
|
2017-02-20 00:10:56 -05:00
|
|
|
(neotree-hide))
|
|
|
|
(unwind-protect (apply orig-fn args)
|
2017-01-16 23:15:48 -05:00
|
|
|
(when neo-p
|
|
|
|
(save-selected-window
|
|
|
|
(neotree-show))))))
|
|
|
|
|
|
|
|
;; Prevent neotree from interfering with popups
|
2017-02-20 00:10:56 -05:00
|
|
|
;; (advice-add 'shackle-display-buffer :around 'doom*popups-save-neotree)
|
2017-01-16 23:15:48 -05:00
|
|
|
;; Prevents messing up the neotree buffer on window changes
|
2017-02-20 00:10:56 -05:00
|
|
|
(advice-add '+evil-window-move :around 'doom*popups-save-neotree)
|
2017-02-08 17:56:27 -05:00
|
|
|
;; (advice-add 'doom-popup-buffer :around 'doom*popups-save-neotree)
|
2017-01-16 23:15:48 -05:00
|
|
|
;; Don't let neotree interfere with moving, splitting or rebalancing windows
|
2017-02-20 00:10:56 -05:00
|
|
|
;; (advice-add 'balance-windows :around 'doom*popups-save-neotree)
|
|
|
|
;; (advice-add 'split-window :around 'doom*popups-save-neotree)
|
|
|
|
;; (advice-add 'shackle-display-buffer :around 'doom*popups-save-neotree)
|
2017-02-08 17:56:27 -05:00
|
|
|
(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-far-left :around 'doom*popups-save-neotree)
|
|
|
|
(advice-add 'evil-window-move-far-right :around 'doom*popups-save-neotree))
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
(@add-hook org-load
|
2017-01-16 23:15:48 -05:00
|
|
|
;; Ensures org-src-edit yields control of its buffer to shackle.
|
2017-01-28 02:00:38 -05:00
|
|
|
(defun doom*org-src-switch-to-buffer (buffer context) (pop-to-buffer buffer))
|
|
|
|
(advice-add 'org-src-switch-to-buffer :override 'doom*org-src-switch-to-buffer)
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-01-28 02:00:38 -05:00
|
|
|
;; ...for org-todo, org-link and org-agenda popups
|
|
|
|
(defun doom*org-pop-to-buffer-same-window (&optional buffer-or-name norecord label)
|
2017-01-16 23:15:48 -05:00
|
|
|
"Pop to buffer specified by BUFFER-OR-NAME in the selected window."
|
|
|
|
(display-buffer buffer-or-name))
|
2017-01-28 02:00:38 -05:00
|
|
|
(advice-add 'org-pop-to-buffer-same-window :override 'doom*org-pop-to-buffer-same-window)
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-01-28 02:00:38 -05:00
|
|
|
(defun doom*org-switch-to-buffer-other-window (&rest args)
|
2017-01-16 23:15:48 -05:00
|
|
|
(car-safe
|
|
|
|
(mapc (lambda (b)
|
|
|
|
(let ((buf (if (stringp b) (get-buffer-create b) b)))
|
|
|
|
(pop-to-buffer buf t t)))
|
|
|
|
args)))
|
2017-01-28 02:00:38 -05:00
|
|
|
(advice-add 'org-switch-to-buffer-other-window :override 'doom*org-switch-to-buffer-other-window)
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2017-01-28 02:00:38 -05:00
|
|
|
(defun doom/popup-org-agenda-quit ()
|
|
|
|
"Necessary to finagle org-agenda into shackle popups & behave on quit."
|
2017-01-16 23:15:48 -05:00
|
|
|
(interactive)
|
|
|
|
(if org-agenda-columns-active
|
|
|
|
(org-columns-quit)
|
|
|
|
(let ((buf (current-buffer)))
|
|
|
|
(and (not (eq org-agenda-window-setup 'current-window))
|
|
|
|
(not (one-window-p))
|
|
|
|
(delete-window))
|
|
|
|
(kill-buffer buf)
|
|
|
|
(setq org-agenda-archives-mode nil
|
|
|
|
org-agenda-buffer nil))))
|
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
(@after org-agenda
|
|
|
|
(@after evil
|
2017-01-31 19:49:45 -05:00
|
|
|
(evil-define-key* 'motion org-agenda-mode-map
|
|
|
|
[escape] 'doom/popup-org-agenda-quit
|
|
|
|
(kbd "ESC") 'doom/popup-org-agenda-quit))
|
|
|
|
|
|
|
|
(let ((map org-agenda-mode-map))
|
|
|
|
(define-key map "q" 'doom/popup-org-agenda-quit)
|
|
|
|
(define-key map "Q" 'doom/popup-org-agenda-quit))))
|
2017-01-28 02:00:38 -05:00
|
|
|
|
2017-02-08 17:56:27 -05:00
|
|
|
|
2017-02-09 04:22:08 -05:00
|
|
|
(@after repl-toggle
|
|
|
|
(@add-hook doom-popup-close
|
2017-01-28 02:00:38 -05:00
|
|
|
(setq rtog/--last-buffer nil)))
|
2017-01-16 23:15:48 -05:00
|
|
|
|
|
|
|
(provide 'core-popups)
|
|
|
|
;;; core-popups.el ends here
|