Fix "cannot split parent or side window" errors
Hopefully addresses a common issue where helm actions will operate on the wrong window (a popup, typically, which is a dedicated side window; Emacs doesn't let you split side windows). This comes with a side effect: trying to split a popup will cause a non-popup window nearby to be split instead. Popups really aren't supposed to be split (interactively) in any case.
This commit is contained in:
parent
ceb06e1948
commit
30eaf8fd03
1 changed files with 10 additions and 0 deletions
|
@ -102,6 +102,15 @@ the buffer is visible, then set another timer and try again later."
|
|||
parameters)
|
||||
alist)))
|
||||
|
||||
(defun +popup--split-window (window size side)
|
||||
"Ensure a non-dedicated/popup window is selected when splitting a window."
|
||||
(cl-loop for win in (delq nil (cons window (window-list)))
|
||||
unless (or (+popup-window-p win)
|
||||
(window-minibuffer-p win))
|
||||
return (setq window win))
|
||||
(let ((ignore-window-parameters t))
|
||||
(split-window window size side)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +popup--init (window &optional alist)
|
||||
"Initializes a popup window. Run any time a popup is opened. It sets the
|
||||
|
@ -115,6 +124,7 @@ and enables `+popup-buffer-mode'."
|
|||
(dolist (param (cdr (assq 'window-parameters alist)))
|
||||
(set-window-parameter window (car param) (cdr param))))
|
||||
(set-window-parameter window 'popup t)
|
||||
(set-window-parameter window 'split-window #'+popup--split-window)
|
||||
(set-window-parameter window 'delete-window #'+popup--delete-window)
|
||||
(set-window-parameter window 'delete-other-windows #'+popup--delete-other-windows)
|
||||
(set-window-dedicated-p window 'popup)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue