-
-
Notifications
You must be signed in to change notification settings - Fork 649
browse REPL input history #1860
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
Comments
That would be a wonderful feature! I don't think the UI for They are handling the multi-line items on the kill-ring there. Basically for handling multi-line items you need to be inserting some delims between them, so on operations like clicking and so on you can get the boundaries of the current item and retrieve it completely. You already suggested this yourself, so I'd say you're on the right track. |
@johnv02139 Any progress here? |
Sorry, distracted. I intend to work on it this week. |
@johnv02139 ping :-) |
I took a first pass at it, in case you (or anyone else) want to take a look. It needs more testing. https://github.com/johnv02139/cider/tree/historycmd |
Take your time and keep us posted. Just wanted to see if you were still working on this. |
Wouldn't it be much easier (and better from a usability perspective) to just emulate the behavior of C-r and C-s of the typical shell? |
It's not as handy in some occasions. That's why similar extensions exist. In general it'd be nice to implement |
P.S. For a long time I believed we'd be moving to |
@bbatsov I'd be willing to try working on the |
For a very long time this was on hold simply because no one had time to work on it. See the original issue here #709 Frankly, I'm not 100% certain that we can have all the functionality we have right now using |
Gotcha. I'll focus on finishing those then. |
Isn't part of the motivation behind the |
I don't recall some amazing output handling in For me the biggest motivation was removing a big chunk of the codebase and offloading it to some standard machinery, so we wouldn't have to worry about it. |
Regarding "C-r and C-s of the typical shell", isn't that what M-r and M-s already give you in Cider? I think the work on the browse feature is done. The only reason I haven't made a pull request is that I need to write documentation. |
Goal
I have wanted a better way to see and re-enter commands from my REPL input history. Scrolling through with M-p and M-n is good, but sometimes I want more.
When I saw cider-classpath, I realized that was very similar to what I wanted for input history. So, I adapted it, and really in just a couple of minutes, I think it came out very nice and useful. Please see:
johnv02139@764b529
Progress
What I've done so far allows you to see your history, most recent command on the top. It's Clojure code, so the buffer is derived from Clojure mode, so it's nicely highlighted. You can insert the command back into the REPL without executing it (bound to
SPC
), or insert it and execute it in one gesture (bound toRET
).Issue
However, there's a problem, and I'd like to see if anyone has any ideas. With cider-classpath, the text that it operates on is simply the text between the beginning and end of line. That is very often the case for history, too. But, not always.
It's fairly common to enter multi-line forms at the REPL prompt. And, once I've simply dumped all the text into the buffer, it's very tricky to reconstruct what was the beginning and end of the command.
Workaround
What my current version does is simply replace newlines with spaces, and then magically all the commands are a single line, and the bol/eol thing works fine. But then you lose your formatting (and Clojure strings containing newlines can be munged, etc.)
Wish
If this were a typical GUI application, it would be more like a list box, where each item in the list was associated with some text behind the scenes. But I don't think Emacs has any features like that, that I know of.
Options
So, some options:
Enhancement?
Another option would be to output the lines numbered, much like the history command from a shell. And then, be able to re-enter a command that is not at point, by entering the number. This also would provide a natural separator. But, it could still be tricky if, say, a second line of an input entry started with an integer. And it also makes the buffer less Clojure-y.
Request
I'm interested to know
Thanks!
The text was updated successfully, but these errors were encountered: