When compiling everything I got this on Emacs startup: ``` Debugger entered--Lisp error: (void-variable +popup--display-buffer-alist) (setq +popup--old-display-buffer-alist display-buffer-alist display-buffer-alist +popup--display-buffer-alist window--sides-inhibit-check t) (cond (+popup-mode (add-hook 'doom-escape-hook (function +popup|close-on-escape) t) (add-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq +popup--old-display-buffer-alist display-buffer-alist display-buffer-alist +popup--display-buffer-alist window--sides-inhibit-check t) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (setq window-persistent-parameters (cons (cons prop 'writable) window-persistent-parameters)) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (t (remove-hook 'doom-escape-hook (function +popup|close-on-escape)) (remove-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq display-buffer-alist +popup--old-display-buffer-alist window--sides-inhibit-check nil) (+popup|cleanup-rules) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (delq (assq prop window-persistent-parameters) window-persistent-parameters) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (let ((last-message (current-message))) (setq-default +popup-mode (if (eq arg 'toggle) (not (default-value '+popup-mode)) (> (prefix-numeric-value arg) 0))) (cond (+popup-mode (add-hook 'doom-escape-hook (function +popup|close-on-escape) t) (add-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq +popup--old-display-buffer-alist display-buffer-alist display-buffer-alist +popup--display-buffer-alist window--sides-inhibit-check t) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (setq window-persistent-parameters (cons (cons prop 'writable) window-persistent-parameters)) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (t (remove-hook 'doom-escape-hook (function +popup|close-on-escape)) (remove-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq display-buffer-alist +popup--old-display-buffer-alist window--sides-inhibit-check nil) (+popup|cleanup-rules) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (delq (assq prop window-persistent-parameters) window-persistent-parameters) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (run-hooks '+popup-mode-hook (if (default-value '+popup-mode) '+popup-mode-on-hook '+popup-mode-off-hook)) (if (called-interactively-p 'any) (progn (customize-mark-as-set '+popup-mode) (if (and (current-message) (not (equal last-message (current-message)))) nil (let ((local "")) (message "+Popup mode %sabled%s" (if (default-value '+popup-mode) "en" "dis") local)))))) +popup-mode() doom-try-run-hook(+popup-mode) run-hook-wrapped(doom-try-run-hook +popup-mode) doom|init-ui() run-hooks(emacs-startup-hook term-setup-hook) #f(compiled-function () #<bytecode 0x46c615>)() normal-top-level() ``` Signed-off-by: Edwin Török <edwin@etorok.net> |
||
---|---|---|
.. | ||
autoload | ||
test | ||
+hacks.el | ||
config.el | ||
README.org |
:feature popup
This module provides a highly customizable popup window management system.
Not all windows are created equally. Some are less important. Some I want gone once they have served their purpose, like code output or a help buffer. Others I want to stick around, like a scratch buffer or org-capture popup.
More than that, popups ought to be be the second class citizens of my editor; spawned off to the side, discarded with the simple push of a button (Escape/C-g), and easily restored if I want to see them again. Of course, this system should clean up after itself and kill off buffers I mark as transient.
Table of Contents TOC
Configuration
set-popup-rules!
This module has one setting for defining your own rules for popups:
(set-popup-rules! &rest RULESETS)
RULESETS
consist of a function or regexp string that matches the buffer's name, and a list of settings. Seedisplay-buffer
's,display-window-parameters
's, and+popup-window-parameters
's documentation for what parameters are supported.
Rules are added to display-buffer-alist
, which instructs display-buffer
calls on how to set up windows for buffers that meet certain conditions.
The
switch-to-buffer
command (and itsswitch-to-buffer-*
variants) are not affected bydisplay-buffer-alist
.
Here are a couple example rules:
(set-popup-rules!
'(("^ \\*" :slot -1) ; fallback rule for special buffers
("^\\*" :select t)
("^\\*Completions" :slot -1 :transient 0)
("^\\*\\(?:scratch\\|Messages\\)" :transient t)
("^\\*Help" :slot -1 :size 0.2 :select t)
("^\\*doom:"
:size . 0.35 :select t :modeline t :quit t :transient t)))
Omitted parameters in a set-popup-rules!
will use the defaults set in
+popup-default-alist
and +popup-default-parameters
.
Disabling aggressive mode-line hiding in popups
There are two ways to go about this. You can turn on modelines by changing the
default 'modeline
window parameter in +popup-default-parameters
:
;; put in private/$USER/config.el
(map-put +popup-default-parameters 'modeline t)
This will ensure all popups have a modeline by default, but allows you to override this on a per-popup basis.
Alternatively, you can disable modeline-hiding entirely:
;; put in private/$USER/config.el
(remove-hook '+popup-buffer-mode-hook '+popup|set-modeline)
Appendix
Commands
+popup/other
(aliased toother-popup
, bound toC-x p
)+popup/toggle
+popup/close
+popup/close-all
+popup/toggle
+popup/restore
+popup/raise
Library
-
Functions
+popup-window-p WINDOW
+popup-buffer-p BUFFER
+popup-buffer BUFFER &optional ALIST
+popup-parameter PARAMETER &optional WINDOW
+popup-parameter-fn PARAMETER &optional WINDOW
+popup-windows
-
Macros
without-popups!
save-popups!
-
Hooks
+popup|adjust-fringes
+popup|set-modeline
+popup|close-on-escape
+popup|cleanup-rules
-
Minor modes
+popup-mode
+popup-buffer-mode
Hacks
help-mode
has been advised to follow file links in the buffer you were in before entering the popup, rather than in a new window.wgrep
buffers are advised to close themselves when aborting or committing changes.persp-mode
is advised to restore popup windows when loading a session from file.- Interactive calls to
windmove-*
commands (used byevil-window-*
commands) will ignore theno-other-window
window parameter, allowing you to switch to popup windows as if they're ordinary windows. balance-windows
has been advised to close popups while it does its business, then restores them afterwards.neotree
advisesbalance-windows
, which causes major slow-downs when paired with ourbalance-window
advice, so we removes neotree's advice.org-mode
is an ongoing (and huge) effort. It has a scorched-earth window management system I'm not fond of. ie. it kills all windows and monopolizes the frame. On top of that, it really likes to useswitch-to-buffer
for most of its buffer management, which completely bypassesdisplay-buffer-alist
.