[slime-cvs] CVS update: slime/slime.el
Helmut Eller
heller at common-lisp.net
Tue Jan 13 22:56:10 UTC 2004
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv19882
Modified Files:
slime.el
Log Message:
(slime-input-complete-p): Tolerate extra close parens.
(slime-idle-state): Don't active the repl.
(slime-insert-transcript-delimiter): Insert output before prompt.
(slime-open-stream-to-lisp): Initialize the process-buffer with the
connection buffer.
(slime-repl-activate): Deleted.
(slime-repl-eval-string, slime-repl-show-result,
slime-repl-show-abort): Better handling of abortion.
(slime-compile-file): Insert output before prompt.
Date: Tue Jan 13 17:56:10 2004
Author: heller
Index: slime/slime.el
diff -u slime/slime.el:1.174 slime/slime.el:1.175
--- slime/slime.el:1.174 Mon Jan 12 00:22:11 2004
+++ slime/slime.el Tue Jan 13 17:56:09 2004
@@ -348,18 +348,20 @@
(defun slime-input-complete-p (start end)
"Return t if the region from START to END contains a complete sexp."
- (ignore-errors
- (save-excursion
- (save-restriction
- (narrow-to-region start end)
- (goto-char start)
- ;; Keep stepping over blanks and sexps until the end of buffer
- ;; is reached or an error occurs
- (loop do (or (skip-chars-forward " \t\r\n")
- (looking-at ")")) ; tollerate extra close parens
- until (eobp)
- do (forward-sexp))
- t))))
+ (save-excursion
+ (goto-char start)
+ (cond ((looking-at "\\s *(")
+ (ignore-errors
+ (save-restriction
+ (narrow-to-region start end)
+ ;; Keep stepping over blanks and sexps until the end of
+ ;; buffer is reached or an error occurs. Tolerate extra
+ ;; close parens.
+ (loop do (skip-chars-forward " \t\r\n)")
+ until (eobp)
+ do (forward-sexp))
+ t)))
+ (t t))))
(defun inferior-slime-input-complete-p ()
"Return true if the input is complete in the inferior lisp buffer."
@@ -1531,8 +1533,7 @@
(slime-defstate slime-idle-state ()
"Idle state. The user may make a request, or Lisp may invoke the debugger."
((activate)
- (assert (= (sldb-level) 0))
- (slime-repl-activate))
+ (assert (= (sldb-level) 0)))
((:debug level condition restarts frames)
(slime-push-state
(slime-debugging-state level condition restarts frames
@@ -1779,22 +1780,22 @@
(set-marker (symbol-value markname) (point)))
(set-marker-insertion-type slime-repl-input-end-mark t)
(set-marker-insertion-type slime-output-end t)
+ (set-marker-insertion-type slime-repl-prompt-start-mark t)
(slime-repl-insert-prompt)
(current-buffer)))))
(defun slime-insert-transcript-delimiter (string)
(with-current-buffer (slime-output-buffer)
- (goto-char (point-max))
- (slime-mark-input-end)
- (slime-insert-propertized
- '(slime-transcript-delimiter t)
- ";;;; "
- (subst-char-in-string ?\n ?\
- (substring string 0
- (min 60 (length string))))
- " ...\n")
- (slime-mark-output-start)))
-
+ (save-excursion
+ (goto-char slime-repl-prompt-start-mark)
+ (slime-insert-propertized
+ '(slime-transcript-delimiter t)
+ (if (bolp) "" "\n")
+ ";;;; " (subst-char-in-string ?\n ?\
+ (substring string 0
+ (min 60 (length string))))
+ " ...\n")
+ (slime-mark-output-start))))
(defvar slime-show-last-output-function
'slime-maybe-display-output-buffer
@@ -1828,8 +1829,6 @@
"Display the output buffer and scroll to bottom."
(with-current-buffer (slime-output-buffer)
(goto-char (point-max))
- (slime-mark-input-end)
- (slime-mark-output-start)
(display-buffer (current-buffer) t)))
(defmacro slime-with-output-end-mark (&rest body)
@@ -1859,7 +1858,8 @@
(defun slime-open-stream-to-lisp (port)
(let ((stream (open-network-stream "*lisp-output-stream*"
- nil
+ (slime-with-connection-buffer ()
+ (current-buffer))
"localhost" port)))
(set-process-filter stream 'slime-output-filter)
stream))
@@ -1930,7 +1930,6 @@
(defun slime-repl-insert-prompt ()
(let ((start (point)))
(unless (bolp) (insert "\n"))
- (set-marker slime-repl-prompt-start-mark (point) (current-buffer))
(slime-propertize-region
'(face font-lock-keyword-face
read-only t
@@ -1942,21 +1941,9 @@
start-open t end-open t)
(insert (slime-lisp-package) "> "))
(set-marker slime-output-end start)
+ (set-marker slime-repl-prompt-start-mark (1+ start) (current-buffer))
(slime-mark-input-start)))
-(defun slime-repl-activate ()
- ;; We use the input-end-mark to decide if we should insert a prompt
- ;; or not. We don't print a prompt if input-end-mark at the of the
- ;; buffer. This situation occurs when we are after a slime-space
- ;; command. slime-mark-input-end sets the input-end-mark to some
- ;; position before the end and triggers printing of the prompt.
- (with-current-buffer (slime-output-buffer)
- (unless (= (point-max) slime-repl-input-end-mark)
- (slime-mark-output-end)
- (slime-with-output-end-mark
- (slime-repl-insert-prompt))
- (goto-char (point-max))))) ;;!! is the prompt always the last line??
-
(defun slime-repl-current-input ()
"Return the current input as string. The input is the region from
after the last prompt to the end of buffer."
@@ -1977,9 +1964,10 @@
(setq slime-repl-input-history-position -1))
(defun slime-repl-eval-string (string)
- (slime-eval-async `(swank:listener-eval ,string)
- (slime-lisp-package)
- (slime-repl-show-result-continutation)))
+ (slime-rex ()
+ ((list 'swank:listener-eval string) (slime-lisp-package))
+ ((:ok result) (slime-repl-show-result result))
+ ((:abort) (slime-repl-show-abort))))
(defun slime-repl-send-string (string)
(slime-repl-add-to-input-history string)
@@ -1987,17 +1975,26 @@
(slime-idle-state (slime-repl-eval-string string))
(slime-read-string-state (slime-repl-return-string string))))
-(defun slime-repl-show-result-continutation ()
- ;; This is called _after_ the idle state is activated. This means
- ;; the prompt is already printed.
- (lambda (result)
- (with-current-buffer (slime-output-buffer)
- (save-excursion
- (goto-char slime-repl-prompt-start-mark)
- (let ((start (point)))
- (insert result "\n")
- (set-marker slime-output-end start))))))
+(defun slime-repl-show-result (result)
+ (with-current-buffer (slime-output-buffer)
+ (goto-char (point-max))
+ (let ((start (point)))
+ (insert result "\n")
+ (slime-repl-insert-prompt)
+ (set-marker slime-output-end start))))
+(defun slime-repl-show-abort ()
+ (with-current-buffer (slime-output-buffer)
+ (slime-with-output-end-mark
+ (unless (bolp) (insert "\n"))
+ (insert "; Evaluation aborted\n"))
+ (slime-rex ()
+ ((list 'swank:listener-eval "") nil)
+ ((:ok result) (with-current-buffer (slime-output-buffer)
+ (slime-with-output-end-mark
+ (slime-repl-insert-prompt))
+ (goto-char (point-max)))))))
+
(defun slime-mark-input-start ()
(set-marker slime-repl-last-input-start-mark
(marker-position slime-repl-input-start-mark))
@@ -2330,6 +2327,8 @@
(unless (eq major-mode 'lisp-mode)
(error "Only valid in lisp-mode"))
(save-some-buffers)
+ (slime-insert-transcript-delimiter
+ (format "Compile file %s" (buffer-file-name)))
(slime-display-output-buffer)
(slime-eval-async
`(swank:swank-compile-file ,(buffer-file-name) ,(if load t nil))
More information about the slime-cvs
mailing list