1

I am using Emacs, CIDER, and shadow-clj/shadow-cljs to develop a project in Clojure/ClojureScript. All this in a macOS Monterey 12.5.

Before that, I was used to programming with Emacs, Slime, Common Lisp, and SBCL. Sometimes, I want to have a similar UX in this new lisp environment similar to my previous experience on the other lisp land.

I am having multiple hassles (as expected) and pains with the new environment. One thing, in particular, has been quite annoying.

After executing cider-jack-in-cljs, shadow-cljs, shadow (REPL), and app (for the build), the REPL does not "remember" the previous session. I can't access the commands that I executed before quitting. It only remembers the commands executed on the current session. This is hindering my interactive programming productivity.

In Slime, this was possible! And quite handy.

Moreover, after executing describe-mode in Emacs, I have:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Column-Number Counsel-Projectile Delete-Selection Display-Line-Numbers
Doom-Modeline Eldoc Electric-Indent File-Name-Shadow Font-Lock
Global-Auto-Revert Global-Display-Line-Numbers Global-Eldoc
Global-Font-Lock Ivy-Prescient Ivy-Rich Line-Number Override-Global
Paredit Projectile Rainbow-Delimiters Recentf Save-Place Savehist
Shell-Dirtrack Show-Paren Transient-Mark Which-Key Wrap-Region
Wrap-Region-Global

(Information about these minor modes follows the major mode info.)

REPL[cljs] mode defined in ‘cider-repl.el’:
Major mode for Clojure REPL interactions.

Inside Cider Major mode, I have the command bellow fully working:

C-c M-p cider-repl-history

But, it works only for current session.

In addition, an user suggested that maybe cider-repl-history-mode was not enabled. Indeed, it seems that it has not been enabled - since I can't see it.

If I try to execute the command cider-repl-history-mode a weird thing happens ParEdit appears indicating a problem in parenthesis and the mini buffer echoes:

paredit-mode: Unmatched bracket or quote

This is really weird because although ParEdit is related to Clojure, it seems unrelated to Cider for the case in hand.

Is there some way to preserve CIDER's REPL's history over sessions?

Pedro Delfino
  • 2,421
  • 1
  • 15
  • 30
  • 2
    AFAIK this is usually something the client (cider in this case) provides. shadow-cljs itself has nothing to provide this and not sure how it could. – Thomas Heller Aug 29 '22 at 06:43
  • Thanks, @ThomasHeller. I am a noob in Clojure stack. It is hard for me to know sometimes where is the problem coming from: CIDER, shadow-cljs, lein.. – Pedro Delfino Aug 31 '22 at 15:23

1 Answers1

1

Use cider-repl-backward-input and cider-repl-forward-input to go forward and backward in command history over sessions.

See CIDER // docs - REPL history browser.

user2609980
  • 10,264
  • 15
  • 74
  • 143
  • Thanks for another help, @ErwinRooijakkers. But I am afraid this is not working in my env. When I execute these commands, they only work for **current session**. They do not retrieve commands from the previous session. Is this a bug that I should report? – Pedro Delfino Aug 29 '22 at 13:45
  • 1
    It does work for me, maybe you have not enabled [cider-repl-history](https://github.com/clojure-emacs/cider/blob/master/cider-repl-history.el) in some way? Can also turn on `cider-repl-history-mode` to see all history. – user2609980 Aug 31 '22 at 14:14
  • Thanks, @user2609980. I will update my question based on your feedback. I believe `cider-repl-history` is working. – Pedro Delfino Aug 31 '22 at 15:23