2019-03-20 00:55:27 -04:00
|
|
|
#+TITLE: :ui popup
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
* Table of Contents :TOC:
|
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#module-flags][Module Flags]]
|
|
|
|
- [[#prerequisites][Prerequisites]]
|
|
|
|
- [[#configuration][Configuration]]
|
|
|
|
- [[#set-popup-rule-and-set-popup-rules][~set-popup-rule!~ and ~set-popup-rules!~]]
|
|
|
|
- [[#disabling-aggressive-mode-line-hiding-in-popups][Disabling aggressive mode-line hiding in popups]]
|
|
|
|
- [[#appendix][Appendix]]
|
|
|
|
- [[#commands][Commands]]
|
|
|
|
- [[#library][Library]]
|
|
|
|
- [[#hacks][Hacks]]
|
|
|
|
|
|
|
|
* Description
|
|
|
|
This module provides a customizable popup window management system.
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2018-01-06 23:49:58 -05:00
|
|
|
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.
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2018-01-06 23:49:58 -05:00
|
|
|
More than that, popups ought to be be the second class citizens of my editor;
|
2019-03-20 00:55:27 -04:00
|
|
|
spawned off to the side, discarded with the push of a button (e.g. =ESC= or
|
|
|
|
=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.
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
** Module Flags
|
|
|
|
+ =+all= Enables fallback rules to ensure all temporary/special buffers (whose
|
|
|
|
name begins with a space or asterix) are treated as popups.
|
|
|
|
+ =+defaults= Enables reasonable default popup rules for a variety of buffers.
|
|
|
|
|
|
|
|
* Prerequisites
|
|
|
|
This module has no external prerequisites.
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2018-01-06 23:49:58 -05:00
|
|
|
* Configuration
|
2019-03-20 00:55:27 -04:00
|
|
|
** ~set-popup-rule!~ and ~set-popup-rules!~
|
|
|
|
This module has two functions for defining your own rules for popups:
|
2018-01-06 23:49:58 -05:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2019-03-20 00:55:27 -04:00
|
|
|
(set-popup-rule! PREDICATE &key IGNORE ACTIONS SIDE SIZE WIDTH HEIGHT SLOT VSLOT TTL QUIT SELECT MODELINE AUTOSAVE PARAMETERS)
|
2018-08-21 07:16:44 -05:00
|
|
|
(set-popup-rules! &rest RULESETS)
|
2018-01-06 01:23:22 -05:00
|
|
|
#+END_SRC
|
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
~PREDICATE~ is a predicate function or regexp string to match against the
|
|
|
|
buffer's name. To see what the other keywords do, check out the documentation
|
|
|
|
for ~set-popup-rule!~ (=SPC h f set-popup-rule!=).
|
2018-01-06 23:49:58 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
#+begin_quote
|
2018-01-06 23:49:58 -05:00
|
|
|
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 its ~switch-to-buffer-*~ variants) are not
|
|
|
|
affected by ~display-buffer-alist~.
|
|
|
|
#+end_quote
|
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
e.g.
|
2018-01-06 23:49:58 -05:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-08-21 07:16:44 -05:00
|
|
|
(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)))
|
2018-01-06 01:23:22 -05:00
|
|
|
#+END_SRC
|
|
|
|
|
2018-08-21 07:16:44 -05:00
|
|
|
Omitted parameters in a ~set-popup-rules!~ will use the defaults set in
|
2019-03-20 00:55:27 -04:00
|
|
|
~+popup-defaults~.
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2018-01-06 23:49:58 -05:00
|
|
|
** Disabling aggressive mode-line hiding in popups
|
2019-03-20 00:55:27 -04:00
|
|
|
There are two ways to go about this.
|
2018-01-06 23:49:58 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
1. Turn on modelines by changing the ~:modeline~ property in ~+popup-defaults~:
|
2018-01-06 01:23:22 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
;; put in private/$USER/config.el
|
|
|
|
(map-put +popup-defaults :modeline t)
|
|
|
|
#+END_SRC
|
2018-01-06 23:49:58 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
This will ensure all popups have a modeline /by default/, but allows you to
|
|
|
|
override this on a per-popup basis.
|
2018-01-06 23:49:58 -05:00
|
|
|
|
2019-03-20 00:55:27 -04:00
|
|
|
2. Disable modeline-hiding entirely:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
;; in ~/.doom.d/config.el
|
|
|
|
(remove-hook '+popup-buffer-mode-hook #'+popup|set-modeline-on-enable)
|
|
|
|
#+END_SRC
|
2018-01-06 01:23:22 -05:00
|
|
|
|
|
|
|
* Appendix
|
|
|
|
** Commands
|
2018-01-06 23:49:58 -05:00
|
|
|
+ ~+popup/other~ (aliased to ~other-popup~, bound to ~C-x p~)
|
|
|
|
+ ~+popup/toggle~
|
|
|
|
+ ~+popup/close~
|
|
|
|
+ ~+popup/close-all~
|
|
|
|
+ ~+popup/toggle~
|
|
|
|
+ ~+popup/restore~
|
|
|
|
+ ~+popup/raise~
|
2018-01-07 05:45:54 -05:00
|
|
|
** Library
|
|
|
|
+ Functions
|
2018-01-07 21:52:54 -05:00
|
|
|
+ ~+popup-window-p WINDOW~
|
|
|
|
+ ~+popup-buffer-p BUFFER~
|
2018-01-07 05:45:54 -05:00
|
|
|
+ ~+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~
|
2018-01-06 01:23:22 -05:00
|
|
|
** Hacks
|
2018-01-06 23:49:58 -05:00
|
|
|
+ =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 by ~evil-window-*~ commands)
|
|
|
|
will ignore the ~no-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= advises ~balance-windows~, which causes major slow-downs when paired
|
|
|
|
with our ~balance-window~ advice, so we removes neotree's advice.
|
2018-01-07 05:45:54 -05:00
|
|
|
+ =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 use ~switch-to-buffer~ for
|
|
|
|
most of its buffer management, which completely bypasses
|
|
|
|
~display-buffer-alist~.
|