branch: externals/ivy-hydra
commit 6930d724d954759b962296a3332edfbc1e268673
Author: Ingo Lohmar <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy.el (ivy--kill-current-candidate): Specialize and fix for buffers
    
    When using `uniquify', killing a buffer does not only remove it from the
    buffer candidates, but can change the names of remaining buffers as
    well.  This fix was given by Oleh in an issue comment, and I updated it
    for the current master branch.
    
    Fixes #1609
    Fixes #2443
---
 ivy.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ivy.el b/ivy.el
index f8d01ae..3841225 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4455,13 +4455,20 @@ BUFFER may be a string or nil."
   (let ((ivy--recompute-index-inhibit t))
     (ivy--exhibit)))
 
+(defun ivy--kill-current-candidate-buffer ()
+  (setf (ivy-state-preselect ivy-last) ivy--index)
+  (setq ivy--old-re nil)
+  (setq ivy--all-candidates (ivy--buffer-list "" ivy-use-virtual-buffers nil))
+  (let ((ivy--recompute-index-inhibit t))
+    (ivy--exhibit)))
+
 (defun ivy--kill-buffer-action (buffer)
   "Kill BUFFER."
   (ivy--kill-buffer-or-virtual buffer)
   (unless (buffer-live-p (ivy-state-buffer ivy-last))
     (setf (ivy-state-buffer ivy-last)
           (with-ivy-window (current-buffer))))
-  (ivy--kill-current-candidate))
+  (ivy--kill-current-candidate-buffer))
 
 (defvar ivy-switch-buffer-map
   (let ((map (make-sparse-keymap)))

Reply via email to