New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent REPL History #37

Closed
ska2342 opened this Issue Jul 27, 2012 · 8 comments

Comments

Projects
None yet
3 participants
@ska2342
Copy link
Contributor

ska2342 commented Jul 27, 2012

When opening an nrepl session it is convenient to have the history of previous REPL sessions.

Suggestions:

  • Custom variable for file name of history, defaulting to "~/.nrepl-history.eld"
  • Custom variable for the maximum size of the history defaulting to 500
  • Saving of history would be done via kill-buffer-hook, function is attached during nrepl-mode setup in define-derived-mode ...
  • Whenever the current session history is to be saved, it is merged with the history from the file which is re-read at save-time for this.

This mimics most of the things I wrote for the persistent history of SLIME ages ago :-)

Open questions:

  • Would this need a custom variable for the coding system?
  • Is there any reasonable way to use the current project for the history? E.g. save several histories on a per project basis or sort items from the current project automatically to the top of the list?
@technomancy

This comment has been minimized.

Copy link
Contributor

technomancy commented Jul 27, 2012

I think it would be great to have this scoped to a given project, which brings us back to the issue of #34 where we need each connection to be associated with a project root.

@ska2342

This comment has been minimized.

Copy link
Contributor Author

ska2342 commented Jul 27, 2012

Gee, I don't know what I would expect from multiple sessions here and I suspect user's wishes will differ here. E.g. I often do quick clojure experiments in a project dedicated to this purpose. Later I would create a real project and would like to still have my history around.

There's much complexity due to configurability down that path.

Just my 2ct

@technomancy

This comment has been minimized.

Copy link
Contributor

technomancy commented Jul 27, 2012

If you have a defvar for where the history file should be stored, users can set it with .dir-locals and we don't have to worry about implementing scoping on our side.

@ska2342

This comment has been minimized.

Copy link
Contributor Author

ska2342 commented Jul 27, 2012

Now, that sounds emacsy :)

@ska2342

This comment has been minimized.

Copy link
Contributor Author

ska2342 commented Jul 29, 2012

Am working on this ...

@ska2342

This comment has been minimized.

Copy link
Contributor Author

ska2342 commented Jul 29, 2012

You can find my current version in the persistent-history branch in my fork.

  • TODO Handling of coding system when writing history needs improvement
  • BUG? In a fresh session the first item of the history is missing, think it has to do with the initialization of index
  • STYLE I hope, introducing a local variable for kill-emacs-hook and kill-buffer-hook is OK
  • It is not a sophisticated as the history found in SLIME
  • Just concatenates old and new history w/o checking for duplicates. I think this is more how bash does it.
@ska2342

This comment has been minimized.

Copy link
Contributor Author

ska2342 commented Aug 30, 2012

I think, we can close this issue.

@kingtim

This comment has been minimized.

Copy link
Member

kingtim commented Aug 30, 2012

Yep. Think so. Thanks!

@kingtim kingtim closed this Aug 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment