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

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

[elpa] master c2eb4b5 009/399: ivy.el (ivy--kill-buffer-action): Integra


From: Oleh Krehel
Subject: [elpa] master c2eb4b5 009/399: ivy.el (ivy--kill-buffer-action): Integrate with ivy-switch-buffer-kill
Date: Sat, 20 Jul 2019 14:56:38 -0400 (EDT)

branch: master
commit c2eb4b50c50b8a5fe4a9632798ad2b4e8b43547b
Author: Iku Iwasa <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy--kill-buffer-action): Integrate with ivy-switch-buffer-kill
    
    This moves logic in `ivy-switch-buffer-kill' into `ivy--kill-buffer-action'
    and calls the latter from the former, so that `ivy--kill-buffer-action'
    acts as same as `ivy-switch-buffer-kill'.
    
    Previously, `ivy--kill-buffer-action' does not preserve the index
    after kill.
    
    Fixes #1910
    Fixes #1787
---
 ivy.el | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/ivy.el b/ivy.el
index 208d35b..6d9527f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3831,9 +3831,12 @@ BUFFER may be a string or nil."
   "Kill BUFFER."
   (ivy--kill-buffer-or-virtual buffer)
   (unless (buffer-live-p (ivy-state-buffer ivy-last))
-    (setf (ivy-state-buffer ivy-last) (current-buffer)))
-  (setq ivy--index 0)
-  (ivy--reset-state ivy-last))
+    (setf (ivy-state-buffer ivy-last)
+          (with-ivy-window (current-buffer))))
+  (setf (ivy-state-preselect ivy-last) ivy--index)
+  (setq ivy--old-re nil)
+  (setq ivy--all-candidates (delete buffer ivy--all-candidates))
+  (ivy--exhibit))
 
 (defvar ivy-switch-buffer-map
   (let ((map (make-sparse-keymap)))
@@ -3844,14 +3847,7 @@ BUFFER may be a string or nil."
   "Kill the current buffer in `ivy-switch-buffer'."
   (interactive)
   (let ((bn (ivy-state-current ivy-last)))
-    (ivy--kill-buffer-or-virtual bn)
-    (unless (buffer-live-p (ivy-state-buffer ivy-last))
-      (setf (ivy-state-buffer ivy-last)
-            (with-ivy-window (current-buffer))))
-    (setf (ivy-state-preselect ivy-last) ivy--index)
-    (setq ivy--old-re nil)
-    (setq ivy--all-candidates (delete bn ivy--all-candidates))
-    (ivy--exhibit)))
+    (ivy--kill-buffer-action bn)))
 
 (ivy-set-actions
  'ivy-switch-buffer



reply via email to

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