Give popups a small margin

To make up for lack of fringe.
This commit is contained in:
Henrik Lissner 2018-06-17 02:01:11 +02:00
parent 9b5a219373
commit c3988a8298
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 12 additions and 3 deletions

View file

@ -263,6 +263,14 @@ disabled."
(let ((f (if (bound-and-true-p +popup-buffer-mode) 0))) (let ((f (if (bound-and-true-p +popup-buffer-mode) 0)))
(set-window-fringes nil f f fringes-outside-margins))) (set-window-fringes nil f f fringes-outside-margins)))
;;;###autoload
(defun +popup|adjust-margins ()
"Creates padding for the popup window determined by `+popup-margin-width',
restoring it if `+popup-buffer-mode' is disabled."
(when +popup-margin-width
(let ((m (if (bound-and-true-p +popup-buffer-mode) +popup-margin-width)))
(set-window-margins nil m m))))
;;;###autoload ;;;###autoload
(defun +popup|set-modeline-on-enable () (defun +popup|set-modeline-on-enable ()
"Don't show modeline in popup windows without a `modeline' window-parameter. "Don't show modeline in popup windows without a `modeline' window-parameter.

View file

@ -94,9 +94,9 @@ a brief description of some native window parameters that Emacs uses:
(no-other-window . t)) (no-other-window . t))
"The default window parameters.") "The default window parameters.")
(defvar +popup-ttl 5 (defvar +popup-margin-width 1
"The default time-to-live for transient buffers whose popup buffers have been "Size of the margins to give popup windows. Set this to nil to disable margin
deleted.") adjustment.")
;; ;;
@ -144,6 +144,7 @@ deleted.")
(add-hook 'doom-init-ui-hook #'+popup-mode) (add-hook 'doom-init-ui-hook #'+popup-mode)
(add-hook! '+popup-buffer-mode-hook (add-hook! '+popup-buffer-mode-hook
#'(+popup|adjust-fringes #'(+popup|adjust-fringes
+popup|adjust-margins
+popup|set-modeline-on-enable +popup|set-modeline-on-enable
+popup|unset-modeline-on-disable)) +popup|unset-modeline-on-disable))