emacs-diffs
[Top][All Lists]
Advanced

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

master ce4ec17: Fix display-buffer-override-next-command to call action


From: Juri Linkov
Subject: master ce4ec17: Fix display-buffer-override-next-command to call action only once (bug#39722)
Date: Sun, 21 Jun 2020 19:36:23 -0400 (EDT)

branch: master
commit ce4ec1793041ae0f013234ef7189ed855b5227a3
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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.
---
 lisp/tab-bar.el   |  6 ++----
 lisp/vc/vc-dir.el |  5 +++--
 lisp/window.el    | 11 +++++++++--
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index b54258a..0a336e4 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."
    (list (read-buffer-to-switch "Switch to buffer in other tab: ")))
   (display-buffer (window-normalize-buffer-to-switch-to buffer-or-name)
                   '((display-buffer-in-tab)
-                    (inhibit-same-window . nil)
-                    (reusable-frames . t))
+                    (inhibit-same-window . nil))
                   norecord))
 
 (defun find-file-other-tab (filename &optional wildcards)
@@ -1575,8 +1574,7 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
    (lambda (buffer alist)
      (cons (progn
              (display-buffer-in-tab
-              buffer (append alist '((inhibit-same-window . nil)
-                                     (reusable-frames . t))))
+              buffer (append alist '((inhibit-same-window . nil))))
              (selected-window))
            'tab)))
   (message "Display next command buffer in a new tab..."))
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index a86c37c..cdf8ab9 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
 This implements the `handler' function interface for the record
 type returned by `vc-dir-bookmark-make-record'."
   (let* ((file (bookmark-prop-get bmk 'filename))
-         (buf (save-window-excursion
-                 (vc-dir file) (current-buffer))))
+         (buf (progn ;; Don't use save-window-excursion (bug#39722)
+                (vc-dir file)
+                (current-buffer))))
     (bookmark-default-handler
      `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
 
diff --git a/lisp/window.el b/lisp/window.el
index f6f30ad..a84ca05 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8627,15 +8627,20 @@ window; the function takes two arguments: an old and 
new window."
   (let* ((old-window (or (minibuffer-selected-window) (selected-window)))
          (new-window nil)
          (minibuffer-depth (minibuffer-depth))
+         (clearfun (make-symbol "clear-display-buffer-overriding-action"))
          (action (lambda (buffer alist)
                    (unless (> (minibuffer-depth) minibuffer-depth)
                      (let* ((ret (funcall pre-function buffer alist))
                             (window (car ret))
                             (type (cdr ret)))
                        (setq new-window (window--display-buffer buffer window
-                                                                type 
alist))))))
+                                                                type alist))
+                       ;; Reset display-buffer-overriding-action
+                       ;; after the first buffer display action
+                       (funcall clearfun)
+                       (setq post-function nil)
+                       new-window))))
          (command this-command)
-         (clearfun (make-symbol "clear-display-buffer-overriding-action"))
          (exitfun
           (lambda ()
             (setq display-buffer-overriding-action
@@ -8653,6 +8658,8 @@ window; the function takes two arguments: an old and new 
window."
                     ;; adding the hook by the same command below.
                     (eq this-command command))
               (funcall exitfun))))
+    ;; Reset display-buffer-overriding-action
+    ;; after the next command finishes
     (add-hook 'post-command-hook clearfun)
     (push action display-buffer-overriding-action)))
 



reply via email to

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