Function: cider-repl-history-load

cider-repl-history-load is an interactive and byte-compiled function defined in cider-repl.el.

Signature

(cider-repl-history-load &optional FILENAME)

Documentation

Load history from FILENAME into current session.

FILENAME defaults to the value of cider-repl-history-file but user defined filenames can be used to read special history files.

The value of cider-repl-input-history is set by this function.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-repl.el
(defun cider-repl-history-load (&optional filename)
  "Load history from FILENAME into current session.
FILENAME defaults to the value of `cider-repl-history-file' but user
defined filenames can be used to read special history files.

The value of `cider-repl-input-history' is set by this function."
  (interactive (list (cider-repl--history-read-filename)))
  (cond
   (filename (setq cider-repl-history-file filename))
   ((equal 'per-project cider-repl-history-file)
    (make-local-variable 'cider-repl-input-history)
    (when-let ((dir (cider-repl--find-dir-for-history)))
      (setq-local
       cider-repl-history-file (expand-file-name ".cider-history" dir)))))
  (when cider-repl-history-file
    (condition-case nil
        ;; TODO: probably need to set cider-repl-input-history-position as
        ;; well. In a fresh connection the newest item in the list is
        ;; currently not available.  After sending one input, everything
        ;; seems to work.
        (setq
         cider-repl-input-history
         (cider-repl--history-read cider-repl-history-file))
      (error
       (message
        "Malformed cider-repl-history-file: %s" cider-repl-history-file)))
    (add-hook 'kill-buffer-hook #'cider-repl-history-just-save t t)
    (add-hook 'kill-emacs-hook #'cider-repl-history-save-all)))