branch: externals/ivy-hydra
commit c0a960b1f9aa803a241209fd8ebaf710bc32f16f
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy.el (ivy-read): Don't error on "Selecting deleted buffer"
    
    This happens when the buffer which originated `read-from-minibuffer'
    is killed.
    
    Fixes #2518
---
 ivy.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/ivy.el b/ivy.el
index ca90c9a..7417a4e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2263,12 +2263,16 @@ customizations apply to the current completion session."
                   (setf (ivy-state-current ivy-last)
                         (car ivy--all-candidates))
                   (setq ivy-exit 'done))
-              (read-from-minibuffer
-               prompt
-               (ivy-state-initial-input ivy-last)
-               (make-composed-keymap keymap ivy-minibuffer-map)
-               nil
-               hist)
+              (condition-case err
+                  (read-from-minibuffer
+                   prompt
+                   (ivy-state-initial-input ivy-last)
+                   (make-composed-keymap keymap ivy-minibuffer-map)
+                   nil
+                   hist)
+                (error
+                 (unless (equal err '(error "Selecting deleted buffer"))
+                   (signal (car err) (cdr err)))))
               (pop (symbol-value hist)))
             (when (eq ivy-exit 'done)
               (ivy--update-history hist))))

Reply via email to