core-popups: add :autokill popup property; update popup rules
This commit is contained in:
parent
0a0f2adb95
commit
f1b2c18476
2 changed files with 23 additions and 17 deletions
|
@ -49,25 +49,25 @@
|
||||||
:init
|
:init
|
||||||
(setq shackle-default-alignment 'below
|
(setq shackle-default-alignment 'below
|
||||||
;;; Baseline popup-window rules
|
;;; Baseline popup-window rules
|
||||||
;; :noesc and :modeline are custom settings and are not part of shackle. See
|
;; :noesc, :modeline and :autokill are custom settings and are not part
|
||||||
;; `doom*popup-init' and `doom-popup-buffer' for how they're used.
|
;; of shackle. See `doom*popup-init' and `doom-popup-buffer' for how
|
||||||
|
;; they're used.
|
||||||
shackle-rules
|
shackle-rules
|
||||||
'(("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t)
|
'(("^ ?\\*doom:.+\\*$" :size 40 :modeline t :regexp t)
|
||||||
("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t)
|
("^ ?\\*doom .+\\*$" :size 30 :noselect t :regexp t)
|
||||||
("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t)
|
("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t :autokill t)
|
||||||
("*esup*" :size 0.4 :noselect t :noesc t)
|
("*minor-modes*" :size 0.5 :noselect t :autokill t)
|
||||||
("*minor-modes*" :size 0.5 :noselect t)
|
("*eval*" :size 16 :noselect t :autokill t)
|
||||||
("*eval*" :size 16 :noselect t)
|
("*Pp Eval Output*" :size 0.3 :autokill t)
|
||||||
("*Pp Eval Output*" :size 0.3)
|
|
||||||
("*Apropos*" :size 0.3)
|
("*Apropos*" :size 0.3)
|
||||||
("*Backtrace*" :size 25 :noselect t)
|
("*Backtrace*" :size 25 :noselect t)
|
||||||
("*Help*" :size 16)
|
("*Help*" :size 16 :autokill t)
|
||||||
("*Messages*" :size 10)
|
("*Messages*" :size 10)
|
||||||
("*Warnings*" :size 10 :noselect t)
|
("*Warnings*" :size 10 :noselect t :autokill t)
|
||||||
("*command-log*" :size 28 :noselect t :align right)
|
("*command-log*" :size 28 :noselect t :align right)
|
||||||
("*Shell Command Output*" :size 20 :noselect t)
|
("*Shell Command Output*" :size 20 :noselect t :autokill t)
|
||||||
("*Occur*" :size 30 :noselect t)
|
("*Occur*" :size 25 :noselect t :autokill t)
|
||||||
(compilation-mode :size 15 :noselect t :noesc t)
|
(compilation-mode :size 15 :noselect t :noesc t :autokill t)
|
||||||
(ivy-occur-grep-mode :size 25 :noesc t)
|
(ivy-occur-grep-mode :size 25 :noesc t)
|
||||||
(eww-mode :size 30)
|
(eww-mode :size 30)
|
||||||
(comint-mode :noesc t)
|
(comint-mode :noesc t)
|
||||||
|
@ -98,7 +98,8 @@ for the obvious :align t on every rule."
|
||||||
;; custom parameters. Allows `persp-mode' to remember popup states.
|
;; custom parameters. Allows `persp-mode' to remember popup states.
|
||||||
(nconc window-persistent-parameters
|
(nconc window-persistent-parameters
|
||||||
'((popup . writable)
|
'((popup . writable)
|
||||||
(noesc . writable)))
|
(noesc . writable)
|
||||||
|
(autokill . writable)))
|
||||||
|
|
||||||
|
|
||||||
(define-minor-mode doom-popup-mode
|
(define-minor-mode doom-popup-mode
|
||||||
|
@ -132,7 +133,9 @@ enables `doom-popup-mode'."
|
||||||
(append `((popup . ,plist)
|
(append `((popup . ,plist)
|
||||||
(no-other-window . ,t))
|
(no-other-window . ,t))
|
||||||
(when (plist-get plist :noesc)
|
(when (plist-get plist :noesc)
|
||||||
`((noesc . ,t)))))
|
`((noesc . ,t)))
|
||||||
|
(when (plist-get plist :autokill)
|
||||||
|
`((autokill . ,t)))))
|
||||||
(with-selected-window window
|
(with-selected-window window
|
||||||
(unless (eq plist t)
|
(unless (eq plist t)
|
||||||
(setq-local doom-popup-rules plist))
|
(setq-local doom-popup-rules plist))
|
||||||
|
@ -162,13 +165,16 @@ prevent popups from messaging up the UI (or vice versa)."
|
||||||
(select-window origin)))))))
|
(select-window origin)))))))
|
||||||
|
|
||||||
(defun doom*delete-popup-window (orig-fn &rest args)
|
(defun doom*delete-popup-window (orig-fn &rest args)
|
||||||
"Ensure that popups are deleted properly."
|
"Ensure that popups are deleted properly, and killed if they have :autokill
|
||||||
|
properties."
|
||||||
(let ((window (car args)))
|
(let ((window (car args)))
|
||||||
(when (doom-popup-p window)
|
(when (doom-popup-p window)
|
||||||
(with-selected-window window
|
(with-selected-window window
|
||||||
(doom-popup-mode -1)
|
(doom-popup-mode -1)
|
||||||
(when doom-popup-remember-history
|
(when doom-popup-remember-history
|
||||||
(setq doom-popup-history (list (doom--popup-data window)))))))
|
(setq doom-popup-history (list (doom--popup-data window))))
|
||||||
|
(when (window-parameter window 'autokill)
|
||||||
|
(kill-buffer (window-buffer window))))))
|
||||||
(apply orig-fn args))
|
(apply orig-fn args))
|
||||||
|
|
||||||
(advice-add 'shackle-display-buffer :around 'doom*popup-init)
|
(advice-add 'shackle-display-buffer :around 'doom*popup-init)
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
:config
|
:config
|
||||||
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
||||||
|
|
||||||
(@set :popup "^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t)
|
(@set :popup "^\\*ivy-occur counsel-ag" :size 25 :regexp t :autokill t)
|
||||||
|
|
||||||
(require 'counsel-projectile)
|
(require 'counsel-projectile)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue