branch: elpa/helm commit fb8cc8390da2c58094a259b61f8d5a0d87dd0e1f Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Try to fix some use cases where the initial window (#2575) is not suitable for PA. --- helm-core.el | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/helm-core.el b/helm-core.el index 92c33b016d..30d73f0b8f 100644 --- a/helm-core.el +++ b/helm-core.el @@ -7077,15 +7077,22 @@ splitting inconditionally, it is unused actually." (attr-val (if (eq attr 'persistent-action-if) (funcall (assoc-default attr source) selection) (assoc-default attr source))) - ;; If attr value is a cons, use its car as persistent function - ;; and its car to decide if helm window should be splitted. + ;; If attr value is a cons, use its car as persistent function. (fn (if (and (consp attr-val) ;; maybe a lambda. (not (functionp attr-val))) (car attr-val) attr-val)) + ;; And its cdr to decide if helm window should be splitted. (no-split (and (consp attr-val) (not (functionp attr-val)) (cdr attr-val))) + ;; Is next-window (from helm-window) a suitable window for PA? + (no-suitable-win + (helm-aand (not helm--buffer-in-new-frame-p) + (next-window (helm-window) 1 helm-initial-frame) + (or (window-dedicated-p it) + (window-parameter it 'no-other-window) + (window-parameter it 'window-side)))) (cursor-in-echo-area t) mode-line-in-non-selected-windows) (progn @@ -7097,10 +7104,11 @@ splitting inconditionally, it is unused actually." (when source (with-helm-window (save-selected-window + ;; FIXME: Simplify SPLIT behavior, it is a mess actually. (if no-split (helm-select-persistent-action-window :split 'never) (helm-select-persistent-action-window - :split (or split helm-onewindow-p))) + :split (or split helm-onewindow-p no-suitable-win))) (helm-log "helm-execute-persistent-action" "current-buffer = %S" (current-buffer)) (let ((helm-in-persistent-action t) @@ -7138,8 +7146,15 @@ The symbol `never' is kept for backward compatibility." (get-buffer-window-list helm-buffer)))) helm-persistent-action-display-window) ((and helm--buffer-in-new-frame-p helm-initial-frame) - (with-selected-frame helm-initial-frame (selected-window))) - ((and split (not (eq split 'never))) (split-window)) + (with-selected-frame helm-initial-frame + (let ((win (selected-window))) + (if (or (window-dedicated-p win) + (window-parameter win 'no-other-window) + (window-parameter win 'window-side)) + (next-window win 1) + win)))) + ((and split (not (eq split 'never))) + (split-window)) ((get-buffer-window helm-current-buffer)) (t (previous-window (selected-window) 1))))))