diff options
| author | Juri Linkov | 2019-04-25 00:40:27 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-04-25 00:40:27 +0300 |
| commit | 62072bad4146598e9a88b158ef343b1d1a04a7d2 (patch) | |
| tree | 2d1ccb8f4836e950b82369cfa89ae64c44c471c9 | |
| parent | 4eb7f9ef595c10df1ea78518b2f0410a0e79ec70 (diff) | |
| download | emacs-62072bad4146598e9a88b158ef343b1d1a04a7d2.tar.gz emacs-62072bad4146598e9a88b158ef343b1d1a04a7d2.zip | |
* lisp/windmove.el (windmove-display-in-direction): Support consecutive calls
Remember action and delete it from display-buffer-overriding-action afterwards
| -rw-r--r-- | lisp/windmove.el | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/windmove.el b/lisp/windmove.el index 0853f7ec7f9..ab47565dfae 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el | |||
| @@ -596,12 +596,25 @@ When `switch-to-buffer-obey-display-actions' is non-nil, | |||
| 596 | (old-window (or (minibuffer-selected-window) (selected-window))) | 596 | (old-window (or (minibuffer-selected-window) (selected-window))) |
| 597 | (new-window) | 597 | (new-window) |
| 598 | (minibuffer-depth (minibuffer-depth)) | 598 | (minibuffer-depth (minibuffer-depth)) |
| 599 | (action display-buffer-overriding-action) | 599 | (action (lambda (buffer alist) |
| 600 | (unless (> (minibuffer-depth) minibuffer-depth) | ||
| 601 | (let ((window (if (eq dir 'same-window) | ||
| 602 | (selected-window) | ||
| 603 | (window-in-direction | ||
| 604 | dir nil nil | ||
| 605 | (and arg (prefix-numeric-value arg)) | ||
| 606 | windmove-wrap-around))) | ||
| 607 | (type 'reuse)) | ||
| 608 | (unless window | ||
| 609 | (setq window (split-window nil nil dir) type 'window)) | ||
| 610 | (setq new-window (window--display-buffer buffer window | ||
| 611 | type alist)))))) | ||
| 600 | (command this-command) | 612 | (command this-command) |
| 601 | (clearfun (make-symbol "clear-display-buffer-overriding-action")) | 613 | (clearfun (make-symbol "clear-display-buffer-overriding-action")) |
| 602 | (exitfun | 614 | (exitfun |
| 603 | (lambda () | 615 | (lambda () |
| 604 | (setq display-buffer-overriding-action action) | 616 | (setq display-buffer-overriding-action |
| 617 | (delq action display-buffer-overriding-action)) | ||
| 605 | (when (window-live-p (if no-select old-window new-window)) | 618 | (when (window-live-p (if no-select old-window new-window)) |
| 606 | (select-window (if no-select old-window new-window))) | 619 | (select-window (if no-select old-window new-window))) |
| 607 | (remove-hook 'post-command-hook clearfun)))) | 620 | (remove-hook 'post-command-hook clearfun)))) |
| @@ -616,19 +629,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil, | |||
| 616 | (eq this-command command)) | 629 | (eq this-command command)) |
| 617 | (funcall exitfun)))) | 630 | (funcall exitfun)))) |
| 618 | (add-hook 'post-command-hook clearfun) | 631 | (add-hook 'post-command-hook clearfun) |
| 619 | (push (lambda (buffer alist) | 632 | (push action display-buffer-overriding-action) |
| 620 | (unless (> (minibuffer-depth) minibuffer-depth) | ||
| 621 | (let ((window (if (eq dir 'same-window) | ||
| 622 | (selected-window) | ||
| 623 | (window-in-direction | ||
| 624 | dir nil nil | ||
| 625 | (and arg (prefix-numeric-value arg)) | ||
| 626 | windmove-wrap-around))) | ||
| 627 | (type 'reuse)) | ||
| 628 | (unless window | ||
| 629 | (setq window (split-window nil nil dir) type 'window)) | ||
| 630 | (setq new-window (window--display-buffer buffer window type alist))))) | ||
| 631 | display-buffer-overriding-action) | ||
| 632 | (message "[display-%s]" dir))) | 633 | (message "[display-%s]" dir))) |
| 633 | 634 | ||
| 634 | ;;;###autoload | 635 | ;;;###autoload |