emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 62072ba: * lisp/windmove.el (windmove-display-in-di


From: Juri Linkov
Subject: [Emacs-diffs] master 62072ba: * lisp/windmove.el (windmove-display-in-direction): Support consecutive calls
Date: Wed, 24 Apr 2019 17:40:34 -0400 (EDT)

branch: master
commit 62072bad4146598e9a88b158ef343b1d1a04a7d2
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/windmove.el (windmove-display-in-direction): Support consecutive 
calls
    
    Remember action and delete it from display-buffer-overriding-action 
afterwards
---
 lisp/windmove.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/lisp/windmove.el b/lisp/windmove.el
index 0853f7e..ab47565 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -596,12 +596,25 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
          (old-window (or (minibuffer-selected-window) (selected-window)))
          (new-window)
          (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)
          (clearfun (make-symbol "clear-display-buffer-overriding-action"))
          (exitfun
           (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))
               (select-window (if no-select old-window new-window)))
             (remove-hook 'post-command-hook clearfun))))
@@ -616,19 +629,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
                     (eq this-command command))
               (funcall exitfun))))
     (add-hook 'post-command-hook clearfun)
-    (push (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)))))
-          display-buffer-overriding-action)
+    (push action display-buffer-overriding-action)
     (message "[display-%s]" dir)))
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]