Skip to content

Commit

Permalink
Calculate the length of the history only once
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzull committed Nov 7, 2023
1 parent b51600d commit 142cf4d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cider-repl-history.el
Original file line number Diff line number Diff line change
Expand Up @@ -588,12 +588,11 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter."
(<= cider-repl-history-maximum-display-length 3))
4
cider-repl-history-maximum-display-length))
(cider-command-history cider-repl-input-history)
(items (mapcar
(if cider-repl-history-text-properties
#'copy-sequence
#'substring-no-properties)
cider-command-history)))
cider-repl-input-history)))
(unless cider-repl-history-display-duplicates
;; display highest or lowest duplicate.
;; if `cider-repl-history-display-duplicate-highest' is t,
Expand Down Expand Up @@ -628,16 +627,18 @@ 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-repl-input-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.")))))
Expand Down

0 comments on commit 142cf4d

Please sign in to comment.