emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ace-window 9ca16c6 62/92: Fix aw-switch-buffer-other-wi


From: Stefan Monnier
Subject: [elpa] externals/ace-window 9ca16c6 62/92: Fix aw-switch-buffer-other-window bug
Date: Wed, 17 Mar 2021 18:39:23 -0400 (EDT)

branch: externals/ace-window
commit 9ca16c6bc394b2f57b3a5651b2baff7f3a62d2e0
Author: Nick Drozd <nicholasdrozd@gmail.com>
Commit: Nick Drozd <nicholasdrozd@gmail.com>

    Fix aw-switch-buffer-other-window bug
    
    When aw-switch-buffer-other-window is executed, it switches to the
    selected window, changes the buffer, and then switches back. If the
    buffer-switching function is canceled, the window won't get switched
    back. Using unwind-protect ensures that the function ends with the
    starting window selected.
---
 ace-window.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index fc8a592..1a24c7b 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -750,10 +750,11 @@ Modify `aw-fair-aspect-ratio' to tweak behavior."
       (aw-split-window-vert window))))
 
 (defun aw-switch-buffer-other-window (window)
-  "Switch buffer in WINDOW without selecting WINDOW."
+  "Switch buffer in WINDOW."
   (aw-switch-to-window window)
-  (aw--switch-buffer)
-  (aw-flip-window))
+  (unwind-protect
+      (aw--switch-buffer)
+    (aw-flip-window)))
 
 (defun aw--face-rel-height ()
   (let ((h (face-attribute 'aw-leading-char-face :height)))



reply via email to

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