branch: elpa/git-commit
commit 9c66514b2c879a8959b676393467b1f24be71303
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-restore-window-configuration: Select buffer
    
    Apparently calling `set-window-configuration' does not update the
    current buffer, so we have to do that ourselves, using code that
    looks highly suspicious.
    
    If we don't do that, then `current-buffer' returns the wrong buffer in
    `magit-section-post-command-hook'.  This is not fatal for most code in
    that function, and thus went unnoticed, but it trips up the recently
    added `cursor-sensor-move-to-tangible'.
    
    Closes #4940.
---
 lisp/magit-mode.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index d05d0c9793..ac5a21743a 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -1202,7 +1202,9 @@ Later, when the buffer is buried, it may be restored by
       (set-window-configuration winconf)
       (when (buffer-live-p buffer)
         (with-current-buffer buffer
-          (setq magit-previous-window-configuration nil))))))
+          (setq magit-previous-window-configuration nil)))
+      (set-buffer (with-selected-window (selected-window)
+                    (current-buffer))))))
 
 ;;; Buffer History
 

Reply via email to