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

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

[elpa] master c1b9f5a 39/63: Allow "M-o j" to switch to virtual buffers


From: Oleh Krehel
Subject: [elpa] master c1b9f5a 39/63: Allow "M-o j" to switch to virtual buffers in other window
Date: Fri, 21 Aug 2015 12:08:41 +0000

branch: master
commit c1b9f5a0f41c88d115d46f5dd3322a1586c2b51b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Allow "M-o j" to switch to virtual buffers in other window
    
    * ivy.el (ivy--switch-buffer-other-window-action): New defun.
    (ivy-set-actions): Use `ivy--switch-buffer-other-window-action' instead
    of `switch-to-buffer-other-window'.
---
 ivy.el |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 28463b7..5535e1d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1550,6 +1550,17 @@ BUFFER may be a string or nil."
         (switch-to-buffer
          buffer nil 'force-same-window)))))
 
+(defun ivy--switch-buffer-other-window-action (buffer)
+  "Switch to BUFFER in other window.
+BUFFER may be a string or nil."
+  (if (zerop (length buffer))
+      (switch-to-buffer-other-window ivy-text)
+    (let ((virtual (assoc buffer ivy--virtual-buffers)))
+      (if (and virtual
+               (not (get-buffer buffer)))
+          (find-file-other-window (cdr virtual))
+        (switch-to-buffer-other-window buffer)))))
+
 (defvar ivy-switch-buffer-map (make-sparse-keymap))
 
 (ivy-set-actions
@@ -1560,7 +1571,7 @@ BUFFER may be a string or nil."
       (ivy--reset-state ivy-last))
     "kill")
    ("j"
-    switch-to-buffer-other-window
+    ivy--switch-buffer-other-window-action
     "other")))
 
 (defun ivy-switch-buffer ()



reply via email to

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