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

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

[elpa] externals/ivy-hydra dab134d 229/395: ivy.el (ivy-read): Don't cle


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra dab134d 229/395: ivy.el (ivy-read): Don't clear the first item of history
Date: Thu, 25 Feb 2021 08:32:08 -0500 (EST)

branch: externals/ivy-hydra
commit dab134df2cd4cab103f769cbb5f17a7cb5828793
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy-read): Don't clear the first item of history
    
    * ivy-test.el (ivy-read-history): Add test.
    
    Fixes #2533
---
 ivy-test.el | 14 +++++++++++---
 ivy.el      |  3 +--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index afca7c2..a4a641a 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -188,9 +188,17 @@ Since `execute-kbd-macro' doesn't pick up a let-bound 
`default-directory'.")
                  "one")))
 
 (ert-deftest ivy-read-history ()
-  (defvar ivy-read-hist '("c" "b" "a"))
-  (ivy-with '(ivy-read "test: " '("c" "d") :history 'ivy-read-hist) "RET")
-  (should (equal ivy-read-hist '("c" "b" "a"))))
+  (defvar ivy-read-hist nil)
+  (should (equal (progn
+                   (setq ivy-read-hist '("c" "b" "a"))
+                   (ivy-with '(ivy-read "test: " '("c" "d") :history 
'ivy-read-hist) "RET")
+                   ivy-read-hist)
+                 '("c" "b" "a")))
+  (should (equal (progn
+                   (setq ivy-read-hist '("cdef" "b" "a"))
+                   (ivy-with '(ivy-read "test: " '("cdef" "g") :history 
'ivy-read-hist) "cd RET")
+                   ivy-read-hist)
+                 '("cd" "cdef" "b" "a"))))
 
 (ert-deftest ivy-read-sort-alist ()
   (should (equal (ivy-with '(let ((coll '(("b" . "1") ("a" . "2"))))
diff --git a/ivy.el b/ivy.el
index 3c844cc..690e446 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2271,8 +2271,7 @@ customizations apply to the current completion session."
                    hist)
                 (error
                  (unless (equal err '(error "Selecting deleted buffer"))
-                   (signal (car err) (cdr err)))))
-              (pop (symbol-value hist)))
+                   (signal (car err) (cdr err))))))
             (when (eq ivy-exit 'done)
               (ivy--update-history hist))))
       (ivy--cleanup))



reply via email to

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