branch: master
commit 38b43169bf6233ce639b4ca8ecb0ff36adde37aa
Author: Eric Danan <[email protected]>
Commit: Oleh Krehel <[email protected]>

    Ensure action and display transformer are called from initial buffer
    
    Fixes #1182
    Re #717
---
 ivy.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ivy.el b/ivy.el
index 97a3323..f4c0c56 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3164,7 +3164,8 @@ CANDS is a list of strings."
       (setf (ivy-state-current ivy-last) (copy-sequence (nth index cands)))
       (when (setq transformer-fn (ivy-state-display-transformer-fn ivy-last))
         (with-ivy-window
-          (setq cands (mapcar transformer-fn cands))))
+          (with-current-buffer (ivy-state-buffer ivy-last)
+            (setq cands (mapcar transformer-fn cands)))))
       (let* ((ivy--index index)
              (cands (mapcar
                      #'ivy--format-minibuffer-line
@@ -3873,11 +3874,12 @@ EVENT gives the mouse position."
            (ivy-exit 'done))
       (with-ivy-window
         (setq counsel-grep-last-line nil)
-        (funcall action
-                 (if (and (consp coll)
-                          (consp (car coll)))
-                     (assoc str coll)
-                   str))
+        (with-current-buffer (ivy-state-buffer ivy-last)
+          (funcall action
+                   (if (and (consp coll)
+                            (consp (car coll)))
+                       (assoc str coll)
+                     str)))
         (if (memq (ivy-state-caller ivy-last)
                   '(swiper counsel-git-grep counsel-grep counsel-ag 
counsel-rg))
             (with-current-buffer (window-buffer (selected-window))

Reply via email to