Refactor + rearrange popup rules
This commit is contained in:
parent
d0cfb12689
commit
dbceec4149
3 changed files with 45 additions and 42 deletions
|
@ -46,46 +46,41 @@ is enabled/disabled.'")
|
||||||
(def-package! shackle :demand t
|
(def-package! shackle :demand t
|
||||||
:init
|
:init
|
||||||
(setq shackle-default-alignment 'below
|
(setq shackle-default-alignment 'below
|
||||||
|
shackle-default-size 10
|
||||||
;;; Baseline popup-window rules
|
;;; Baseline popup-window rules
|
||||||
;; Several custom properties have been added that are not part of
|
;; Several custom properties have been added that are not part of
|
||||||
;; shackle and are used by doom's popup system. They are:
|
;; shackle and are used by doom's popup system. They are:
|
||||||
;;
|
;;
|
||||||
;; :noesc Determines if pressing ESC *inside* the popup should
|
;; :noesc If non-nil, pressing ESC *inside* the popup will close it.
|
||||||
;; close it. Used by `doom/popup-close-maybe'.
|
;; Used by `doom/popup-close-maybe'.
|
||||||
;; :modeline By default, mode-lines are hidden in popups unless this
|
;; :modeline By default, mode-lines are hidden in popups unless this
|
||||||
;; is non-nil. If it is a symbol, it'll use `doom-modeline'
|
;; is non-nil. If it is a symbol, it'll use `doom-modeline'
|
||||||
;; to fetch a modeline config. Set in `doom-popup-mode'.
|
;; to fetch a modeline config (in `doom-popup-mode').
|
||||||
;; :autokill If non-nil, the buffer in these popups will be killed
|
;; :autokill If non-nil, the popup's buffer will be killed when the
|
||||||
;; when their popup is closed. Used by
|
;; popup is closed. Used by `doom*delete-popup-window'.
|
||||||
;; `doom*delete-popup-window'. NOTE This will render
|
;; NOTE `doom/popup-restore' can't restore non-file popups
|
||||||
;; `doom/popup-restore' unusable for this buffer.
|
;; that have an :autokill property.
|
||||||
;; :autoclose If non-nil, close popup if ESC is pressed from any buffer.
|
;; :autoclose If non-nil, close popup if ESC is pressed from outside
|
||||||
|
;; the popup window.
|
||||||
shackle-rules
|
shackle-rules
|
||||||
'(("^ ?\\*doom:.+\\*$" :size 25 :modeline minimal :regexp t :noesc t)
|
'(("^\\*ftp " :size 8 :noselect t :autokill t :noesc t)
|
||||||
("^ ?\\*doom .+\\*$" :size 10 :noselect t :regexp t)
|
;; doom
|
||||||
("^ *doom message*" :size 10 :noselect t :autokill t)
|
("^\\*doom:" :regexp t :size 0.35 :noesc t :select t)
|
||||||
("*Metahelp*" :size 0.5 :autokill t :autoclose t)
|
("^\\*doom " :regexp t :noselect t :autokill t :autoclose t)
|
||||||
("^\\*.+-Profiler-Report .+\\*$" :size 0.3 :regexp t :autokill t)
|
;; built-in (emacs)
|
||||||
("*minor-modes*" :size 0.5 :noselect t :autokill t)
|
(Buffer-menu-mode :size 20 :autokill t)
|
||||||
("*eval*" :size 16 :noselect t :autokill t :autoclose t)
|
(apropos-mode :size 0.3 :autokill t :autoclose t)
|
||||||
("*Pp Eval Output*" :size 16 :noselect t :autokill t :autoclose t)
|
(comint-mode :noesc t)
|
||||||
("*Apropos*" :size 0.3)
|
(grep-mode :size 25 :noselect t :autokill t)
|
||||||
("*Backtrace*" :size 25 :noselect t)
|
(special-mode :size 12 :noselect t :autokill t)
|
||||||
("*Buffer List*" :size 20 :autokill t)
|
(tabulated-list-mode :noesc t)
|
||||||
("*Help*" :size 16)
|
(profiler-report-mode :size 0.3 :regexp t :autokill t)
|
||||||
("*Messages*" :size 10 :noselect t)
|
("*Backtrace*" :size 20 :noselect t)
|
||||||
("*Warnings*" :size 10 :noselect t :autokill t)
|
("*Warnings*" :noselect t :autokill t)
|
||||||
("*command-log*" :size 28 :noselect t :align right)
|
("*Help*" :size 0.3)
|
||||||
("*Shell Command Output*" :size 20 :noselect t :autokill t)
|
("^\\*.*Shell Command.*\\*$" :regexp t :size 20 :noselect t :autokill t)
|
||||||
("*Occur*" :size 25 :noselect t :autokill t)
|
("^\\*" :regexp t :noselect t)
|
||||||
("*Error*" :size 10 :noselect t :autokill t :autoclose t)
|
("^ \\*" :regexp t :size 12 :noselect t :autokill t :autoclose t)))
|
||||||
("*Process List*" :size 10 :noselect t :autokill t :autoclose t)
|
|
||||||
("*Keys*" :size 10 :noselect t)
|
|
||||||
("^\\*ftp " :size 8 :noselect t :autokill t :noesc t)
|
|
||||||
(compilation-mode :size 15 :noselect t)
|
|
||||||
(eww-mode :size 30)
|
|
||||||
(comint-mode :noesc t)
|
|
||||||
(tabulated-list-mode :noesc t)))
|
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(if (display-graphic-p)
|
(if (display-graphic-p)
|
||||||
|
@ -138,6 +133,10 @@ for :align t on every rule."
|
||||||
:init-value nil
|
:init-value nil
|
||||||
:keymap doom-popup-mode-map
|
:keymap doom-popup-mode-map
|
||||||
(let ((window (selected-window)))
|
(let ((window (selected-window)))
|
||||||
|
;; If `doom-popup-rules' isn't set for some reason, try to set it
|
||||||
|
(when-let (plist (and (not doom-popup-rules)
|
||||||
|
(window-parameter window 'popup)))
|
||||||
|
(setq-local doom-popup-rules (window-parameter window 'popup)))
|
||||||
;; Ensure that buffer-opening functions/commands (like
|
;; Ensure that buffer-opening functions/commands (like
|
||||||
;; `switch-to-buffer-other-window' won't use this window).
|
;; `switch-to-buffer-other-window' won't use this window).
|
||||||
(set-window-parameter window 'no-other-window doom-popup-mode)
|
(set-window-parameter window 'no-other-window doom-popup-mode)
|
||||||
|
@ -188,13 +187,14 @@ for :align t on every rule."
|
||||||
and setting `doom-popup-rules' within it. Returns the window."
|
and setting `doom-popup-rules' within it. Returns the window."
|
||||||
(unless (doom-popup-p)
|
(unless (doom-popup-p)
|
||||||
(setq doom-popup-other-window (selected-window)))
|
(setq doom-popup-other-window (selected-window)))
|
||||||
(let ((plist (or (nth 2 args)
|
(let* ((plist (or (nth 2 args)
|
||||||
(cond ((windowp (car args))
|
(cond ((windowp (car args))
|
||||||
(shackle-match (window-buffer (car args))))
|
(shackle-match (window-buffer (car args))))
|
||||||
((bufferp (car args))
|
((bufferp (car args))
|
||||||
(shackle-match (car args))))))
|
(shackle-match (car args))))))
|
||||||
(buffer (get-buffer (car args)))
|
(buffer (get-buffer (car args)))
|
||||||
window)
|
(window-min-height (if (plist-get plist :modeline) 4 2))
|
||||||
|
window)
|
||||||
(when (and (doom-real-buffer-p buffer)
|
(when (and (doom-real-buffer-p buffer)
|
||||||
(get-buffer-window-list buffer nil t))
|
(get-buffer-window-list buffer nil t))
|
||||||
(setq plist (append (list :autokill t) plist))
|
(setq plist (append (list :autokill t) plist))
|
||||||
|
|
|
@ -90,7 +90,7 @@ session)."
|
||||||
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
||||||
|
|
||||||
;; Configure `counsel-rg', `counsel-ag' & `counsel-pt'
|
;; Configure `counsel-rg', `counsel-ag' & `counsel-pt'
|
||||||
(set! :popup "^\\*ivy-occur counsel-[arp]g" :size (+ 2 ivy-height) :regexp t :autokill t)
|
(set! :popup 'ivy-occur-grep-mode :size (+ 2 ivy-height) :regexp t :autokill t)
|
||||||
|
|
||||||
(dolist (cmd '(counsel-ag counsel-rg counsel-pt))
|
(dolist (cmd '(counsel-ag counsel-rg counsel-pt))
|
||||||
(ivy-add-actions
|
(ivy-add-actions
|
||||||
|
|
|
@ -92,7 +92,10 @@ invokes the repl. Takes the same arguements as `rtog/add-repl'."
|
||||||
(add-hook! 'quickrun--mode-hook (linum-mode +1))
|
(add-hook! 'quickrun--mode-hook (linum-mode +1))
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(set! :popup "*quickrun*" :size 10 :noesc t :autokill t :autoclose t)
|
(set! :popup
|
||||||
|
'("*quickrun*" :size 10 :noesc t :autokill t :autoclose t)
|
||||||
|
'("*eval*" :size 12 :noselect t :autokill t :autoclose t)
|
||||||
|
'("*Pp Eval Output*" :size 12 :noselect t :autokill t :autoclose t))
|
||||||
|
|
||||||
(defun +eval*quickrun-auto-close (&rest _)
|
(defun +eval*quickrun-auto-close (&rest _)
|
||||||
"Allows us to silently re-run quickrun from within the quickrun buffer."
|
"Allows us to silently re-run quickrun from within the quickrun buffer."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue