Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include transient's menu window in saved window configuration #2711

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions helm-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
(declare-function helm-quit-and-find-file "helm-utils.el")
(declare-function linum-mode "linum.el")
(declare-function minibuffer-depth-setup "mb-depth.el")
(declare-function transient--delete-window "ext:transient" ())
(declare-function transient--preserve-window-p "ext:transient"
(&optional nohide))

(defvar helm-marked-buffer-name)
(defvar display-buffer-function)
Expand Down Expand Up @@ -638,13 +641,13 @@ If t, then Helm does not pop-up a new window."
:type 'string)

(defcustom helm-save-configuration-functions
'(set-window-configuration . current-window-configuration)
'(set-window-configuration . helm-current-window-configuration)
"Functions used to restore or save configurations for frames and windows.
Specified as a pair of functions, where car is the restore
function and cdr is the save function.

To save and restore frame configuration, set this variable to
\\='(set-frame-configuration . current-frame-configuration)
\\='(set-frame-configuration . helm-current-frame-configuration)

NOTE: This may not work properly with own-frame minibuffer
settings. Older versions saves/restores frame configuration, but
Expand Down Expand Up @@ -3373,6 +3376,14 @@ frame configuration as per `helm-save-configuration-functions'."
((symbol-function 'x-focus-frame) #'ignore))
(select-frame-set-input-focus frame))))))

(defun helm-current-window-configuration ()
"Like `current-window-configuration' but deal with Transient incompatibility.
See https://github.com/magit/transient/discussions/361 for details."
(when (and (window-live-p (bound-and-true-p transient--window))
(not (transient--preserve-window-p)))
(transient--delete-window))
(current-window-configuration))

(defun helm-split-window-default-fn (window)
"Default function to split windows before displaying `helm-buffer'.

Expand Down