branch: externals/consult commit d8d673c75bcad1af1c552cd7c0b5017dc27f18c8 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
consult--buffer-preview: Restore window configuration before buffer display If the user sets switch-to-buffer-obey-display-actions and adjusts the display-buffer-alist, the buffers may pop up at special places. Therefore we must always restore the window configuration, before previewing the next buffer. --- consult.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/consult.el b/consult.el index 2d17ee9d3c..0758df3ac9 100644 --- a/consult.el +++ b/consult.el @@ -4131,12 +4131,11 @@ Report progress and return a list of the results" (when (and (eq action 'preview) (memq consult--buffer-display '(switch-to-buffer switch-to-buffer-other-window))) - (cond - ((and cand (get-buffer cand)) - (unless orig-conf - (setq orig-conf (current-window-configuration))) - (consult--buffer-action cand 'norecord)) - (t (ignore-errors (set-window-configuration orig-conf)))))))) + (if orig-conf + (ignore-errors (set-window-configuration orig-conf)) + (setq orig-conf (current-window-configuration))) + (when (and cand (get-buffer cand)) + (consult--buffer-action cand 'norecord)))))) (defun consult--buffer-action (buffer &optional norecord) "Switch to BUFFER via `consult--buffer-display' function.