updated readme to use set-popup-rules!

This commit is contained in:
hackeryarn 2018-08-21 07:16:44 -05:00
parent 9e08620350
commit 2c6ae455f9

View file

@ -14,38 +14,26 @@ system should clean up after itself and kill off buffers I mark as transient.
#+end_quote #+end_quote
* Table of Contents :TOC: * Table of Contents :TOC:
- [[#configuration][Configuration]] - [[Configuration][Configuration]]
- [[#the-popup-setting][The ~:popup~ setting]] - [[~set-popup-rules!~][~set-popup-rules!~]]
- [[#disabling-aggressive-mode-line-hiding-in-popups][Disabling aggressive mode-line hiding in popups]] - [[Disabling aggressive mode-line hiding in popups][Disabling aggressive mode-line hiding in popups]]
- [[#appendix][Appendix]] - [[Appendix][Appendix]]
- [[#commands][Commands]] - [[Commands][Commands]]
- [[#library][Library]] - [[Library][Library]]
- [[#hacks][Hacks]] - [[Hacks][Hacks]]
* Configuration * Configuration
** The ~:popup~ setting ** ~set-popup-rules!~
This module has one setting for defining your own rules for popups: This module has one setting for defining your own rules for popups:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(set! :popup CONDITION &optional ALIST PARAMETERS) (set-popup-rules! &rest RULESETS)
#+END_SRC #+END_SRC
+ ~CONDITION~ can be a function or regexp string. If the function returns + ~RULESETS~ consist of a function or regexp string that matches the buffer's
non-nil, or the regexp string matches the buffer's name, it will be opened in name, and a list of settings. See ~display-buffer~'s,
a popup window. ~display-window-parameters~'s, and ~+popup-window-parameters~'s documentation
+ ~ALIST~ dictates the characteristics of the popup, such as what side to spawn for what parameters are supported.
it on and what size to make it. See ~display-buffer~'s documentation to see
what parameters are supported.
This supports one custom parameter: ~size~, which will map to ~window-width~
or ~window-height~ depending on what ~side~ you (or the defaults) specify.
+ ~PARAMETERS~ dictate what window parameters are set on the popup window. See
~+popup-window-parameters~'s documentation and the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Parameters.html#Window-Parameters][Window Parameters section
of the Emacs manual]] for what parameters are supported.
This supports four custom parameters: =transient=, =quit=, =select= and
=modeline=. For details on these, look at the documentation for
~+popup-window-parameters.~
Rules are added to ~display-buffer-alist~, which instructs ~display-buffer~ Rules are added to ~display-buffer-alist~, which instructs ~display-buffer~
calls on how to set up windows for buffers that meet certain conditions. calls on how to set up windows for buffers that meet certain conditions.
@ -58,19 +46,17 @@ affected by ~display-buffer-alist~.
Here are a couple example rules: Here are a couple example rules:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(set! :popup "^ \\*" '((slot . -1))) ; fallback rule for special buffers (set-popup-rules!
(set! :popup "^\\*" nil '((select . t))) '(("^ \\*" :slot -1) ; fallback rule for special buffers
(set! :popup "^\\*Completions" '((slot . -1)) '((transient . 0))) ("^\\*" :select t)
(set! :popup "^\\*\\(?:scratch\\|Messages\\)" nil '((transient))) ("^\\*Completions" :slot -1 :transient 0)
(set! :popup "^\\*Help" ("^\\*\\(?:scratch\\|Messages\\)" :transient t)
'((slot . -1) (size . 0.2)) ("^\\*Help" :slot -1 :size 0.2 :select t)
'((select . t))) ("^\\*doom:"
(set! :popup "^\\*doom:" :size . 0.35 :select t :modeline t :quit t :transient t)))
'((size . 0.35))
'((select . t) (modeline . t) (quit) (transient)))
#+END_SRC #+END_SRC
Omitted parameters in a ~:popup~ rule will use the defaults set in Omitted parameters in a ~set-popup-rules!~ will use the defaults set in
~+popup-default-alist~ and ~+popup-default-parameters~. ~+popup-default-alist~ and ~+popup-default-parameters~.
** Disabling aggressive mode-line hiding in popups ** Disabling aggressive mode-line hiding in popups