General, minor refactor
This commit is contained in:
parent
86ff43c6cb
commit
546ca0e313
3 changed files with 30 additions and 31 deletions
|
@ -31,10 +31,9 @@ this popup, just the specified properties. Returns the new popup window."
|
||||||
(defun doom-popup-switch-to-buffer (buffer)
|
(defun doom-popup-switch-to-buffer (buffer)
|
||||||
"Switch the current (or closest) pop-up window to BUFFER."
|
"Switch the current (or closest) pop-up window to BUFFER."
|
||||||
(unless (doom-popup-p)
|
(unless (doom-popup-p)
|
||||||
(let ((popups (doom-popup-windows)))
|
(if-let (popups (doom-popup-windows))
|
||||||
(unless popups
|
(select-window (car popups))
|
||||||
(error "No popups to switch"))
|
(error "No popups to switch to")))
|
||||||
(select-window (car popups))))
|
|
||||||
(set-window-dedicated-p nil nil)
|
(set-window-dedicated-p nil nil)
|
||||||
(switch-to-buffer buffer nil t)
|
(switch-to-buffer buffer nil t)
|
||||||
(prog1 (selected-window)
|
(prog1 (selected-window)
|
||||||
|
|
|
@ -213,11 +213,10 @@ Body forms can access the hook's arguments through the let-bound variable
|
||||||
|
|
||||||
|
|
||||||
;; I'm a fan of concise, hassle-free front-facing configuration. Rather than
|
;; I'm a fan of concise, hassle-free front-facing configuration. Rather than
|
||||||
;; littering my config with `after!' blocks, these two macros offer a faster and
|
;; littering my config with `after!' blocks, and checking if features and
|
||||||
;; more robust alternative. The motivation: to facilitate concise cross-module
|
;; modules are loaded before every line of config, I wrote `set!' as a more
|
||||||
;; configuration.
|
;; robust alternative. If a setting doesn't exist at run-time, the `set!' call
|
||||||
;;
|
;; is ignored. It also benefits from byte-compilation.
|
||||||
;; It also benefits from byte-compilation.
|
|
||||||
(defvar doom-settings nil)
|
(defvar doom-settings nil)
|
||||||
|
|
||||||
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)
|
(defmacro def-setting! (keyword arglist &optional docstring &rest forms)
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
"A list of popups that were last closed. Used by `doom/popup-restore' and
|
"A list of popups that were last closed. Used by `doom/popup-restore' and
|
||||||
`doom*popups-save'.")
|
`doom*popups-save'.")
|
||||||
|
|
||||||
(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
|
(defvar doom-popup-other-window nil
|
||||||
"The last window selected before a popup was opened.")
|
"The last window selected before a popup was opened.")
|
||||||
|
|
||||||
|
@ -40,9 +36,14 @@ edit this directly.")
|
||||||
"A list of window parameters that are set (and cleared) when `doom-popup-mode
|
"A list of window parameters that are set (and cleared) when `doom-popup-mode
|
||||||
is enabled/disabled.'")
|
is enabled/disabled.'")
|
||||||
|
|
||||||
|
;; let-vars
|
||||||
|
(defvar doom-popup-remember-history t
|
||||||
|
"Don't modify this directly. If non-nil, DOOM will remember the last popup(s)
|
||||||
|
that were open in `doom-popup-history'.")
|
||||||
|
|
||||||
(defvar doom-popup-inhibit-autokill nil
|
(defvar doom-popup-inhibit-autokill nil
|
||||||
"Don't set this directly. Let-bind it. When it is non-nil, no buffers will be
|
"Don't modify this directly. When it is non-nil, no buffers will be killed
|
||||||
killed when their associated popup windows are closed, despite their :autokill
|
when their associated popup windows are closed, despite their :autokill
|
||||||
property.")
|
property.")
|
||||||
|
|
||||||
(def-setting! :popup (&rest rules)
|
(def-setting! :popup (&rest rules)
|
||||||
|
@ -51,8 +52,8 @@ property.")
|
||||||
Several custom properties have been added that are not part of shackle, but are
|
Several custom properties have been added that are not part of shackle, but are
|
||||||
recognized by DOOM's popup system. They are:
|
recognized by DOOM's popup system. They are:
|
||||||
|
|
||||||
:noesc If non-nil, pressing ESC *inside* the popup will close it. Used by
|
:noesc If non-nil, the popup won't be closed if you press ESC from *inside*
|
||||||
`doom/popup-close-maybe'.
|
its window. Used by `doom/popup-close-maybe'.
|
||||||
|
|
||||||
:modeline By default, mode-lines are hidden in popups unless this is non-nil. If
|
:modeline By default, mode-lines are hidden in popups unless this is non-nil. If
|
||||||
it is a symbol, it'll use `doom-modeline' to fetch a modeline config
|
it is a symbol, it'll use `doom-modeline' to fetch a modeline config
|
||||||
|
@ -139,16 +140,16 @@ for :align t on every rule."
|
||||||
|
|
||||||
(defvar doom-popup-mode-map
|
(defvar doom-popup-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map [escape] 'doom/popup-close-maybe)
|
(define-key map [escape] #'doom/popup-close-maybe)
|
||||||
(define-key map (kbd "ESC") 'doom/popup-close-maybe)
|
(define-key map (kbd "ESC") #'doom/popup-close-maybe)
|
||||||
(define-key map [remap doom-kill-buffer] 'kill-this-buffer)
|
(define-key map [remap doom-kill-buffer] #'kill-this-buffer)
|
||||||
(define-key map [remap doom/kill-this-buffer] 'kill-this-buffer)
|
(define-key map [remap doom/kill-this-buffer] #'kill-this-buffer)
|
||||||
(define-key map [remap split-window-right] 'ignore)
|
(define-key map [remap split-window-right] #'ignore)
|
||||||
(define-key map [remap split-window-below] 'ignore)
|
(define-key map [remap split-window-below] #'ignore)
|
||||||
(define-key map [remap split-window-horizontally] 'ignore)
|
(define-key map [remap split-window-horizontally] #'ignore)
|
||||||
(define-key map [remap split-window-vertically] 'ignore)
|
(define-key map [remap split-window-vertically] #'ignore)
|
||||||
(define-key map [remap mouse-split-window-horizontally] 'ignore)
|
(define-key map [remap mouse-split-window-horizontally] #'ignore)
|
||||||
(define-key map [remap mouse-split-window-vertically] 'ignore)
|
(define-key map [remap mouse-split-window-vertically] #'ignore)
|
||||||
map)
|
map)
|
||||||
"Active keymap in popup windows.")
|
"Active keymap in popup windows.")
|
||||||
|
|
||||||
|
@ -390,10 +391,10 @@ the command buffer."
|
||||||
|
|
||||||
|
|
||||||
(after! helm
|
(after! helm
|
||||||
;; Helm tries to clean up after itself, but shackle has already done this.
|
;; Helm tries to clean up after itself, but shackle has already done this,
|
||||||
;; This fixes that. To reproduce, add a helm rule in `shackle-rules', open two
|
;; causing problems. This fixes that. To reproduce, add a helm rule in
|
||||||
;; splits side-by-side, move to the buffer on the right and invoke helm. It
|
;; `shackle-rules', open two splits side-by-side, move to the buffer on the
|
||||||
;; will close all but the left-most buffer.
|
;; right and invoke helm. It will close all but the left-most buffer.
|
||||||
(setq-default helm-reuse-last-window-split-state t
|
(setq-default helm-reuse-last-window-split-state t
|
||||||
helm-split-window-in-side-p t)
|
helm-split-window-in-side-p t)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue