popups: handle :autokill in a kill-buffer-query-fn

This commit is contained in:
Henrik Lissner 2017-12-29 22:30:34 -05:00
parent 0c06514c6f
commit 37a07c79b7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 11 additions and 9 deletions

View file

@ -413,12 +413,4 @@ properties."
(when (doom-popup-p window) (when (doom-popup-p window)
(setq doom-popup-windows (delq window doom-popup-windows)) (setq doom-popup-windows (delq window doom-popup-windows))
(when doom-popup-remember-history (when doom-popup-remember-history
(setq doom-popup-history (list (doom--popup-data window)))) (setq doom-popup-history (list (doom--popup-data window))))))
(let ((autokill-p (and (not doom-popup-inhibit-autokill)
(doom-popup-property :autokill window))))
(with-selected-window window
(doom-popup-mode -1)
(when autokill-p
(when-let* ((process (get-buffer-process (current-buffer))))
(set-process-query-on-exit-flag process nil))
(kill-buffer (current-buffer)))))))

View file

@ -149,6 +149,16 @@ recognized by DOOM's popup system. They are:
(cons '(doom-display-buffer-condition doom-display-buffer-action) (cons '(doom-display-buffer-condition doom-display-buffer-action)
display-buffer-alist))) display-buffer-alist)))
(defun doom|autokill-popups ()
(or (not (doom-popup-p))
(prog1 (when (and (not doom-popup-inhibit-autokill)
(plist-get doom-popup-rules :autokill))
(doom-popup-mode -1)
(when-let* ((process (get-buffer-process (current-buffer))))
(set-process-query-on-exit-flag process nil))
t))))
(add-hook 'kill-buffer-query-functions #'doom|autokill-popups)
;; no modeline in popups ;; no modeline in popups
(add-hook 'doom-popup-mode-hook #'doom|hide-modeline-in-popup) (add-hook 'doom-popup-mode-hook #'doom|hide-modeline-in-popup)
;; ensure every rule without an :align, :same or :frame property has an ;; ensure every rule without an :align, :same or :frame property has an