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. :-)