tweak: add more robust popup rules
This commit is contained in:
parent
c3e507524a
commit
12868aaaef
1 changed files with 21 additions and 3 deletions
24
config.org
24
config.org
|
|
@ -866,11 +866,27 @@ Doom also includes its own default popup rules. Most of these are inoffensive, b
|
||||||
"Remove the popup rule with the predicate PREDICATE and replace it with this one.
|
"Remove the popup rule with the predicate PREDICATE and replace it with this one.
|
||||||
|
|
||||||
See `set-popup-rule!' for the arguments this function should take."
|
See `set-popup-rule!' for the arguments this function should take."
|
||||||
|
(declare (indent defun))
|
||||||
(setq +popup--display-buffer-alist
|
(setq +popup--display-buffer-alist
|
||||||
(assoc-delete-all predicate +popup--display-buffer-alist))
|
(assoc-delete-all predicate +popup--display-buffer-alist))
|
||||||
(apply #'set-popup-rule! predicate args))
|
(apply #'set-popup-rule! predicate args))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Sometimes I want to set the size of a popup window, but allow the window to shrink if it is too big for its contents. The sizing function Doom provides for this purpose, ~+popup-shrink-to-fit~, does not allow the user to specify an initial size, it only does the shrinking.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun ~/popup--shrink-to-fit (height &optional window)
|
||||||
|
(let* ((new-height
|
||||||
|
(if (integerp height) height
|
||||||
|
(round (* (window-total-height (frame-root-window window))
|
||||||
|
height)))))
|
||||||
|
(fit-window-to-buffer window new-height)
|
||||||
|
(+popup-shrink-to-fit window)))
|
||||||
|
|
||||||
|
(defun ~/popup-shrink-to-fit (height)
|
||||||
|
(apply-partially #'~/popup--shrink-to-fit height))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Doom Modules
|
* Doom Modules
|
||||||
|
|
||||||
One of Doom Emacs's most useful features is its modular configuration system, allowing configuration code to be sectioned into modules that can be enabled or customized individually. Doom provides a full suite of prewritten modules to enable.
|
One of Doom Emacs's most useful features is its modular configuration system, allowing configuration code to be sectioned into modules that can be enabled or customized individually. Doom provides a full suite of prewritten modules to enable.
|
||||||
|
|
@ -2777,7 +2793,8 @@ I use the standard Unix-style password management system, [[https://www.password
|
||||||
|
|
||||||
;; Move to right side
|
;; Move to right side
|
||||||
(after! pass
|
(after! pass
|
||||||
(replace-popup-rule! "^\\*Password-Store" :side 'right :size 0.25 :quit nil))
|
(replace-popup-rule! "^\\*Password-Store"
|
||||||
|
:side 'right :size 0.25 :quit nil))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Tweaks
|
*** Tweaks
|
||||||
|
|
@ -2818,7 +2835,7 @@ When visiting a password file, the file's buffer replaces the pass buffer, which
|
||||||
|
|
||||||
;; The popup rule indirectly triggered by above
|
;; The popup rule indirectly triggered by above
|
||||||
(set-popup-rule! '(derived-mode . pass-view-mode)
|
(set-popup-rule! '(derived-mode . pass-view-mode)
|
||||||
:side 'bottom :size 8 :quit t :modeline t)
|
:side 'bottom :size 8 :quit t :ttl t :modeline t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Asking for confirmation on ~pass-quit~ is ridiculous, seeing as it doesn't actually do anything sensitive or permanent. The other instances of confirmation are comparatively much more important, so I won't touch those.
|
Asking for confirmation on ~pass-quit~ is ridiculous, seeing as it doesn't actually do anything sensitive or permanent. The other instances of confirmation are comparatively much more important, so I won't touch those.
|
||||||
|
|
@ -4406,7 +4423,8 @@ Doom by default sets Eglot's help window (used for documentation and the like) w
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(after! eglot
|
(after! eglot
|
||||||
(replace-popup-rule! "^\\*eglot-help" :size 0.4 :quit t :select t))
|
(replace-popup-rule! "^\\*eglot-help"
|
||||||
|
:size (~/popup-shrink-to-fit 0.4) :quit t :select nil))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Server Booster
|
*** Server Booster
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue