-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi Slime Devs,
Here at the office folks are used to the Franz Lisp eli emacs interface. Once of the features of the eli interface is that when you iterate through previous commands in the REPL they get inserted at the point as opposed to Slime's behavior of erasing all input and inserting the previous input at the REPL.
I've modified slime-repl-history-replace to mimic the eli behavior, is there interest in me tidying this up and submitting a patch to slime with this as an optional alternative to the current history behavior?
Regards, Andrew
On Wed, Jan 8, 2014 at 5:17 PM, Andrew Myers asm198@gmail.com wrote:
I've modified slime-repl-history-replace to mimic the eli behavior, is there interest in me tidying this up and submitting a patch to slime with this as an optional alternative to the current history behavior?
I'm interested in features that help ELI users move to SLIME. :-)
Here's what I have modified right now. Currently Devs who want the behavior put this in their emacs config after loading slime and set the defvar to t. I'm not a slime or elisp expert by a long shot so if anyone has comments for what I should improve that would be great :)
Andrew
These changes are in contrib/slime-repl.el
(defvar slime-repl-eli-history-behavior nil)
(defun slime-repl-insert-history (direction pos min-pos max-pos content) (when (slime-repl-history-search-in-progress-p) (let* ((dir-of-previous (if (eq direction 'backward) 'forward 'backward)) (previous-index (slime-repl-position-in-history pos dir-of-previous "")) (previous (nth previous-index slime-repl-input-history))) (let ((prev-point (point))) (backward-char (length previous)) (delete-region (min (point) prev-point) (max (point) prev-point))))) (insert-and-inherit content))
(defun slime-repl-history-replace (direction &optional regexp) "Replace the current input with the next line in DIRECTION. DIRECTION is 'forward' or 'backward' (in the history list). If REGEXP is non-nil, only lines matching REGEXP are considered." (setq slime-repl-history-pattern regexp) (let* ((min-pos -1) (max-pos (length slime-repl-input-history)) (pos0 (cond ((slime-repl-history-search-in-progress-p) slime-repl-input-history-position) (t min-pos))) (pos (slime-repl-position-in-history pos0 direction (or regexp "") (slime-repl-current-input))) (msg nil)) (cond ((and (< min-pos pos) (< pos max-pos)) (if slime-repl-eli-history-behavior (slime-repl-insert-history direction pos min-pos max-pos (nth pos slime-repl-input-history)) (slime-repl-replace-input (nth pos slime-repl-input-history))) (setq msg (format "History item: %d" pos))) ((not slime-repl-wrap-history) (setq msg (cond ((= pos min-pos) "End of history") ((= pos max-pos) "Beginning of history")))) (slime-repl-wrap-history (setq pos (if (= pos min-pos) max-pos min-pos)) (setq msg "Wrapped history"))) (when (or (<= pos min-pos) (<= max-pos pos)) (when regexp (setq msg (concat msg "; no matching item")))) ;;(message "%s [%d %d %s]" msg start-pos pos regexp) (message "%s%s" msg (cond ((not regexp) "") (t (format "; current regexp: %s" regexp)))) (setq slime-repl-input-history-position pos) (setq this-command 'slime-repl-history-replace)))
On 01/08/2014 01:26 PM, Luís Oliveira wrote:
On Wed, Jan 8, 2014 at 5:17 PM, Andrew Myers asm198@gmail.com wrote:
I've modified slime-repl-history-replace to mimic the eli behavior, is there interest in me tidying this up and submitting a patch to slime with this as an optional alternative to the current history behavior?
I'm interested in features that help ELI users move to SLIME. :-)
Andrew Myers asm198@gmail.com writes:
Here's what I have modified right now.
There is a much, much bigger chance to get this looked at if you make a github pull request. See the new CONTRIBUTING.md file.
João
João Távora <joaotavora <at> gmail.com> writes:
Andrew Myers <asm198 <at> gmail.com> writes:
Here's what I have modified right now.
There is a much, much bigger chance to get this looked at if you make a github pull request. See the new CONTRIBUTING.md file.
João
For anyone interested in this, I Just submitted a pull request for it on github. It's been cleaned up and I added a customize option and fixed a few bugs that were in the version I sent out in email.
https://github.com/slime/slime/pull/100
Andrew
On Fri, Jan 31, 2014 at 9:04 AM, Andrew asm198@gmail.com wrote:
João Távora <joaotavora <at> gmail.com> writes:
Andrew Myers <asm198 <at> gmail.com> writes:
Here's what I have modified right now.
There is a much, much bigger chance to get this looked at if you make a github pull request. See the new CONTRIBUTING.md file.
João
For anyone interested in this, I Just submitted a pull request for it on github. It's been cleaned up and I added a customize option and fixed a few bugs that were in the version I sent out in email.
https://github.com/slime/slime/pull/100
Andrew
I'm interested in this feature; it's one of the things I missed when I switched from ELI to SLIME years ago. What is its status? I notice the discussion on github about last input vs. last matching input; as I recall, ELI could do both, I think there was a prefix argument for the latter.
Liam
On Sun, Dec 28, 2014 at 2:07 PM, Liam Healy lnp@healy.washington.dc.us wrote:
I'm interested in this feature; it's one of the things I missed when I switched from ELI to SLIME years ago. What is its status? I notice the discussion on github about last input vs. last matching input; as I recall, ELI could do both, I think there was a prefix argument for the latter.
I suppose trying this code out would help: https://github.com/slime/slime/pull/184. Does it work for you?
Cheers,
Liam Healy lnp@healy.washington.dc.us writes:
On Fri, Jan 31, 2014 at 9:04 AM, Andrew asm198@gmail.com wrote:
João Távora <joaotavora <at> gmail.com> writes: > Andrew Myers <asm198 <at> gmail.com> writes: > > Here's what I have modified right now. > There is a much, much bigger chance to get this looked at if you make a > github pull request. See the new CONTRIBUTING.md file. > > João
For anyone interested in this, I Just submitted a pull request for it on github. It's been cleaned up and I added a customize option and fixed a few bugs that were in the version I sent out in email. https://github.com/slime/slime/pull/100
I'm interested in this feature; it's one of the things I missed when I switched from ELI to SLIME years ago. What is its status? I notice the discussion on github about last input vs. last matching input; as I recall, ELI could do both, I think there was a prefix argument for the latter.
About a year ago, this was complicated to implement in slime-repl which doesn't use much of Emacs' own comint.el. But I still find this feature interesting and I've implemented it in SLY as demonstrated in this 30 sec video:
https://www.youtube.com/watch?v=Ka4J2v3n57o
I used Robert Goldman's description of the behaviour in https://github.com/slime/slime/pull/100. It also works with reverse i-search.
João
FTR, i also have some years old changes for the repl history that we've been using ever since then:
as documented in the pull request here: https://github.com/slime/slime/pull/84
I've modified slime-repl-history-replace to mimic the eli behavior, is there interest in me tidying this up and submitting a patch to slime with this as an optional alternative to the current history behavior?
Sounds good to me if you can provide a configuration variable to switch between the two options.
But in any case make a pull request on github and we'll handle discussion there.
João