Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.122
diff -p -u -w -r1.122 slime.el
--- slime.el	1 Dec 2003 20:16:55 -0000	1.122
+++ slime.el	1 Dec 2003 23:13:12 -0000
@@ -1531,6 +1531,7 @@ inside a `save-excursion' block."
 (defvar slime-repl-input-end-mark (let ((m (make-marker)))
                                     (set-marker-insertion-type m t)
                                     m))
+(defvar slime-repl-last-mark (make-marker))
 
 (defun slime-repl-mode () 
   "Major mode for interacting with a superior Lisp.
@@ -1612,6 +1613,8 @@ after the last prompt to the end of buff
         (insert result "\n")))))
 
 (defun slime-mark-input-start ()
+  (set-marker slime-repl-last-mark
+              (marker-position slime-repl-input-start-mark))
   (set-marker slime-repl-input-start-mark (point) (current-buffer))
   (set-marker slime-repl-input-end-mark (point) (current-buffer)))
 
@@ -1695,6 +1698,28 @@ earlier in the buffer."
   (slime-repl-delete-current-input)
   (insert-and-inherit string))
 
+(defun slime-real-prompt-start ()
+  (save-excursion
+    (goto-char slime-repl-input-start-mark)
+    (forward-line 0)
+    (point)))
+
+(defun slime-repl-clear-buffer ()
+  (interactive)
+  (set-marker slime-repl-last-mark nil)
+  (let ((inhibit-read-only t))
+    (delete-region (point-min) (slime-real-prompt-start))))
+
+(defun slime-repl-clear-output ()
+  (interactive)
+  (when (marker-position slime-repl-last-mark)
+    (delete-region slime-repl-last-mark
+                   (1- (slime-real-prompt-start)))
+    (save-excursion
+      (goto-char slime-repl-last-mark)
+      (insert ";;; output flushed"))
+    (set-marker slime-repl-last-mark nil)))
+
 ;;; Scratch
 
 (defvar slime-scratch-mode-map)
@@ -1799,6 +1824,8 @@ DIRECTION is 'forward' or 'backward' (in
   ("\t"   'slime-complete-symbol)
   (" "    'slime-space)
   ("\C-\M-x" 'slime-eval-defun)
+  ("\C-c\C-o" 'slime-repl-clear-output)
+  ("\C-c\C-t" 'slime-repl-clear-buffer)
   )
 
 (define-minor-mode slime-repl-read-mode 
@@ -2502,6 +2595,10 @@ package is used."
   ;; NB: It is only the name part of the symbol that we actually want
   ;; to complete -- the package prefix, if given, is just context.
   (interactive)
+  (if (save-excursion
+        (skip-chars-backward "^ \t\n")
+        (= (or (char-after (point)) ?\") ?\"))
+      (comint-dynamic-complete)
   (let* ((end (slime-symbol-end-pos))
          (beg (slime-symbol-start-pos))
          (prefix (buffer-substring-no-properties beg end))
@@ -2532,7 +2639,7 @@ package is used."
                (slime-complete-maybe-save-window-configuration)
                (with-output-to-temp-buffer "*Completions*"
                  (display-completion-list completion-set))
-               (slime-complete-delay-restoration)))))))
+               (slime-complete-delay-restoration))))))))
         
 (defun slime-minibuffer-respecting-message (format &rest format-args)
   "Display TEXT as a message, without hiding any minibuffer contents."
@@ -2858,6 +2965,17 @@ First make the variable unbound, then ev
     (error "No symbol given"))
   (slime-eval-describe `(swank:describe-symbol ,symbol-name)))
 
+(defun slime-documentation (symbol-name)
+"Display function- or symbol-documentation for SYMBOL-NAME or, if
+none exists, display the description, like
+``slime-describe-symbol''."
+  (interactive (list (slime-read-symbol-name "Documentation for symbol: ")))
+  (when (not symbol-name)
+    (error "No symbol given"))
+  (slime-eval-describe
+   `(cl:or (swank:documentation-symbol ,symbol-name)
+	   (swank:describe-symbol ,symbol-name))))
+
 (defun slime-describe-function (symbol-name)
   (interactive (list (slime-read-symbol-name "Describe symbol: ")))
   (when (not symbol-name)
@@ -3213,6 +3331,9 @@ CL:MACROEXPAND."
 
 (defun slime-set-default-directory (directory)
   (interactive (list (read-file-name "Directory: " nil default-directory t)))
+  (save-excursion
+    (set-buffer (get-buffer "*slime-repl*"))
+    (setq default-directory (expand-file-name directory)))
   (message "default-directory: %s" 
 	   (slime-eval `(swank:set-default-directory 
 			 ,(expand-file-name directory)))))
