[slime-cvs] CVS slime
mbaringer
mbaringer at common-lisp.net
Wed Dec 6 11:50:36 UTC 2006
Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv30134
Modified Files:
slime.el
Log Message:
(slime-search-buffer-package): Don't call
match-string-no-properties if it's not defined (as is on some
xemacs')
(slime-repl-clear-buffer): Added optional prefix argument
specifying how many lines to leave.
--- /project/slime/cvsroot/slime/slime.el 2006/12/05 14:36:04 1.696
+++ /project/slime/cvsroot/slime/slime.el 2006/12/06 11:50:36 1.697
@@ -2514,7 +2514,11 @@
(save-excursion
(when (or (re-search-backward regexp nil t)
(re-search-forward regexp nil t))
- (let ((string (match-string-no-properties 2)))
+ (let ((string (if (fboundp 'match-string-no-properties)
+ (match-string-no-properties 2)
+ (buffer-substring-no-properties
+ (match-beginning 2)
+ (match-end 2)))))
(cond ((string-match "^\"" string) (ignore-errors (read string)))
((string-match "^#?:" string) (substring string (match-end 0)))
(t string)))))))
@@ -3898,14 +3902,31 @@
(goto-char slime-repl-input-start-mark)
(line-beginning-position)))
-(defun slime-repl-clear-buffer ()
- "Delete the entire output generated by the Lisp process."
- (interactive)
- (slime-eval-async `(swank:clear-repl-results))
- (set-marker slime-repl-last-input-start-mark nil)
- (let ((inhibit-read-only t))
- (delete-region (point-min) (slime-repl-input-line-beginning-position))
- (goto-char slime-repl-input-start-mark)))
+(defun slime-repl-clear-buffer (&optional num-lines)
+ "Delete the output generated by the Lisp process.
+
+NUM-LINES, if provided, specifies the number of lines before the
+repl's input line to leave. Specifying NUM-LINES causes swank to
+remember the repl results so some memory leaking is possible."
+ (interactive "P")
+ (let ((effective-num-lines (cond
+ ((null num-lines) nil)
+ ((consp num-lines) (first num-lines))
+ ((integerp num-lines) num-lines)
+ ((eql '- num-lines) -1))))
+ (unless effective-num-lines
+ (slime-eval-async `(swank:clear-repl-results)))
+ (set-marker slime-repl-last-input-start-mark nil)
+ (let ((inhibit-read-only t))
+ (delete-region (point-min)
+ (if num-lines
+ (save-excursion
+ (goto-char slime-repl-input-start-mark)
+ (forward-line (- effective-num-lines))
+ (beginning-of-line)
+ (point))
+ (slime-repl-input-line-beginning-position)))
+ (goto-char slime-repl-input-start-mark))))
(defun slime-repl-clear-output ()
"Delete the output inserted since the last input."
More information about the slime-cvs
mailing list