mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-03-07 14:21:47 -08:00
feat(lib): introduce doom-kill-childframes-h
And use it to replace the various `posframe-delete-all` hooks littered about to clean up child/posframes in contexts where they may linger after destructive operations (like changing the active workspace or executing `doom/reload`).
This commit is contained in:
parent
4425bd898f
commit
e5bbae8144
5 changed files with 20 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
|||
;;; lisp/lib/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defvar doom-after-reload-hook nil
|
||||
(defvar doom-after-reload-hook '(doom-kill-childframes-h)
|
||||
"A list of hooks to run after `doom/reload' has reloaded Doom.")
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
|||
|
|
@ -80,6 +80,20 @@ In tty Emacs, messages are suppressed completely."
|
|||
(defun doom-disable-line-numbers-h ()
|
||||
(display-line-numbers-mode -1))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-kill-childframes-h ()
|
||||
"Delete all childframes (and `posframe' frames)."
|
||||
(dolist (frame (frame-list))
|
||||
(when (or (frame-parameter frame 'posframe-buffer)
|
||||
(frame-parameter nil 'parent-frame))
|
||||
(let (delete-frame-functions)
|
||||
(delete-frame frame))))
|
||||
(when (featurep 'posframe)
|
||||
(dolist (buffer (buffer-list))
|
||||
(with-current-buffer buffer
|
||||
(when posframe--frame
|
||||
(posframe--kill-buffer buffer))))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Commands
|
||||
|
|
|
|||
|
|
@ -357,9 +357,7 @@ workable results ripgrep produces, despite the error."
|
|||
;; posframe.
|
||||
(dolist (fn '(swiper counsel-rg counsel-grep counsel-git-grep))
|
||||
(setf (alist-get fn ivy-posframe-display-functions-alist)
|
||||
#'ivy-display-function-fallback))
|
||||
|
||||
(add-hook 'doom-after-reload-hook #'posframe-delete-all))
|
||||
#'ivy-display-function-fallback)))
|
||||
|
||||
|
||||
(use-package! flx
|
||||
|
|
|
|||
|
|
@ -363,9 +363,8 @@ orderless."
|
|||
|
||||
(use-package! vertico-posframe
|
||||
:when (modulep! +childframe)
|
||||
:hook (vertico-mode . vertico-posframe-mode)
|
||||
:config
|
||||
(add-hook 'doom-after-reload-hook #'posframe-delete-all))
|
||||
:hook (vertico-mode . vertico-posframe-mode))
|
||||
|
||||
|
||||
;; From https://github.com/minad/vertico/wiki#candidate-display-transformations-custom-candidate-highlighting
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -214,11 +214,8 @@ stored in `persp-save-dir'.")
|
|||
;; Fix #1973: visual selection surviving workspace changes
|
||||
(add-hook 'persp-before-deactivate-functions #'deactivate-mark)
|
||||
|
||||
;; Fix #1017: stop session persistence from restoring a broken posframe
|
||||
(after! posframe
|
||||
(add-hook! 'persp-after-load-state-functions
|
||||
(defun +workspaces-delete-all-posframes-h (&rest _)
|
||||
(posframe-delete-all))))
|
||||
;; Fix #1017: stop session persistence from restoring broken childframes.
|
||||
(add-hook 'persp-after-load-state-functions #'doom-kill-childframes-h)
|
||||
|
||||
;; Don't try to persist dead/remote buffers. They cause errors.
|
||||
(add-hook! 'persp-filter-save-buffers-functions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue