about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-24T17·15+0100
committerVincent Ambo <tazjin@google.com>2019-12-24T17·15+0100
commit637cb0bd2a091d8a4c60e6566a7d7ba3a83fa6a0 (patch)
treeb3073ddd6da04d882252a9b147899e8e9348a89a /tools
parentceaa0ff0bafd1efeb154b982cc6db8a4907029f1 (diff)
fix(emacs.d): Pick new buffers *into* the active window r/298
Instead of splitting below and moving the target buffer into the new
split, split and move the buffer into the active window.

The other way around does (for some reason I don't fully understand)
not work because `split-window-below` may return invalid windows.
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs/config/init.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el
index 975164383ce9..307699536cc4 100644
--- a/tools/emacs/config/init.el
+++ b/tools/emacs/config/init.el
@@ -55,10 +55,10 @@
               :keymap ivy-switch-buffer-map
               :preselect (buffer-name (other-buffer (current-buffer)))
               :action (lambda (buffer)
-                        (let ((new-window (split-window-below)))
-                          (edwina-arrange)
-                          (with-selected-window new-window
-                            (switch-to-buffer buffer nil 'force-same-window))))
+                        (interactive)
+                        (split-window-below)
+                        (switch-to-buffer buffer nil 'force-same-window)
+                        (edwina-arrange))
               :matcher #'ivy--switch-buffer-matcher
               :caller 'ivy-switch-buffer))
   :bind (:map edwina-mode-map