branch: elpa/cider
commit 62bc5906199a3a39a1efd7ecebed8d090aec817e
Author: Baptiste Strazzulla <baptiste.strazzu...@protonmail.com>
Commit: Bozhidar Batsov <bozhi...@batsov.dev>

    Calculate the length of the history only once
---
 cider-repl-history.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/cider-repl-history.el b/cider-repl-history.el
index e64c773af8..e7b08cd35e 100644
--- a/cider-repl-history.el
+++ b/cider-repl-history.el
@@ -636,16 +636,17 @@ HISTORY-BUF is the history, and optional arg REGEXP is a 
filter."
                         #'cider-repl-history-update-highlighted-entry
                         nil t))
             (message
-             (let ((entry (if (= 1 (length cider-command-history))
-                              "entry"
-                            "entries")))
+             (let* ((history-length (length cider-command-history))
+                    (entry (if (= 1 history-length)
+                               "entry"
+                             "entries")))
                (concat
                 (if (and (not regexp)
                          cider-repl-history-display-duplicates)
                     (format "%s %s in the command history."
-                            (length cider-command-history) entry)
+                            history-length entry)
                   (format "%s (of %s) %s in the command history shown."
-                          (length items) (length cider-command-history) entry))
+                          (length items) history-length entry))
                 (substitute-command-keys
                  (concat "  Type \\[cider-repl-history-quit] to quit.  "
                          "\\[describe-mode] for help.")))))

Reply via email to