Skip to content

Commit 44a91a4

Browse files
Zzullbbatsov
authored andcommitted
Stop merging the input history with `cider-repl-history-file'
Because input history cannot be changed by another REPL anymore
1 parent 1fa3f7c commit 44a91a4

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

cider-repl.el

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ CIDER 1.7."
194194
This property value must be unique to avoid having adjacent inputs be
195195
joined together.")
196196

197-
(defvar-local cider-repl-input-history-items-added 0
198-
"Variable counting the items added in the current session.")
199-
200197
(defvar-local cider-repl-output-start nil
201198
"Marker for the start of output.
202199
Currently its only purpose is to facilitate `cider-repl-clear-buffer'.")
@@ -1473,8 +1470,7 @@ WIN, BUFFER and POS are the window, buffer and point under mouse position."
14731470
Empty strings and duplicates are ignored."
14741471
(unless (or (equal string "")
14751472
(equal string (car cider-repl-input-history)))
1476-
(push string cider-repl-input-history)
1477-
(cl-incf cider-repl-input-history-items-added)))
1473+
(push string cider-repl-input-history)))
14781474

14791475
(defun cider-repl-delete-current-input ()
14801476
"Delete all text after the prompt."
@@ -1647,11 +1643,9 @@ The value of `cider-repl-input-history' is set by this function."
16471643
"Write history to FILENAME.
16481644
Currently coding system for writing the contents is hardwired to
16491645
utf-8-unix."
1650-
(let* ((mhist (cider-repl--histories-merge cider-repl-input-history
1651-
cider-repl-input-history-items-added
1652-
(cider-repl--history-read filename)))
1646+
(let* ((end (min (length cider-repl-input-history) cider-repl-history-size))
16531647
;; newest items are at the beginning of the list, thus 0
1654-
(hist (cl-subseq mhist 0 (min (length mhist) cider-repl-history-size))))
1648+
(hist (cl-subseq cider-repl-input-history 0 end)))
16551649
(unless (file-writable-p filename)
16561650
(error (format "History file not writable: %s" filename)))
16571651
(let ((print-length nil) (print-level nil))
@@ -1683,16 +1677,6 @@ constructs."
16831677
(when (equal major-mode 'cider-repl-mode)
16841678
(cider-repl-history-just-save)))))
16851679

1686-
;; SLIME has different semantics and will not save any duplicates.
1687-
;; we keep track of how many items were added to the history in the
1688-
;; current session in `cider-repl--add-to-input-history' and merge only the
1689-
;; new items with the current history found in the file, which may
1690-
;; have been changed in the meantime by another session.
1691-
(defun cider-repl--histories-merge (session-hist n-added-items file-hist)
1692-
"Merge histories from SESSION-HIST adding N-ADDED-ITEMS into FILE-HIST."
1693-
(append (cl-subseq session-hist 0 n-added-items)
1694-
file-hist))
1695-
16961680

16971681
;;; REPL shortcuts
16981682
(defcustom cider-repl-shortcut-dispatch-char ?\,

0 commit comments

Comments
 (0)