[slime-cvs] CVS slime/contrib

CVS User sboukarev sboukarev at common-lisp.net
Fri Nov 20 15:48:18 UTC 2009


Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv7952/contrib

Modified Files:
	ChangeLog slime-repl.el 
Log Message:
contrib/slime-repl.el:
(slime-repl-position-in-history): Add new optional
parameter `exclude-string'.
(slime-repl-history-replace): Don't replace history item if it's exactly
matching the current input, search for the next match instead.


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2009/11/19 13:37:45	1.278
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2009/11/20 15:48:18	1.279
@@ -1,3 +1,10 @@
+2009-11-20  Stas Boukarev  <stassats at gmail.com>
+
+	* slime-repl.el (slime-repl-position-in-history): Add new optional
+	parameter `exclude-string'.
+	(slime-repl-history-replace): Don't replace history item if it's exactly
+	matching the current input, search for the next match instead.
+
 2009-11-19  Tobias C. Rittweiler  <tcr at freebits.de>
 
 	* slime-asdf.el (slime-query-replace-system): Enable TAB
--- /project/slime/cvsroot/slime/contrib/slime-repl.el	2009/10/15 16:40:38	1.29
+++ /project/slime/cvsroot/slime/contrib/slime-repl.el	2009/11/20 15:48:18	1.30
@@ -896,7 +896,8 @@
          (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 "")))
+         (pos (slime-repl-position-in-history pos0 direction (or regexp "")
+                                              (slime-repl-current-input)))
          (msg nil))
     (cond ((and (< min-pos pos) (< pos max-pos))
            (slime-repl-replace-input (nth pos slime-repl-input-history))
@@ -922,9 +923,11 @@
 (defun slime-repl-terminate-history-search ()
   (setq last-command this-command))
 
-(defun slime-repl-position-in-history (start-pos direction regexp)
-  "Return the position of the history item matching regexp.
-Return -1 resp. the length of the history if no item matches"
+(defun slime-repl-position-in-history (start-pos direction regexp
+                                       &optional exclude-string)
+  "Return the position of the history item matching REGEXP.
+Return -1 resp. the length of the history if no item matches.
+If EXCLUDE-STRING is specified then it's excluded from the search."
   ;; Loop through the history list looking for a matching line
   (let* ((step (ecase direction
                  (forward -1)
@@ -934,7 +937,10 @@
     (loop for pos = (+ start-pos step) then (+ pos step)
           if (< pos 0) return -1
           if (<= len pos) return len
-          if (string-match regexp (nth pos history)) return pos)))
+          for history-item = (nth pos history)
+          if (and (string-match regexp history-item)
+                  (not (equal history-item exclude-string)))
+          return pos)))
 
 (defun slime-repl-previous-input ()
   "Cycle backwards through input history.





More information about the slime-cvs mailing list