diff options
| author | Juri Linkov | 2020-06-22 02:36:16 +0300 |
|---|---|---|
| committer | Juri Linkov | 2020-06-22 02:36:16 +0300 |
| commit | ce4ec1793041ae0f013234ef7189ed855b5227a3 (patch) | |
| tree | 65f6e2b40fd4663d78facf199cf73145cc4f5779 | |
| parent | ba8370bc38ace70149f0af9a88fcdb35e33fe31e (diff) | |
| download | emacs-ce4ec1793041ae0f013234ef7189ed855b5227a3.tar.gz emacs-ce4ec1793041ae0f013234ef7189ed855b5227a3.zip | |
Fix display-buffer-override-next-command to call action only once (bug#39722)
* lisp/vc/vc-dir.el (vc-dir-bookmark-jump): Don't use save-window-excursion.
* lisp/window.el (display-buffer-override-next-command): Reset
display-buffer-overriding-action after the first buffer display action.
* lisp/tab-bar.el (switch-to-buffer-other-tab): Don't reuse frame tabs.
(other-tab-prefix): Don't reuse frame tabs.
| -rw-r--r-- | lisp/tab-bar.el | 6 | ||||
| -rw-r--r-- | lisp/vc/vc-dir.el | 5 | ||||
| -rw-r--r-- | lisp/window.el | 11 |
3 files changed, 14 insertions, 8 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index b54258a4e4a..0a336e41658 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el | |||
| @@ -1543,8 +1543,7 @@ Like \\[switch-to-buffer-other-frame] (which see), but creates a new tab." | |||
| 1543 | (list (read-buffer-to-switch "Switch to buffer in other tab: "))) | 1543 | (list (read-buffer-to-switch "Switch to buffer in other tab: "))) |
| 1544 | (display-buffer (window-normalize-buffer-to-switch-to buffer-or-name) | 1544 | (display-buffer (window-normalize-buffer-to-switch-to buffer-or-name) |
| 1545 | '((display-buffer-in-tab) | 1545 | '((display-buffer-in-tab) |
| 1546 | (inhibit-same-window . nil) | 1546 | (inhibit-same-window . nil)) |
| 1547 | (reusable-frames . t)) | ||
| 1548 | norecord)) | 1547 | norecord)) |
| 1549 | 1548 | ||
| 1550 | (defun find-file-other-tab (filename &optional wildcards) | 1549 | (defun find-file-other-tab (filename &optional wildcards) |
| @@ -1575,8 +1574,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil, | |||
| 1575 | (lambda (buffer alist) | 1574 | (lambda (buffer alist) |
| 1576 | (cons (progn | 1575 | (cons (progn |
| 1577 | (display-buffer-in-tab | 1576 | (display-buffer-in-tab |
| 1578 | buffer (append alist '((inhibit-same-window . nil) | 1577 | buffer (append alist '((inhibit-same-window . nil)))) |
| 1579 | (reusable-frames . t)))) | ||
| 1580 | (selected-window)) | 1578 | (selected-window)) |
| 1581 | 'tab))) | 1579 | 'tab))) |
| 1582 | (message "Display next command buffer in a new tab...")) | 1580 | (message "Display next command buffer in a new tab...")) |
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index a86c37c24ae..cdf8ab984e8 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el | |||
| @@ -1496,8 +1496,9 @@ This implements the `bookmark-make-record-function' type for | |||
| 1496 | This implements the `handler' function interface for the record | 1496 | This implements the `handler' function interface for the record |
| 1497 | type returned by `vc-dir-bookmark-make-record'." | 1497 | type returned by `vc-dir-bookmark-make-record'." |
| 1498 | (let* ((file (bookmark-prop-get bmk 'filename)) | 1498 | (let* ((file (bookmark-prop-get bmk 'filename)) |
| 1499 | (buf (save-window-excursion | 1499 | (buf (progn ;; Don't use save-window-excursion (bug#39722) |
| 1500 | (vc-dir file) (current-buffer)))) | 1500 | (vc-dir file) |
| 1501 | (current-buffer)))) | ||
| 1501 | (bookmark-default-handler | 1502 | (bookmark-default-handler |
| 1502 | `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk))))) | 1503 | `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk))))) |
| 1503 | 1504 | ||
diff --git a/lisp/window.el b/lisp/window.el index f6f30ad6f49..a84ca05daac 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -8627,15 +8627,20 @@ window; the function takes two arguments: an old and new window." | |||
| 8627 | (let* ((old-window (or (minibuffer-selected-window) (selected-window))) | 8627 | (let* ((old-window (or (minibuffer-selected-window) (selected-window))) |
| 8628 | (new-window nil) | 8628 | (new-window nil) |
| 8629 | (minibuffer-depth (minibuffer-depth)) | 8629 | (minibuffer-depth (minibuffer-depth)) |
| 8630 | (clearfun (make-symbol "clear-display-buffer-overriding-action")) | ||
| 8630 | (action (lambda (buffer alist) | 8631 | (action (lambda (buffer alist) |
| 8631 | (unless (> (minibuffer-depth) minibuffer-depth) | 8632 | (unless (> (minibuffer-depth) minibuffer-depth) |
| 8632 | (let* ((ret (funcall pre-function buffer alist)) | 8633 | (let* ((ret (funcall pre-function buffer alist)) |
| 8633 | (window (car ret)) | 8634 | (window (car ret)) |
| 8634 | (type (cdr ret))) | 8635 | (type (cdr ret))) |
| 8635 | (setq new-window (window--display-buffer buffer window | 8636 | (setq new-window (window--display-buffer buffer window |
| 8636 | type alist)))))) | 8637 | type alist)) |
| 8638 | ;; Reset display-buffer-overriding-action | ||
| 8639 | ;; after the first buffer display action | ||
| 8640 | (funcall clearfun) | ||
| 8641 | (setq post-function nil) | ||
| 8642 | new-window)))) | ||
| 8637 | (command this-command) | 8643 | (command this-command) |
| 8638 | (clearfun (make-symbol "clear-display-buffer-overriding-action")) | ||
| 8639 | (exitfun | 8644 | (exitfun |
| 8640 | (lambda () | 8645 | (lambda () |
| 8641 | (setq display-buffer-overriding-action | 8646 | (setq display-buffer-overriding-action |
| @@ -8653,6 +8658,8 @@ window; the function takes two arguments: an old and new window." | |||
| 8653 | ;; adding the hook by the same command below. | 8658 | ;; adding the hook by the same command below. |
| 8654 | (eq this-command command)) | 8659 | (eq this-command command)) |
| 8655 | (funcall exitfun)))) | 8660 | (funcall exitfun)))) |
| 8661 | ;; Reset display-buffer-overriding-action | ||
| 8662 | ;; after the next command finishes | ||
| 8656 | (add-hook 'post-command-hook clearfun) | 8663 | (add-hook 'post-command-hook clearfun) |
| 8657 | (push action display-buffer-overriding-action))) | 8664 | (push action display-buffer-overriding-action))) |
| 8658 | 8665 | ||