Commit 62072bad authored by Juri Linkov's avatar Juri Linkov
Browse files

* lisp/windmove.el (windmove-display-in-direction): Support consecutive calls

Remember action and delete it from display-buffer-overriding-action afterwards
parent 4eb7f9ef
Pipeline #1447 passed with stage
in 64 minutes and 27 seconds
...@@ -596,12 +596,25 @@ When `switch-to-buffer-obey-display-actions' is non-nil, ...@@ -596,12 +596,25 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(old-window (or (minibuffer-selected-window) (selected-window))) (old-window (or (minibuffer-selected-window) (selected-window)))
(new-window) (new-window)
(minibuffer-depth (minibuffer-depth)) (minibuffer-depth (minibuffer-depth))
(action display-buffer-overriding-action) (action (lambda (buffer alist)
(unless (> (minibuffer-depth) minibuffer-depth)
(let ((window (if (eq dir 'same-window)
(selected-window)
(window-in-direction
dir nil nil
(and arg (prefix-numeric-value arg))
windmove-wrap-around)))
(type 'reuse))
(unless window
(setq window (split-window nil nil dir) type 'window))
(setq new-window (window--display-buffer buffer window
type alist))))))
(command this-command) (command this-command)
(clearfun (make-symbol "clear-display-buffer-overriding-action")) (clearfun (make-symbol "clear-display-buffer-overriding-action"))
(exitfun (exitfun
(lambda () (lambda ()
(setq display-buffer-overriding-action action) (setq display-buffer-overriding-action
(delq action display-buffer-overriding-action))
(when (window-live-p (if no-select old-window new-window)) (when (window-live-p (if no-select old-window new-window))
(select-window (if no-select old-window new-window))) (select-window (if no-select old-window new-window)))
(remove-hook 'post-command-hook clearfun)))) (remove-hook 'post-command-hook clearfun))))
...@@ -616,19 +629,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil, ...@@ -616,19 +629,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(eq this-command command)) (eq this-command command))
(funcall exitfun)))) (funcall exitfun))))
(add-hook 'post-command-hook clearfun) (add-hook 'post-command-hook clearfun)
(push (lambda (buffer alist) (push action display-buffer-overriding-action)
(unless (> (minibuffer-depth) minibuffer-depth)
(let ((window (if (eq dir 'same-window)
(selected-window)
(window-in-direction
dir nil nil
(and arg (prefix-numeric-value arg))
windmove-wrap-around)))
(type 'reuse))
(unless window
(setq window (split-window nil nil dir) type 'window))
(setq new-window (window--display-buffer buffer window type alist)))))
display-buffer-overriding-action)
(message "[display-%s]" dir))) (message "[display-%s]" dir)))
;;;###autoload ;;;###autoload
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment