From heller at common-lisp.net Fri Nov 4 09:04:43 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 4 Nov 2005 10:04:43 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20051104090443.5CE6A8855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22402 Modified Files: swank.lisp Log Message: (connection-info): Docfix. Date: Fri Nov 4 10:04:42 2005 Author: heller Index: slime/swank.lisp diff -u slime/swank.lisp:1.350 slime/swank.lisp:1.351 --- slime/swank.lisp:1.350 Mon Oct 31 09:22:11 2005 +++ slime/swank.lisp Fri Nov 4 10:04:40 2005 @@ -1081,7 +1081,7 @@ \(&key PID STYLE LISP-IMPLEMENTATION MACHINE FEATURES PACKAGE) PID: is the process-id of Lisp process (or nil, depending on the STYLE) STYLE: the communication style -LISP-IMPLEMENTATION: a list (&key TYPE TYPE-NAME VERSION) +LISP-IMPLEMENTATION: a list (&key TYPE NAME VERSION) FEATURES: a list of keywords PACKAGE: a list (&key NAME PROMPT)" (setq *slime-features* *features*) From heller at common-lisp.net Fri Nov 4 09:06:30 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 4 Nov 2005 10:06:30 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051104090630.CF5808855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22442 Modified Files: slime.el Log Message: (slime-set-connection-info): Generate a new connection name only if the implementation-name and the inferior-lisp-name are different. Date: Fri Nov 4 10:06:30 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.560 slime/slime.el:1.561 --- slime/slime.el:1.560 Mon Oct 31 09:21:52 2005 +++ slime/slime.el Fri Nov 4 10:06:29 2005 @@ -2036,8 +2036,9 @@ (setq slime-state-name "") ; FIXME (when-let (p (slime-inferior-process)) (when-let (name (plist-get (slime-inferior-lisp-args p) ':name)) - (setf (slime-connection-name) - (slime-generate-connection-name (symbol-name name))))) + (unless (string= (slime-lisp-implementation-name) name) + (setf (slime-connection-name) + (slime-generate-connection-name (symbol-name name)))))) (slime-hide-inferior-lisp-buffer) (slime-init-output-buffer connection) (run-hooks 'slime-connected-hook) From heller at common-lisp.net Fri Nov 4 09:07:44 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 4 Nov 2005 10:07:44 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051104090744.927F48855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22467 Modified Files: ChangeLog Log Message: Date: Fri Nov 4 10:07:43 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.804 slime/ChangeLog:1.805 --- slime/ChangeLog:1.804 Mon Oct 31 09:26:54 2005 +++ slime/ChangeLog Fri Nov 4 10:07:43 2005 @@ -1,3 +1,11 @@ +2005-11-04 Helmut Eller + + * swank.lisp (connection-info): Docfix. + + * slime.el (slime-set-connection-info): Generate a new connection + name only if the implementation-name and the inferior-lisp-name + are different. + 2005-10-31 Helmut Eller * slime.el (slime-start, slime-lookup-lisp-implementation) From jsnellman at common-lisp.net Sun Nov 6 09:09:50 2005 From: jsnellman at common-lisp.net (Juho Snellman) Date: Sun, 6 Nov 2005 10:09:50 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/swank-sbcl.lisp Message-ID: <20051106090950.BF3F388545@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv2339 Modified Files: ChangeLog swank-sbcl.lisp Log Message: swank-sbcl.lisp (find-definitions, make-source-location-specification make-definition-source-location, source-hint-snippet): As of SBCL 0.9.6.25 SB-INTROSPECT has better support for finding source locations. Use as much of it in swank-sbcl as possible. (Original version left reader-conditionalized for older SBCLs). Date: Sun Nov 6 10:09:48 2005 Author: jsnellman Index: slime/ChangeLog diff -u slime/ChangeLog:1.805 slime/ChangeLog:1.806 --- slime/ChangeLog:1.805 Fri Nov 4 10:07:43 2005 +++ slime/ChangeLog Sun Nov 6 10:09:47 2005 @@ -1,3 +1,11 @@ +2005-11-06 Juho Snellman + + * swank-sbcl.lisp (find-definitions, make-source-location-specification + make-definition-source-location, source-hint-snippet): As of + SBCL 0.9.6.25 SB-INTROSPECT has better support for finding + source locations. Use as much of it in swank-sbcl as possible. + (Original version left reader-conditionalized for older SBCLs). + 2005-11-04 Helmut Eller * swank.lisp (connection-info): Docfix. Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.148 slime/swank-sbcl.lisp:1.149 --- slime/swank-sbcl.lisp:1.148 Sun Oct 23 10:47:54 2005 +++ slime/swank-sbcl.lisp Sun Nov 6 10:09:48 2005 @@ -395,6 +395,108 @@ "When true don't handle errors while looking for definitions. This is useful when debugging the definition-finding code.") +;;; As of SBCL 0.9.7 most of the gritty details of source location handling +;;; are supported reasonably well by SB-INTROSPECT. + +;;; SBCL > 0.9.6 +#+#.(cl:if (cl:find-symbol "FIND-DEFINITION-SOURCES-BY-NAME" "SB-INTROSPECT") + '(and) + '(or)) +(progn + +(defparameter *definition-types* + '(:variable defvar + :constant defconstant + :type deftype + :symbol-macro define-symbol-macro + :macro defmacro + :compiler-macro define-compiler-macro + :function defun + :generic-function defgeneric + :method defmethod + :setf-expander define-setf-expander + :structure defstruct + :condition defcondition + :class defclass + :method-combination define-method-combination + :package defpackage + :transform :deftransform + :optimizer :defoptimizer + :vop :define-vop + :source-transform :define-source-transform) + "Map SB-INTROSPECT definition type names to Slime-friendly forms") + +(defimplementation find-definitions (name) + (loop for type in *definition-types* by #'cddr + for locations = (sb-introspect:find-definition-sources-by-name + name type) + append (loop for source-location in locations collect + (make-source-location-specification type name + source-location)))) + +(defun make-source-location-specification (type name source-location) + (list (list* (getf *definition-types* type) + name + (sb-introspect::definition-source-description source-location)) + (if *debug-definition-finding* + (make-definition-source-location source-location type name) + (handler-case (make-definition-source-location source-location + type name) + (error (e) + (list :error (format nil "Error: ~A" e))))))) + +(defun make-definition-source-location (definition-source type name) + (with-struct (sb-introspect::definition-source- + pathname form-path character-offset plist + file-write-date) + definition-source + (destructuring-bind (&key emacs-buffer emacs-position + emacs-string &allow-other-keys) + plist + (cond + (emacs-buffer + (let ((pos (if form-path + (with-debootstrapping + (source-path-string-position + form-path emacs-string)) + character-offset))) + (make-location `(:buffer ,emacs-buffer) + `(:position ,(+ pos emacs-position)) + `(:snippet ,emacs-string)))) + ((not pathname) + `(:error ,(format nil "Source of ~A ~A not found" + (string-downcase type) name))) + (t + (let* ((namestring (namestring (translate-logical-pathname pathname))) + (*readtable* (guess-readtable-for-filename namestring)) + (pos (1+ (with-debootstrapping + ;; Some internal functions have no source path + ;; or offset available, just the file (why?). + ;; In these cases we can at least try to open + ;; the right file. + (if form-path + (source-path-file-position form-path + pathname) + 0)))) + (snippet (source-hint-snippet namestring + file-write-date pos))) + (make-location `(:file ,namestring) + `(:position ,pos) + `(:snippet ,snippet)))))))) + +(defun source-hint-snippet (filename write-date position) + (let ((source (get-source-code filename write-date))) + (with-input-from-string (s source) + (read-snippet s position)))) + +) ;; End >0.9.6 + +;;; Support for SBCL 0.9.6 and earlier. Feel free to delete this +;;; after January 2006. +#-#.(cl:if (cl:find-symbol "FIND-DEFINITION-SOURCES-BY-NAME" "SB-INTROSPECT") + '(and) + '(or)) +(progn (defimplementation find-definitions (name) (append (function-definitions name) (compiler-definitions name))) @@ -546,6 +648,7 @@ for fn = (funcall reader fun-info) when fn collect `((sb-c:defoptimizer ,name) ,(safe-function-source-location fn fun-name))))) +) ;; End SBCL <= 0.9.6 compability (defimplementation describe-symbol-for-emacs (symbol) "Return a plist describing SYMBOL. From heller at common-lisp.net Mon Nov 7 08:24:34 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 7 Nov 2005 09:24:34 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-source-path-parser.lisp Message-ID: <20051107082434.D3B88880DB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5034 Modified Files: swank-source-path-parser.lisp Log Message: (make-source-recording-readtable): Suppress the #. reader-macro. (suppress-sharp-dot): New function. (read-source-form): Disable *read-eval*. (*source-map*): Deleted. We can do everything with a lexical variable. Date: Mon Nov 7 09:24:33 2005 Author: heller Index: slime/swank-source-path-parser.lisp diff -u slime/swank-source-path-parser.lisp:1.15 slime/swank-source-path-parser.lisp:1.16 --- slime/swank-source-path-parser.lisp:1.15 Mon Aug 29 22:02:58 2005 +++ slime/swank-source-path-parser.lisp Mon Nov 7 09:24:32 2005 @@ -56,25 +56,30 @@ (when fn (set-macro-character char (make-source-recorder fn source-map) term tab))))) + (suppress-sharp-dot tab) tab)) -(defvar *source-map* nil - "The hashtable table used for source position recording.") +(defun suppress-sharp-dot (readtable) + (when (get-macro-character #\# readtable) + (let ((sharp-dot (get-dispatch-macro-character #\# #\. readtable))) + (set-dispatch-macro-character #\# #\. (lambda (&rest args) + (let ((*read-suppress* t)) + (apply sharp-dot args))) + readtable)))) (defun read-and-record-source-map (stream) "Read the next object from STREAM. Return the object together with a hashtable that maps subexpressions of the object to stream positions." - (let* ((*source-map* (make-hash-table :test #'eq)) - (*readtable* (make-source-recording-readtable *readtable* - *source-map*)) + (let* ((source-map (make-hash-table :test #'eq)) + (*readtable* (make-source-recording-readtable *readtable* source-map)) (start (file-position stream)) (form (read stream)) (end (file-position stream))) ;; ensure that at least FORM is in the source-map - (unless (gethash form *source-map*) - (push (cons start end) (gethash form *source-map*))) - (values form *source-map*))) + (unless (gethash form source-map) + (push (cons start end) (gethash form source-map))) + (values form source-map))) (defun read-source-form (n stream) "Read the Nth toplevel form number with source location recording. @@ -82,7 +87,8 @@ (let ((*read-suppress* t)) (dotimes (i n) (read stream))) - (let ((*read-suppress* nil)) + (let ((*read-suppress* nil) + (*read-eval* nil)) (read-and-record-source-map stream))) (defun source-path-stream-position (path stream) From heller at common-lisp.net Mon Nov 7 08:28:35 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 7 Nov 2005 09:28:35 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051107082835.C9604880DB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5091 Modified Files: slime.el Log Message: (slime-eval-macroexpand): Use lisp-mode (and font-lock-mode) when dispaying the expansion. Suggested by Jan Rychter. Date: Mon Nov 7 09:28:35 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.561 slime/slime.el:1.562 --- slime/slime.el:1.561 Fri Nov 4 10:06:29 2005 +++ slime/slime.el Mon Nov 7 09:28:34 2005 @@ -6580,7 +6580,8 @@ (hyperspec-lookup symbol-name)) (defun slime-show-description (string package) - (slime-with-output-to-temp-buffer ("*SLIME Description*") package (princ string))) + (slime-with-output-to-temp-buffer ("*SLIME Description*") + package (princ string))) (defun slime-describe-symbol (symbol-name) "Describe the symbol at point." @@ -6954,8 +6955,12 @@ ;;;; Macroexpansion (defun slime-eval-macroexpand (expander) - (let ((string (slime-sexp-at-point))) - (slime-eval-describe `(,expander ,string)))) + (lexical-let ((package (slime-current-package))) + (slime-eval-async `(,expander ,(slime-sexp-at-point)) + (lambda (expansion) + (slime-with-output-to-temp-buffer + ("*SLIME macroexpansion*" lisp-mode) package + (insert expansion)))))) (defun slime-macroexpand-1 (&optional repeatedly) "Display the macro expansion of the form at point. The form is From heller at common-lisp.net Mon Nov 7 08:30:04 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 7 Nov 2005 09:30:04 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051107083004.78628880DB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5128 Modified Files: ChangeLog Log Message: Date: Mon Nov 7 09:30:01 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.806 slime/ChangeLog:1.807 --- slime/ChangeLog:1.806 Sun Nov 6 10:09:47 2005 +++ slime/ChangeLog Mon Nov 7 09:30:00 2005 @@ -1,3 +1,12 @@ +2005-11-07 Helmut Eller + + * slime.el (slime-eval-macroexpand): Use lisp-mode (and + font-lock-mode) when dispaying the expansion. Suggested by Jan + Rychter. + + * swank-source-path-parser.lisp (make-source-recording-readtable): + Suppress the #. reader-macro. + 2005-11-06 Juho Snellman * swank-sbcl.lisp (find-definitions, make-source-location-specification From heller at common-lisp.net Fri Nov 11 23:43:51 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 12 Nov 2005 00:43:51 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-backend.lisp slime/swank-cmucl.lisp slime/swank-sbcl.lisp slime/swank-openmcl.lisp slime/swank-clisp.lisp slime/swank-lispworks.lisp slime/swank-allegro.lisp slime/swank-corman.lisp slime/swank-scl.lisp slime/swank-ecl.lisp Message-ID: <20051111234351.0E33A88556@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6556 Modified Files: swank-backend.lisp swank-cmucl.lisp swank-sbcl.lisp swank-openmcl.lisp swank-clisp.lisp swank-lispworks.lisp swank-allegro.lisp swank-corman.lisp swank-scl.lisp swank-ecl.lisp Log Message: (accept-connection): New argument: buffering. Date: Sat Nov 12 00:43:46 2005 Author: heller Index: slime/swank-backend.lisp diff -u slime/swank-backend.lisp:1.92 slime/swank-backend.lisp:1.93 --- slime/swank-backend.lisp:1.92 Sun Oct 23 10:47:54 2005 +++ slime/swank-backend.lisp Sat Nov 12 00:43:43 2005 @@ -211,9 +211,10 @@ (definterface close-socket (socket) "Close the socket SOCKET.") -(definterface accept-connection (socket &key external-format) - "Accept a client connection on the listening socket SOCKET. Return -a stream for the new connection.") +(definterface accept-connection (socket &key external-format + buffering) + "Accept a client connection on the listening socket SOCKET. +Return a stream for the new connection.") (definterface add-sigio-handler (socket fn) "Call FN whenever SOCKET is readable.") Index: slime/swank-cmucl.lisp diff -u slime/swank-cmucl.lisp:1.156 slime/swank-cmucl.lisp:1.157 --- slime/swank-cmucl.lisp:1.156 Sun Oct 9 21:13:03 2005 +++ slime/swank-cmucl.lisp Sat Nov 12 00:43:43 2005 @@ -94,13 +94,15 @@ (nth-value 1 (ext::get-socket-host-and-port (socket-fd socket)))) (defimplementation close-socket (socket) - (sys:invalidate-descriptor socket) - (ext:close-socket (socket-fd socket))) + (let ((fd (socket-fd socket))) + (sys:invalidate-descriptor fd) + (ext:close-socket fd))) -(defimplementation accept-connection (socket &key external-format) - (let ((ef (or external-format :iso-latin-1-unix))) - (assert (eq ef ':iso-latin-1-unix)) - (make-socket-io-stream (ext:accept-tcp-connection socket)))) +(defimplementation accept-connection (socket &key + (external-format :iso-latin-1-unix) + (buffering :full)) + (assert (eq external-format ':iso-latin-1-unix)) + (make-socket-io-stream (ext:accept-tcp-connection socket) buffering)) ;;;;; Sockets @@ -115,9 +117,10 @@ (let ((hostent (ext:lookup-host-entry hostname))) (car (ext:host-entry-addr-list hostent)))) -(defun make-socket-io-stream (fd) +(defun make-socket-io-stream (fd buffering) "Create a new input/output fd-stream for FD." - (sys:make-fd-stream fd :input t :output t :element-type 'base-char)) + (sys:make-fd-stream fd :input t :output t :element-type 'base-char + :buffering buffering)) ;;;;; Signal-driven I/O @@ -189,21 +192,23 @@ (print-unreadable-object (s stream :type t :identity t))) (defun sos/out (stream char) - (let ((buffer (sos.buffer stream)) - (index (sos.index stream))) - (setf (schar buffer index) char) - (setf (sos.index stream) (1+ index)) - (incf (sos.column stream)) - (when (char= #\newline char) - (setf (sos.column stream) 0) - (force-output stream)) - (when (= index (1- (length buffer))) - (finish-output stream))) - char) + (system:without-interrupts + (let ((buffer (sos.buffer stream)) + (index (sos.index stream))) + (setf (schar buffer index) char) + (setf (sos.index stream) (1+ index)) + (incf (sos.column stream)) + (when (char= #\newline char) + (setf (sos.column stream) 0) + (force-output stream)) + (when (= index (1- (length buffer))) + (finish-output stream))) + char)) (defun sos/sout (stream string start end) - (loop for i from start below end - do (sos/out stream (aref string i)))) + (system:without-interrupts + (loop for i from start below end + do (sos/out stream (aref string i))))) (defun log-stream-op (stream operation) stream operation @@ -220,12 +225,13 @@ (case operation (:finish-output (log-stream-op stream operation) - (let ((end (sos.index stream))) - (unless (zerop end) - (let ((s (subseq (sos.buffer stream) 0 end))) - (setf (sos.index stream) 0) - (funcall (sos.output-fn stream) s)) - (setf (sos.last-flush-time stream) (get-internal-real-time)))) + (system:without-interrupts + (let ((end (sos.index stream))) + (unless (zerop end) + (let ((s (subseq (sos.buffer stream) 0 end))) + (setf (sos.index stream) 0) + (funcall (sos.output-fn stream) s)) + (setf (sos.last-flush-time stream) (get-internal-real-time))))) nil) (:force-output (log-stream-op stream operation) @@ -240,16 +246,17 @@ (t (format *terminal-io* "~&~Astream: ~S~%" stream operation)))) (defun sos/misc-force-output (stream) - (unless (or (zerop (sos.index stream)) - (loop with buffer = (sos.buffer stream) - for i from 0 below (sos.index stream) - always (char= (aref buffer i) #\newline))) - (let ((last (sos.last-flush-time stream)) - (now (get-internal-real-time))) - (when (> (/ (- now last) - (coerce internal-time-units-per-second 'double-float)) - 0.1) - (finish-output stream))))) + (system:without-interrupts + (unless (or (zerop (sos.index stream)) + (loop with buffer = (sos.buffer stream) + for i from 0 below (sos.index stream) + always (char= (aref buffer i) #\newline))) + (let ((last (sos.last-flush-time stream)) + (now (get-internal-real-time))) + (when (> (/ (- now last) + (coerce internal-time-units-per-second 'double-float)) + 0.1) + (finish-output stream)))))) (defstruct (slime-input-stream (:include string-stream @@ -1864,7 +1871,7 @@ (loop for value in parts for i from 0 append (label-value-line i value)))))) -(defmethod inspect-for-emacs :around ((o function) (inspector cmucl-inspector)) +(defmethod inspect-for-emacs ((o function) (inspector cmucl-inspector)) (declare (ignore inspector)) (let ((header (kernel:get-type o))) (cond ((= header vm:function-header-type) @@ -1945,7 +1952,7 @@ (:displaced-p (kernel:%array-displaced-p o)) (:dimensions (array-dimensions o))))) -(defmethod inspect-for-emacs ((o vector) (inspector cmucl-inspector)) +(defmethod inspect-for-emacs ((o simple-vector) (inspector cmucl-inspector)) inspector (values (format nil "~A is a vector." o) (append Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.149 slime/swank-sbcl.lisp:1.150 --- slime/swank-sbcl.lisp:1.149 Sun Nov 6 10:09:48 2005 +++ slime/swank-sbcl.lisp Sat Nov 12 00:43:43 2005 @@ -58,9 +58,10 @@ (sb-sys:invalidate-descriptor (socket-fd socket)) (sb-bsd-sockets:socket-close socket)) -(defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) - (make-socket-io-stream (accept socket) external-format)) +(defimplementation accept-connection (socket &key + (external-format :iso-latin-1-unix) + (buffering :full)) + (make-socket-io-stream (accept socket) external-format buffering)) (defvar *sigio-handlers* '() "List of (key . fn) pairs to be called on SIGIO.") @@ -115,12 +116,13 @@ (:utf-8-unix :utf-8) (:euc-jp-unix :euc-jp))) -(defun make-socket-io-stream (socket external-format) +(defun make-socket-io-stream (socket external-format buffering) (let ((ef (find-external-format external-format))) (sb-bsd-sockets:socket-make-stream socket :output t :input t :element-type 'character + :buffering buffering #+sb-unicode :external-format #+sb-unicode ef ))) Index: slime/swank-openmcl.lisp diff -u slime/swank-openmcl.lisp:1.102 slime/swank-openmcl.lisp:1.103 --- slime/swank-openmcl.lisp:1.102 Thu Sep 22 22:20:43 2005 +++ slime/swank-openmcl.lisp Sat Nov 12 00:43:43 2005 @@ -128,7 +128,9 @@ (close socket)) (defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) + &key (external-format :iso-latin-1-unix) + buffering) + (declare (ignore buffering)) (assert (eq external-format :iso-latin-1-unix)) (ccl:accept-connection socket :wait t)) @@ -771,8 +773,6 @@ (defimplementation spawn (fn &key name) (ccl:process-run-function (or name "Anonymous (Swank)") fn)) - -(defimplementation startup-multiprocessing ()) (defimplementation thread-id (thread) (ccl::process-serial-number thread)) Index: slime/swank-clisp.lisp diff -u slime/swank-clisp.lisp:1.56 slime/swank-clisp.lisp:1.57 --- slime/swank-clisp.lisp:1.56 Thu Sep 15 10:17:38 2005 +++ slime/swank-clisp.lisp Sat Nov 12 00:43:43 2005 @@ -125,7 +125,9 @@ (ext:make-encoding :charset charset :line-terminator :unix))) (defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) + &key (external-format :iso-latin-1-unix) + buffering) + (declare (ignore buffering)) (socket:socket-accept socket :buffered nil ;; XXX should be t :element-type 'character @@ -234,9 +236,9 @@ (defvar *sldb-backtrace*) (defimplementation call-with-debugging-environment (debugger-loop-fn) - (let* ((sys::*break-count* (1+ sys::*break-count*)) - (sys::*driver* debugger-loop-fn) - (sys::*fasoutput-stream* nil) + (let* (;;(sys::*break-count* (1+ sys::*break-count*)) + ;;(sys::*driver* debugger-loop-fn) + ;;(sys::*fasoutput-stream* nil) (*sldb-backtrace* (nthcdr 6 (sldb-backtrace)))) (funcall debugger-loop-fn))) Index: slime/swank-lispworks.lisp diff -u slime/swank-lispworks.lisp:1.80 slime/swank-lispworks.lisp:1.81 --- slime/swank-lispworks.lisp:1.80 Tue Sep 27 23:50:38 2005 +++ slime/swank-lispworks.lisp Sat Nov 12 00:43:43 2005 @@ -66,7 +66,9 @@ (comm::close-socket (socket-fd socket))) (defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) + &key (external-format :iso-latin-1-unix) + buffering) + (declare (ignore buffering)) (assert (eq external-format :iso-latin-1-unix)) (let* ((fd (comm::get-fd-from-socket socket))) (assert (/= fd -1)) Index: slime/swank-allegro.lisp diff -u slime/swank-allegro.lisp:1.79 slime/swank-allegro.lisp:1.80 --- slime/swank-allegro.lisp:1.79 Tue Oct 11 00:24:28 2005 +++ slime/swank-allegro.lisp Sat Nov 12 00:43:43 2005 @@ -41,7 +41,8 @@ (defimplementation close-socket (socket) (close socket)) -(defimplementation accept-connection (socket &key external-format) +(defimplementation accept-connection (socket &key external-format buffering) + (declare (ignore buffering)) (let ((ef (or external-format :iso-latin-1-unix)) (s (socket:accept-connection socket :wait t))) (set-external-format s ef) Index: slime/swank-corman.lisp diff -u slime/swank-corman.lisp:1.4 slime/swank-corman.lisp:1.5 --- slime/swank-corman.lisp:1.4 Tue Jul 5 22:30:59 2005 +++ slime/swank-corman.lisp Sat Nov 12 00:43:43 2005 @@ -238,7 +238,9 @@ (close socket)) (defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) + &key (external-format :iso-latin-1-unix) + buffering) + (declare (ignore buffering)) (ecase external-format (:iso-latin-1-unix (sockets:make-socket-stream (sockets:accept-socket socket))))) Index: slime/swank-scl.lisp diff -u slime/swank-scl.lisp:1.1 slime/swank-scl.lisp:1.2 --- slime/swank-scl.lisp:1.1 Fri Oct 14 20:02:23 2005 +++ slime/swank-scl.lisp Sat Nov 12 00:43:43 2005 @@ -52,7 +52,8 @@ (defimplementation close-socket (socket) (ext:close-socket (socket-fd socket))) -(defimplementation accept-connection (socket &key external-format) +(defimplementation accept-connection (socket &key external-format buffering) + (declare (ignore buffering)) (let ((external-format (or external-format :iso-latin-1-unix))) (make-socket-io-stream (ext:accept-tcp-connection socket) external-format))) Index: slime/swank-ecl.lisp diff -u slime/swank-ecl.lisp:1.3 slime/swank-ecl.lisp:1.4 --- slime/swank-ecl.lisp:1.3 Thu Sep 22 22:20:43 2005 +++ slime/swank-ecl.lisp Sat Nov 12 00:43:43 2005 @@ -45,7 +45,9 @@ (sb-bsd-sockets:socket-close socket)) (defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) + &key (external-format :iso-latin-1-unix) + buffering) + (declare (ignore buffering)) (assert (eq external-format :iso-latin-1-unix)) (make-socket-io-stream (accept socket) external-format)) From heller at common-lisp.net Fri Nov 11 23:45:42 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 12 Nov 2005 00:45:42 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051111234542.3D4DB88556@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6630 Modified Files: slime.el Log Message: (slime-repl-save-history): When the history exceeds slime-repl-history-size remove the old not the new entries. Some renaming: slime-repl-read-history -> slime-repl-load-history, slime-repl-read-history-internal -> slime-repl-read-history. (slime-eval-macroexpand): Call font-lock-fontify-buffer explicitly, because with certain Emacs versions the buffer doesn't get fontified immediately. Date: Sat Nov 12 00:45:41 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.562 slime/slime.el:1.563 --- slime/slime.el:1.562 Mon Nov 7 09:28:34 2005 +++ slime/slime.el Sat Nov 12 00:45:41 2005 @@ -441,7 +441,7 @@ :type 'string :group 'slime-repl) -(defcustom slime-repl-history-size 100 +(defcustom slime-repl-history-size 1000 "Maximum number of lines for persistent REPL history." :type 'integer :group 'slime-repl) @@ -2914,7 +2914,7 @@ (setq slime-current-thread :repl-thread) (set (make-local-variable 'scroll-conservatively) 20) (set (make-local-variable 'scroll-margin) 0) - (slime-repl-read-history) + (slime-repl-load-history) (make-local-hook 'kill-buffer-hook) (add-hook 'kill-buffer-hook 'slime-repl-save-merged-history nil t) (add-hook 'kill-emacs-hook 'slime-repl-save-all-histories) @@ -3688,8 +3688,8 @@ ;;;;; Persistent History (defun slime-repl-merge-histories (old-hist new-hist) - "Merge entries from OLD-HIST and NEW-HIST such that the new items in - NEW-HIST are appended to the OLD-HIST." + "Merge entries from OLD-HIST and NEW-HIST." + ;; Newer items in each list are at the beginning. (append ;; first the new unique elements... (remove-if #'(lambda (entry) @@ -3704,80 +3704,60 @@ (not (member entry old-hist))) new-hist))) -(defun slime-repl-read-history-internal (filename) - "Return the list stored in FILENAME. -The file contents are read using READ and no further error checking is -done." - (when (and file (file-readable-p file)) - (with-temp-buffer - (insert-file-contents file) - (read (current-buffer))))) - -(defun slime-repl-read-history (&optional filename) +(defun slime-repl-load-history (&optional filename) "Set the current SLIME REPL history. It can be read either from FILENAME or `slime-repl-history-file' or from a user defined filename." - (interactive) - (let ((file (or filename - slime-repl-history-file - (read-file-name "Read SLIME REPL history from file: ")))) - (setq slime-repl-input-history - (slime-repl-read-history-internal file)))) - + (interactive (list (slime-repl-read-history-filename))) + (let ((file (or filename slime-repl-history-file))) + (setq slime-repl-input-history (slime-repl-read-history file t)))) + +(defun slime-repl-read-history (&optional filename noerrer) + "Read and return the history from FILENAME. +The default value for FILENAME is `slime-repl-history-file'. +If NOERROR is true return and the file doesn't exits return nil." + (let ((file (or filename slime-repl-history-file))) + (cond ((not (file-readable-p file)) '()) + (t (with-temp-buffer + (insert-file-contents-literally file) + (read (current-buffer))))))) + +(defun slime-repl-read-history-filename () + (read-file-name "Use SLIME REPL history from file: " + slime-repl-history-file)) + (defun slime-repl-save-merged-history (&optional filename) "Read the history file, merge the current REPL history and save it. This tries to be smart in merging the history from the file and the current history in that it tries to detect the unique entries using `slime-repl-merge-histories'." - (interactive) - (message "saving history...") - (let ((file (or filename - slime-repl-history-file - (read-file-name "Save SLIME REPL history to file: ")))) - (cond - ((or (null file) - (null slime-repl-input-history)) - nil) - ((not (file-writable-p file)) - (error (format "Can't write SLIME REPL history file %s" file))) - (t - (let ((hist (slime-repl-read-history-internal file))) - (if (not (null hist)) - (setq hist (slime-repl-merge-histories - hist slime-repl-input-history)) - (setq hist slime-repl-input-history)) - (slime-repl-save-history hist file)))))) + (interactive (list (slime-repl-read-history-filename))) + (let ((file (or filename slime-repl-history-file))) + (message "saving history...") + (let ((hist (slime-repl-merge-histories (slime-repl-read-history file t) + slime-repl-input-history))) + (slime-repl-save-history file hist)))) -(defun slime-repl-save-history (&optional history filename) +(defun slime-repl-save-history (&optional filename history) "Simply save the current SLIME REPL history to a file. When SLIME is setup to always load the old history and one uses only one instance of slime all the time, there is no need to merge the files and this function is sufficient. When the list is longer than `slime-repl-history-size' it will be -truncated. That part is untested, though! -" - (interactive) - (let ((file (or filename - slime-repl-history-file - (read-file-name "Save SLIME REPL history to file: ")))) - (cond - ((or (null file) - (null slime-repl-input-history)) - nil) - ((not (file-writable-p file)) - (error (format "Can't write SLIME REPL history file %s" file))) - (t - (let* ((hist (or history slime-repl-input-history)) - (len (length hist))) - (when (> len slime-repl-history-size) - (setq hist (subseq hist (- len slime-repl-history-size)))) - ;;(message "saving %s to %s\n" hist file) - (with-temp-buffer - (insert ";; History for SLIME REPL. Automatically written\n") - (insert ";; Edit only if you know what you're doing\n") - (pp (mapcar #'substring-no-properties hist) (current-buffer)) - (write-region (point-min) (point-max) file))))))) +truncated. That part is untested, though!" + (interactive (list (slime-repl-read-history-filename))) + (let ((file (or filename slime-repl-history-file)) + (hist (or history slime-repl-input-history))) + (unless (file-writable-p file) + (error (format "Can't write SLIME REPL history file %s" file))) + (let ((hist (subseq hist 0 (min (length hist) slime-repl-history-size)))) + ;;(message "saving %s to %s\n" hist file) + (with-temp-buffer + (insert ";; History for SLIME REPL. Automatically written\n") + (insert ";; Edit only if you know what you're doing\n") + (pp (mapcar #'substring-no-properties hist) (current-buffer)) + (write-region (point-min) (point-max) file))))) (defun slime-repl-save-all-histories () "Save the history in each repl buffer." @@ -4834,13 +4814,10 @@ (or (re-search-forward (format "\\s *(def\\(\\s_\\|\\sw\\)*\\s +%s\\S_" name) nil t) - ;; ;; FIXME: this matches the same and a bit more than the last line - ;; (re-search-forward - ;; (format "\\s *(def\\(\\s_\\|\\sw\\)*\\s +(*?%s\\S_" name) nil t) - ;; (re-search-forward - ;; ;; FIXME: Isn't this far to general? - ;; (format "[( \t]%s\\>\\(\\s \\|$\\)" name) nil t) - )) + (re-search-forward + (format "\\s *(def\\(\\s_\\|\\sw\\)*\\s +(*%s\\S_" name) nil t) + (re-search-forward + (format "[( \t]%s\\>\\(\\s \\|$\\)" name) nil t))) (goto-char (match-beginning 0))) ((:method name specializers &rest qualifiers) (slime-search-method-location name specializers qualifiers)) @@ -6960,7 +6937,8 @@ (lambda (expansion) (slime-with-output-to-temp-buffer ("*SLIME macroexpansion*" lisp-mode) package - (insert expansion)))))) + (insert expansion) + (font-lock-fontify-buffer)))))) (defun slime-macroexpand-1 (&optional repeatedly) "Display the macro expansion of the form at point. The form is @@ -7978,7 +7956,8 @@ ((kbd "RET") 'slime-goto-connection) ("d" 'slime-connection-list-make-default) ("g" 'slime-update-connection-list) - ((kbd "C-k") 'slime-quit-connection-at-point)) + ((kbd "C-k") 'slime-quit-connection-at-point) + ("R" 'slime-restart-connection-at-point)) (defun slime-connection-at-point () (or (get-text-property (point) 'slime-connection) @@ -7997,6 +7976,11 @@ (while (memq connection slime-net-processes) (sit-for 0 100))) (slime-update-connection-list)) + +(defun slime-restart-connection-at-point (connection) + (interactive (list (slime-connection-at-point))) + (let ((slime-dispatching-connection connection)) + (slime-restart-inferior-lisp))) (defun slime-connection-list-make-default () "Make the connection at point the default connection." @@ -9099,12 +9083,19 @@ ("(defun cl-user::foo () \"\\\" bla bla \\\"\" (cl-user::bar))" - (cl-user::bar))) + (cl-user::bar)) + ("(defun cl-user::foo () + #.*log-events* + (cl-user::bar))" + (cl-user::bar)) + ) (slime-check-top-level) (with-temp-buffer (lisp-mode) (insert program) + (setq slime-buffer-package ":swank") (slime-compile-defun) + (setq slime-buffer-package ":cl-user") (slime-sync) (goto-char (point-max)) (slime-previous-note) @@ -9825,7 +9816,7 @@ slime-print-apropos slime-show-note-counts slime-insert-propertized - slime-tree-insert))) + slime-tree-insert))) (run-hooks 'slime-load-hook) From heller at common-lisp.net Fri Nov 11 23:47:05 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 12 Nov 2005 00:47:05 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051111234705.4AB0D88556@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7425 Modified Files: ChangeLog Log Message: Date: Sat Nov 12 00:47:04 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.807 slime/ChangeLog:1.808 --- slime/ChangeLog:1.807 Mon Nov 7 09:30:00 2005 +++ slime/ChangeLog Sat Nov 12 00:47:03 2005 @@ -1,3 +1,25 @@ +2005-11-11 Helmut Eller + + * swank.lisp (*dedicated-output-stream-buffering*): New variable + to customize the buffering scheme. For single-threaded Lisps we + disable buffering because lazy programmers forget to call + finish-output. + (open-dedicated-output-stream): Use it. + + * swank-backend.lisp, swank-allegro.lisp, swank-lispworks.lisp, + swank-openmcl.lisp, swank-cmucl.lisp, swank-sbcl.lisp, + swank-clisp.lisp, swank-abcl.lisp, swank-corman.lisp, + swank-ecl.lisp (accept-connection): New argument: buffering. + + * slime.el (slime-repl-save-history): When the history exceeds + slime-repl-history-size remove the old not the new entries. + Some renaming: + slime-repl-read-history -> slime-repl-load-history, + slime-repl-read-history-internal -> slime-repl-read-history. + (slime-eval-macroexpand): Call font-lock-fontify-buffer + explicitly, because with certain Emacs versions the buffer doesn't + get fontified immediately. + 2005-11-07 Helmut Eller * slime.el (slime-eval-macroexpand): Use lisp-mode (and From heller at common-lisp.net Fri Nov 11 23:47:51 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 12 Nov 2005 00:47:51 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20051111234751.3353288565@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7608 Modified Files: swank.lisp Log Message: (*dedicated-output-stream-buffering*): New variable to customize the buffering scheme. For single-threaded Lisps we disable buffering because lazy programmers forget to call finish-output. (open-dedicated-output-stream): Use it. Date: Sat Nov 12 00:47:50 2005 Author: heller Index: slime/swank.lisp diff -u slime/swank.lisp:1.351 slime/swank.lisp:1.352 --- slime/swank.lisp:1.351 Fri Nov 4 10:04:40 2005 +++ slime/swank.lisp Sat Nov 12 00:47:50 2005 @@ -337,11 +337,17 @@ (defvar *use-dedicated-output-stream* t "When T swank will attempt to create a second connection to Emacs which is used just to send output.") + (defvar *dedicated-output-stream-port* 0 "Which port we should use for the dedicated output stream.") (defvar *communication-style* (preferred-communication-style)) +(defvar *dedicated-output-stream-buffering* + (if (eq *communication-style* :spawn) :full :none) + "The buffering scheme that should be used for the output stream. +Valid values are :none, :line, and :full.") + (defun start-server (port-file &key (style *communication-style*) dont-close (external-format *coding-system*)) "Start the server and write the listen port number to PORT-FILE. @@ -478,7 +484,8 @@ (port (local-port socket))) (encode-message `(:open-dedicated-output-stream ,port) socket-io) (accept-authenticated-connection - socket :external-format external-format))) + socket :external-format external-format + :buffering *dedicated-output-stream-buffering*))) (defun handle-request (connection) "Read and process one request. The processing is done in the extend From asimon at common-lisp.net Sun Nov 13 11:22:26 2005 From: asimon at common-lisp.net (Andras Simon) Date: Sun, 13 Nov 2005 12:22:26 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-abcl.lisp Message-ID: <20051113112226.897098855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1273 Modified Files: swank-abcl.lisp Log Message: Steal auto-flush stuff from swank-sbcl.lisp Date: Sun Nov 13 12:22:25 2005 Author: asimon Index: slime/swank-abcl.lisp diff -u slime/swank-abcl.lisp:1.28 slime/swank-abcl.lisp:1.29 --- slime/swank-abcl.lisp:1.28 Sun Oct 30 17:57:19 2005 +++ slime/swank-abcl.lisp Sun Nov 13 12:22:24 2005 @@ -472,6 +472,30 @@ (defimplementation receive () (ext:mailbox-read (mailbox (ext:current-thread)))) +;;; Auto-flush streams + +;; XXX race conditions +(defvar *auto-flush-streams* '()) + +(defvar *auto-flush-thread* nil) + +(defimplementation make-stream-interactive (stream) + (setq *auto-flush-streams* (adjoin stream *auto-flush-streams*)) + (unless *auto-flush-thread* + (setq *auto-flush-thread* + (ext:make-thread #'flush-streams + :name "auto-flush-thread")))) + +(defun flush-streams () + (loop + (setq *auto-flush-streams* + (remove-if (lambda (x) + (not (and (open-stream-p x) + (output-stream-p x)))) + *auto-flush-streams*)) + (mapc #'finish-output *auto-flush-streams*) + (sleep 0.15))) + (defimplementation quit-lisp () (ext:exit)) From asimon at common-lisp.net Sun Nov 13 11:24:16 2005 From: asimon at common-lisp.net (Andras Simon) Date: Sun, 13 Nov 2005 12:24:16 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051113112416.465708855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1310 Modified Files: ChangeLog Log Message: swank-abcl.lisp: Steal auto-flush stuff from swank-sbcl.lisp Date: Sun Nov 13 12:24:15 2005 Author: asimon Index: slime/ChangeLog diff -u slime/ChangeLog:1.808 slime/ChangeLog:1.809 --- slime/ChangeLog:1.808 Sat Nov 12 00:47:03 2005 +++ slime/ChangeLog Sun Nov 13 12:24:15 2005 @@ -1,3 +1,7 @@ +2005-11-13 Andras Simon + + * swank-abcl.lisp: Steal auto-flush stuff from swank-sbcl.lisp + 2005-11-11 Helmut Eller * swank.lisp (*dedicated-output-stream-buffering*): New variable From asimon at common-lisp.net Sun Nov 13 17:27:41 2005 From: asimon at common-lisp.net (Andras Simon) Date: Sun, 13 Nov 2005 18:27:41 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-abcl.lisp Message-ID: <20051113172741.BC6CC8855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv27468 Modified Files: swank-abcl.lisp Log Message: (accept-connection): New argument: buffering. Date: Sun Nov 13 18:27:40 2005 Author: asimon Index: slime/swank-abcl.lisp diff -u slime/swank-abcl.lisp:1.29 slime/swank-abcl.lisp:1.30 --- slime/swank-abcl.lisp:1.29 Sun Nov 13 12:22:24 2005 +++ slime/swank-abcl.lisp Sun Nov 13 18:27:40 2005 @@ -111,7 +111,8 @@ (ext:server-socket-close socket)) (defimplementation accept-connection (socket - &key (external-format :iso-latin-1-unix)) + &key (external-format :iso-latin-1-unix) buffering) + (declare (ignore buffering)) (assert (eq external-format :iso-latin-1-unix)) (ext:get-socket-stream (ext:socket-accept socket))) From asimon at common-lisp.net Sun Nov 13 17:32:20 2005 From: asimon at common-lisp.net (Andras Simon) Date: Sun, 13 Nov 2005 18:32:20 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051113173220.8D0B68855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv28521 Modified Files: ChangeLog Log Message: swank-abcl.lisp: (accept-connection): New argument: buffering. Date: Sun Nov 13 18:32:19 2005 Author: asimon Index: slime/ChangeLog diff -u slime/ChangeLog:1.809 slime/ChangeLog:1.810 --- slime/ChangeLog:1.809 Sun Nov 13 12:24:15 2005 +++ slime/ChangeLog Sun Nov 13 18:32:19 2005 @@ -1,5 +1,9 @@ 2005-11-13 Andras Simon + * swank-abcl.lisp: (accept-connection): New argument: buffering. + +2005-11-13 Andras Simon + * swank-abcl.lisp: Steal auto-flush stuff from swank-sbcl.lisp 2005-11-11 Helmut Eller From dcrosher at common-lisp.net Sun Nov 13 22:31:51 2005 From: dcrosher at common-lisp.net (Douglas Crosher) Date: Sun, 13 Nov 2005 23:31:51 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/swank-scl.lisp Message-ID: <20051113223151.5EF3F8855E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv15597 Modified Files: ChangeLog swank-scl.lisp Log Message: * swank-scl.lisp (accept-connection): handle the :buffering argument. Date: Sun Nov 13 23:31:46 2005 Author: dcrosher Index: slime/ChangeLog diff -u slime/ChangeLog:1.810 slime/ChangeLog:1.811 --- slime/ChangeLog:1.810 Sun Nov 13 18:32:19 2005 +++ slime/ChangeLog Sun Nov 13 23:31:43 2005 @@ -1,3 +1,7 @@ +2005-11-14 Douglas Crosher + + * swank-scl.lisp (accept-connection): handle the :buffering argument. + 2005-11-13 Andras Simon * swank-abcl.lisp: (accept-connection): New argument: buffering. Index: slime/swank-scl.lisp diff -u slime/swank-scl.lisp:1.2 slime/swank-scl.lisp:1.3 --- slime/swank-scl.lisp:1.2 Sat Nov 12 00:43:43 2005 +++ slime/swank-scl.lisp Sun Nov 13 23:31:45 2005 @@ -52,11 +52,12 @@ (defimplementation close-socket (socket) (ext:close-socket (socket-fd socket))) -(defimplementation accept-connection (socket &key external-format buffering) - (declare (ignore buffering)) +(defimplementation accept-connection (socket &key + (external-format :iso-latin-1-unix) + (buffering :full)) (let ((external-format (or external-format :iso-latin-1-unix))) (make-socket-io-stream (ext:accept-tcp-connection socket) - external-format))) + external-format buffering))) ;;;;; Sockets @@ -75,12 +76,14 @@ (case coding-system (:iso-latin-1-unix :iso-8859-1) (:utf-8-unix :utf-8) + (:euc-jp-unix :euc-jp) (t coding-system))) -(defun make-socket-io-stream (fd external-format) +(defun make-socket-io-stream (fd external-format buffering) "Create a new input/output fd-stream for 'fd." (let ((external-format (find-external-format external-format))) (sys:make-fd-stream fd :input t :output t :element-type 'base-char + :buffering buffering :external-format external-format))) @@ -1752,7 +1755,7 @@ (loop for value in parts for i from 0 append (label-value-line i value)))))) -(defmethod inspect-for-emacs :around ((o function) (inspector scl-inspector)) +(defmethod inspect-for-emacs ((o function) (inspector scl-inspector)) (declare (ignore inspector)) (let ((header (kernel:get-type o))) (cond ((= header vm:function-header-type) @@ -1833,7 +1836,7 @@ (:displaced-p (kernel:%array-displaced-p o)) (:dimensions (array-dimensions o))))) -(defmethod inspect-for-emacs ((o vector) (inspector scl-inspector)) +(defmethod inspect-for-emacs ((o simple-vector) (inspector scl-inspector)) inspector (values (format nil "~A is a vector." o) (append From heller at common-lisp.net Sun Nov 20 23:24:15 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Nov 2005 00:24:15 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051120232415.BB27588554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv21814 Modified Files: slime.el Log Message: (slime-start): Don't set slime-net-coding-system .. (slime-read-port-and-connect): .. read it from the inferior lisp args. (slime-connect): Take the coding-system as third argument. (slime-repl-history-file-coding-system): New user option. (slime-repl-safe-save-merged-history): New function. Use it in hooks so that bad coding systems don't stop us from exiting. (slime-repl-save-history): Include the coding-system which was used to save the buffer. (repl-shoctut change-package): Add alias ,in and ,in-package. (slime-eval-macroexpand): Error out early if there's no sexp at point. (slime-compiler-macroexpand): New command. (slime-inspector-pprint): New command. Date: Mon Nov 21 00:24:10 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.563 slime/slime.el:1.564 --- slime/slime.el:1.563 Sat Nov 12 00:45:41 2005 +++ slime/slime.el Mon Nov 21 00:24:09 2005 @@ -2,7 +2,7 @@ ;; slime.el -- Superior Lisp Interaction Mode for Emacs ;;;; License ;; Copyright (C) 2003 Eric Marsden, Luke Gorrie, Helmut Eller -;; Copyright (C) 2004 Luke Gorrie, Helmut Eller +;; Copyright (C) 2004,2005 Luke Gorrie, Helmut Eller ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -442,10 +442,20 @@ :group 'slime-repl) (defcustom slime-repl-history-size 1000 - "Maximum number of lines for persistent REPL history." + "*Maximum number of lines for persistent REPL history." :type 'integer :group 'slime-repl) +(defcustom slime-repl-history-file-coding-system + (cond ((featurep 'xemacs) + (cond ((find-coding-system 'utf-8-unix) 'utf-8-unix) + (t (coding-system-name default-buffer-file-coding-system)))) + ((coding-system-p 'utf-8-unix) 'utf-8-unix) + (t 'emacs-mule-unix)) + "*The coding system for the history file." + :type 'symbol + :group 'slime-repl) + ;;;; Minor modes ;;;;; slime-mode @@ -1307,31 +1317,29 @@ (list* :name name :program prog :program-args args keys))) (defun* slime-start (&key (program inferior-lisp-program) program-args - (buffer "*inferior-lisp*") (coding-system slime-net-coding-system) (init 'slime-init-command) - name) + name + (buffer "*inferior-lisp*")) (let ((args (list :program program :program-args program-args :buffer buffer :coding-system coding-system :init init :name name))) (slime-check-coding-system coding-system) - (setq slime-net-coding-system coding-system) (when (or (not (slime-bytecode-stale-p)) (slime-urge-bytecode-recompile)) (let ((proc (slime-maybe-start-lisp program program-args buffer))) (slime-inferior-connect proc args) (pop-to-buffer (process-buffer proc)))))) -(defun slime-connect (host port &optional kill-old-p) +(defun slime-connect (host port &optional coding-system) "Connect to a running Swank server." (interactive (list (read-from-minibuffer "Host: " "127.0.0.1") - (read-from-minibuffer "Port: " "4005" nil t) - (if (null slime-net-processes) - t - (y-or-n-p "Close old connections first? ")))) - (slime-check-coding-system) - (when kill-old-p (slime-disconnect)) + (read-from-minibuffer "Port: " "4005" nil t))) + (when (and (interactive-p) slime-net-processes + (y-or-n-p "Close old connections first? ")) + (slime-disconnect)) + (slime-check-coding-system coding-system) (message "Connecting to Swank on port %S.." port) - (let* ((process (slime-net-connect host port)) + (let* ((process (slime-net-connect host port coding-system)) (slime-dispatching-connection process)) (slime-setup-connection process))) @@ -1524,9 +1532,11 @@ (cancel-timer slime-connect-retry-timer)) (setq slime-connect-retry-timer nil) ; remove old timer (cond ((file-exists-p (slime-swank-port-file)) - (let ((port (slime-read-swank-port))) + (let ((port (slime-read-swank-port)) + (args (slime-inferior-lisp-args process))) (delete-file (slime-swank-port-file)) - (let ((c (slime-connect "127.0.0.1" port))) + (let ((c (slime-connect "127.0.0.1" port + (plist-get args :coding-system)))) (slime-set-inferior-process c process)))) ((and retries (zerop retries)) (message "Failed to connect to Swank.")) @@ -1634,7 +1644,7 @@ (file-error nil))) ;;; Interface -(defun slime-net-connect (host port) +(defun slime-net-connect (host port &optional coding-system) "Establish a connection with a CL." (let* ((inhibit-quit nil) (proc (open-network-stream "SLIME Lisp" nil host port)) @@ -1646,9 +1656,8 @@ (when slime-kill-without-query-p (process-kill-without-query proc)) (when (fboundp 'set-process-coding-system) - (set-process-coding-system proc - slime-net-coding-system - slime-net-coding-system)) + (let ((coding-system (car (slime-check-coding-system coding-system)))) + (set-process-coding-system proc coding-system coding-system))) (when-let (secret (slime-secret)) (slime-net-send secret proc)) proc)) @@ -1657,9 +1666,6 @@ "Make a buffer suitable for a network process." (let ((buffer (generate-new-buffer name))) (with-current-buffer buffer - (when (fboundp 'set-buffer-multibyte) - (set-buffer-multibyte - (slime-coding-system-mulibyte-p slime-net-coding-system))) (buffer-disable-undo)) buffer)) @@ -2262,7 +2268,8 @@ (defun slime-eval (sexp &optional package) "Evaluate EXPR on the superior Lisp and return the result." (when (null package) (setq package (slime-current-package))) - (let* ((tag (gensym "slime-result-")) + (let* ((tag (gensym (format "slime-result-%d-" + (1+ (slime-continuation-counter))))) (slime-stack-eval-tags (cons tag slime-stack-eval-tags))) (apply #'funcall @@ -2914,9 +2921,9 @@ (setq slime-current-thread :repl-thread) (set (make-local-variable 'scroll-conservatively) 20) (set (make-local-variable 'scroll-margin) 0) - (slime-repl-load-history) + (slime-repl-safe-load-history) (make-local-hook 'kill-buffer-hook) - (add-hook 'kill-buffer-hook 'slime-repl-save-merged-history nil t) + (add-hook 'kill-buffer-hook 'slime-repl-safe-save-merged-history nil t) (add-hook 'kill-emacs-hook 'slime-repl-save-all-histories) (slime-setup-command-hooks) (run-hooks 'slime-repl-mode-hook)) @@ -3719,7 +3726,7 @@ (let ((file (or filename slime-repl-history-file))) (cond ((not (file-readable-p file)) '()) (t (with-temp-buffer - (insert-file-contents-literally file) + (insert-file-contents file) (read (current-buffer))))))) (defun slime-repl-read-history-filename () @@ -3750,21 +3757,43 @@ (let ((file (or filename slime-repl-history-file)) (hist (or history slime-repl-input-history))) (unless (file-writable-p file) - (error (format "Can't write SLIME REPL history file %s" file))) + (error (format "History file not writable: %s" file))) (let ((hist (subseq hist 0 (min (length hist) slime-repl-history-size)))) ;;(message "saving %s to %s\n" hist file) - (with-temp-buffer - (insert ";; History for SLIME REPL. Automatically written\n") - (insert ";; Edit only if you know what you're doing\n") - (pp (mapcar #'substring-no-properties hist) (current-buffer)) - (write-region (point-min) (point-max) file))))) + (with-temp-file file + (let ((cs slime-repl-history-file-coding-system)) + (setq buffer-file-coding-system cs) + (insert (format ";; -*- coding: %s -*-\n" cs))) + (insert ";; History for SLIME REPL. Automatically written.\n" + ";; Edit only if you know what you're doing\n") + (pp (mapcar #'substring-no-properties hist) (current-buffer)))))) (defun slime-repl-save-all-histories () "Save the history in each repl buffer." (dolist (b (buffer-list)) (with-current-buffer b (when (eq major-mode 'slime-repl-mode) - (slime-repl-save-merged-history))))) + (slime-repl-safe-save-merged-history))))) + +(defun slime-repl-safe-save-merged-history () + (slime-repl-call-with-handler + #'slime-repl-save-merged-history + "%S while saving the history. Continue? ")) + +(defun slime-repl-safe-load-history () + (slime-repl-call-with-handler + #'slime-repl-load-history + "%S while loading the history. Continue? ")) + +(defun slime-repl-call-with-handler (fun query) + "Call FUN in the context of an error handler. +The handler will use qeuery to ask the use if the error should be ingored." + (condition-case err + (funcall fun) + (error + (if (y-or-n-p (format query (error-message-string err))) + nil + (signal (car err) (cdr err)))))) ;;;;; REPL mode setup @@ -3981,7 +4010,7 @@ (slime-set-default-directory (car slime-repl-directory-stack)))) (:one-liner "Pop the current directory.")) -(defslime-repl-shortcut nil ("change-package" "!p") +(defslime-repl-shortcut nil ("change-package" "!p" "in-package" "in") (:handler 'slime-repl-set-package) (:one-liner "Change the current package.")) @@ -6309,7 +6338,7 @@ (defun slime-toggle-trace-fdefinition (&optional using-context-p) "Toggle trace." - (interactive "P") + (interactive "p") (let ((spec (if using-context-p (slime-extract-context) (slime-symbol-at-point)))) @@ -6932,13 +6961,17 @@ ;;;; Macroexpansion (defun slime-eval-macroexpand (expander) - (lexical-let ((package (slime-current-package))) - (slime-eval-async `(,expander ,(slime-sexp-at-point)) - (lambda (expansion) - (slime-with-output-to-temp-buffer - ("*SLIME macroexpansion*" lisp-mode) package - (insert expansion) - (font-lock-fontify-buffer)))))) + (let ((string (slime-sexp-at-point))) + (when (not string) + (error "No expression at point.")) + (lexical-let ((package (slime-current-package))) + (slime-eval-async + `(,expander ,string) + (lambda (expansion) + (slime-with-output-to-temp-buffer + ("*SLIME macroexpansion*" lisp-mode) package + (insert expansion) + (font-lock-fontify-buffer))))))) (defun slime-macroexpand-1 (&optional repeatedly) "Display the macro expansion of the form at point. The form is @@ -6953,6 +6986,16 @@ (interactive) (slime-eval-macroexpand 'swank:swank-macroexpand-all)) +(defun slime-compiler-macroexpand () + "Display the compiler-macro expansion of sexp at point." + (interactive) + (slime-eval-macroexpand 'swank:swank-compiler-macroexpand)) + +(defun slime-compiler-macroexpand-1 () + "Display the compiler-macro expansion of sexp at point." + (interactive) + (slime-eval-macroexpand 'swank:swank-compiler-macroexpand-1)) + ;;;; Subprocess control @@ -8109,6 +8152,7 @@ "Display INSPECTED-PARTS in a new inspector window. Optionally set point to POINT." (with-current-buffer (slime-inspector-buffer) + (setq slime-buffer-connection (slime-current-connection)) (let ((inhibit-read-only t)) (erase-buffer) (destructuring-bind (&key title type content) inspected-parts @@ -8260,6 +8304,11 @@ (interactive) (slime-eval-describe `(swank:describe-inspectee))) +(defun slime-inspector-pprint (part) + (interactive (list (or (get-text-property (point) 'slime-part-number) + (error "No part at point")))) + (slime-eval-describe `(swank:pprint-inspector-part ,part))) + (defun slime-inspector-reinspect () (interactive) (slime-eval-async `(swank:inspector-reinspect) 'slime-open-inspector)) @@ -8273,6 +8322,7 @@ ("n" 'slime-inspector-next) (" " 'slime-inspector-next) ("d" 'slime-inspector-describe) + ("p" 'slime-inspector-pprint) ("q" 'slime-inspector-quit) ("g" 'slime-inspector-reinspect) ("\C-i" 'slime-inspector-next-inspectable-object) From heller at common-lisp.net Sun Nov 20 23:25:38 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Nov 2005 00:25:38 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-backend.lisp Message-ID: <20051120232538.E3FA288554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv21861 Modified Files: swank-backend.lisp Log Message: (compiler-macroexpand-1, compiler-macroexpand): New functions. Date: Mon Nov 21 00:25:38 2005 Author: heller Index: slime/swank-backend.lisp diff -u slime/swank-backend.lisp:1.93 slime/swank-backend.lisp:1.94 --- slime/swank-backend.lisp:1.93 Sat Nov 12 00:43:43 2005 +++ slime/swank-backend.lisp Mon Nov 21 00:25:38 2005 @@ -399,6 +399,28 @@ "Recursively expand all macros in FORM. Return the resulting form.") +(definterface compiler-macroexpand-1 (form &optional env) + "Call the compiler-macro for form. +If FORM is a function call for which a compiler-macro has been +defined, invoke the expander function using *macroexpand-hook* and +return the results and T. Otherwise, return the original form and +NIL." + (let ((fun (and (consp form) (compiler-macro-function (car form))))) + (if fun + (let ((result (funcall *macroexpand-hook* fun form env))) + (values result (not (eq result form)))) + (values form nil)))) + +(definterface compiler-macroexpand (form &optional env) + "Repetitively call `compiler-macroexpand-1'." + (labels ((frob (form expanded) + (multiple-value-bind (new-form newly-expanded) + (compiler-macroexpand-1 form env) + (if newly-expanded + (frob new-form t) + (values new-form expanded))))) + (frob form env))) + (definterface describe-symbol-for-emacs (symbol) "Return a property list describing SYMBOL. From heller at common-lisp.net Sun Nov 20 23:27:27 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Nov 2005 00:27:27 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20051120232727.C07DD88554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv21893 Modified Files: swank.lisp Log Message: (pprint-inspector-part, swank-compiler-macroexpand): New. Date: Mon Nov 21 00:27:26 2005 Author: heller Index: slime/swank.lisp diff -u slime/swank.lisp:1.352 slime/swank.lisp:1.353 --- slime/swank.lisp:1.352 Sat Nov 12 00:47:50 2005 +++ slime/swank.lisp Mon Nov 21 00:27:26 2005 @@ -1805,6 +1805,8 @@ (*pending-continuations* (cons id *pending-continuations*))) (check-type *buffer-package* package) (check-type *buffer-readtable* readtable) + ;; APPLY would be cleaner than EVAL. + ;;(setq result (apply (car form) (cdr form))) (setq result (eval form)) (finish-output) (run-hook *pre-reply-hook*) @@ -2428,6 +2430,12 @@ (defslimefun swank-macroexpand-all (string) (apply-macro-expander #'macroexpand-all string)) +(defslimefun swank-compiler-macroexpand-1 (string) + (apply-macro-expander #'compiler-macroexpand-1 string)) + +(defslimefun swank-compiler-macroexpand (string) + (apply-macro-expander #'compiler-macroexpand string)) + (defslimefun disassemble-symbol (name) (with-buffer-syntax () (with-output-to-string (*standard-output*) @@ -3590,29 +3598,28 @@ (defmethod inspect-for-emacs ((o standard-object) inspector) (declare (ignore inspector)) (values "An object." - `("Class: " (:value ,(class-of o)) - (:newline) + `("Class: " (:value ,(class-of o)) (:newline) "Slots:" (:newline) ,@(loop - with direct-slots = (swank-mop:class-direct-slots (class-of o)) for slot in (swank-mop:class-slots (class-of o)) - for slot-def = (or (find-if (lambda (a) - ;; find the direct slot - ;; with the same name - ;; as SLOT (an - ;; effective slot). - (eql (swank-mop:slot-definition-name a) - (swank-mop:slot-definition-name slot))) - direct-slots) - slot) - collect `(:value ,slot-def ,(inspector-princ (swank-mop:slot-definition-name slot-def))) + for slot-def = (find-effective-slot o slot) + for slot-name = (swank-mop:slot-definition-name slot-def) + collect `(:value ,slot-def ,(string slot-name)) collect " = " - if (slot-boundp o (swank-mop:slot-definition-name slot-def)) - collect `(:value ,(slot-value o (swank-mop:slot-definition-name slot-def))) - else - collect "#" + collect (if (slot-boundp o slot-name) + `(:value ,(slot-value o slot-name)) + "#") collect '(:newline))))) +(defun find-effective-slot (o slot) + ;; find the direct slot with the same name as SLOT (an effective + ;; slot). + (or (find-if (lambda (a) + (eql (swank-mop:slot-definition-name a) + (swank-mop:slot-definition-name slot))) + (swank-mop:class-direct-slots (class-of o))) + slot)) + (defvar *gf-method-getter* 'methods-by-applicability "This function is called to get the methods of a generic function. The default returns the method sorted by applicability. @@ -4040,6 +4047,11 @@ "Describe the currently inspected object." (with-buffer-syntax () (describe-to-string *inspectee*))) + +(defslimefun pprint-inspector-part (index) + "Pretty-print the currently inspected object." + (with-buffer-syntax () + (swank-pprint (list (inspector-nth-part index))))) (defslimefun inspect-in-frame (string index) (with-buffer-syntax () From heller at common-lisp.net Sun Nov 20 23:29:26 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Nov 2005 00:29:26 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-cmucl.lisp Message-ID: <20051120232926.183A288554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv21935 Modified Files: swank-cmucl.lisp Log Message: (inspect-for-emacs): Add support for funcallable instances. Date: Mon Nov 21 00:29:25 2005 Author: heller Index: slime/swank-cmucl.lisp diff -u slime/swank-cmucl.lisp:1.157 slime/swank-cmucl.lisp:1.158 --- slime/swank-cmucl.lisp:1.157 Sat Nov 12 00:43:43 2005 +++ slime/swank-cmucl.lisp Mon Nov 21 00:29:25 2005 @@ -1428,6 +1428,12 @@ (defimplementation macroexpand-all (form) (walker:macroexpand-all form)) +(defimplementation compiler-macroexpand-1 (form &optional env) + (ext:compiler-macroexpand-1 form env)) + +(defimplementation compiler-macroexpand (form &optional env) + (ext:compiler-macroexpand form env)) + (defimplementation set-default-directory (directory) (setf (ext:default-directory) (namestring directory)) ;; Setting *default-pathname-defaults* to an absolute directory @@ -1899,6 +1905,16 @@ (t (call-next-method))))) +(defmethod inspect-for-emacs ((o kernel:funcallable-instance) + (i cmucl-inspector)) + (declare (ignore i)) + (values + (format nil "~A is a funcallable-instance." o) + (append (label-value-line* + (:function (kernel:%funcallable-instance-function o)) + (:lexenv (kernel:%funcallable-instance-lexenv o)) + (:layout (kernel:%funcallable-instance-layout o))) + (nth-value 1 (cmucl-inspect o))))) (defmethod inspect-for-emacs ((o kernel:code-component) (_ cmucl-inspector)) (declare (ignore _)) From heller at common-lisp.net Sun Nov 20 23:30:46 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Nov 2005 00:30:46 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051120233046.C84FE88554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv21966 Modified Files: ChangeLog Log Message: Date: Mon Nov 21 00:30:45 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.811 slime/ChangeLog:1.812 --- slime/ChangeLog:1.811 Sun Nov 13 23:31:43 2005 +++ slime/ChangeLog Mon Nov 21 00:30:45 2005 @@ -1,3 +1,27 @@ +2005-11-21 Helmut Eller + + * slime.el (slime-start): Don't set slime-net-coding-system .. + (slime-read-port-and-connect): .. read it from the inferior lisp args. + (slime-connect): Take the coding-system as third argument. + (slime-repl-history-file-coding-system): New user option. + (slime-repl-safe-save-merged-history): New function. Use it in + hooks so that bad coding systems don't stop us from exiting. + (slime-repl-save-history): Include the coding-system which was + used to save the buffer. + (repl-shoctut change-package): Add alias ,in and ,in-package. + (slime-eval-macroexpand): Error out early if there's no sexp at + point. + (slime-compiler-macroexpand): New command. + (slime-inspector-pprint): New command. + + * swank-cmucl.lisp (inspect-for-emacs): Add support for + funcallable instances. + + * swank.lisp (pprint-inspector-part, swank-compiler-macroexpand): New. + + * swank-backend.lisp (compiler-macroexpand) + (compiler-macroexpand-1): New functions. + 2005-11-14 Douglas Crosher * swank-scl.lisp (accept-connection): handle the :buffering argument. From heller at common-lisp.net Sun Nov 20 23:31:57 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Nov 2005 00:31:57 +0100 (CET) Subject: [slime-cvs] CVS update: slime/PROBLEMS Message-ID: <20051120233157.4249B88554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22955 Modified Files: PROBLEMS Log Message: Mention READ-CHAR-NO-HANG brokeness. Date: Mon Nov 21 00:31:56 2005 Author: heller Index: slime/PROBLEMS diff -u slime/PROBLEMS:1.7 slime/PROBLEMS:1.8 --- slime/PROBLEMS:1.7 Tue Jun 28 10:40:07 2005 +++ slime/PROBLEMS Mon Nov 21 00:31:56 2005 @@ -11,6 +11,13 @@ The listen socket is bound on the loopback interface in all Lisps that support this. This way remote hosts are unable to connect. +** READ-CHAR-NO-HANG is broken + +READ-CHAR-NO-HANG doesn't work properly for slime-input-streams. Due +to the way we request input from Emacs it's not possible to repeatedly +poll for input. To get any input you have to call READ-CHAR (or a +function which calls READ-CHAR). + * Backend-specific problems ** CMUCL @@ -23,7 +30,8 @@ The latest released version of SBCL at the time of packaging should work. Older or newer SBCLs may or may not work. Do not use -multithreading with unpatched 2.4 Linux kernels. +multithreading with unpatched 2.4 Linux kernels. There are also +problems with kernel versions 2.6.5 - 2.6.10. The (v)iew-source command in the debugger can only locate exact source forms for code compiled at (debug 2) or higher. The default level is @@ -57,15 +65,18 @@ you may have to start CLISP with "clisp -K full". Under Windows, interrupting (with C-c C-b) doesn't work. Emacs sends -a signal 2 (= SIGINT), but the signal is either ignored or CLISP exits +a SIGINT signal, but the signal is either ignored or CLISP exits immediately. -The backtrace doesn't include frames for compiled functions. Changes -to CLISP's C code are needed to fix this problem. -Interpreted code is usually easer to debug. +Function arguments and local variables aren't displayed properly in +the backtrace. Changes to CLISP's C code are needed to fix this +problem. Interpreted code is usually easer to debug. M-. (find-definition) only works if the fasl file is in the same directory as the source file. + +The arglist doesn't include the proper names only "fake symbols" like +`arg1'. ** Armed Bear Common Lisp From heller at common-lisp.net Tue Nov 22 10:32:38 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Nov 2005 11:32:38 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-cmucl.lisp Message-ID: <20051122103238.0ADDC88554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv18777 Modified Files: swank-cmucl.lisp Log Message: (accept-connection): Remove fd-handlers if the encoding isn't iso-latin-1. Date: Tue Nov 22 11:32:38 2005 Author: heller Index: slime/swank-cmucl.lisp diff -u slime/swank-cmucl.lisp:1.158 slime/swank-cmucl.lisp:1.159 --- slime/swank-cmucl.lisp:1.158 Mon Nov 21 00:29:25 2005 +++ slime/swank-cmucl.lisp Tue Nov 22 11:32:37 2005 @@ -101,7 +101,10 @@ (defimplementation accept-connection (socket &key (external-format :iso-latin-1-unix) (buffering :full)) - (assert (eq external-format ':iso-latin-1-unix)) + (unless (eq external-format ':iso-latin-1-unix) + (remove-fd-handlers socket) + (remove-sigio-handlers socket) + (assert (eq external-format ':iso-latin-1-unix))) (make-socket-io-stream (ext:accept-tcp-connection socket) buffering)) ;;;;; Sockets @@ -152,8 +155,7 @@ (defimplementation remove-sigio-handlers (socket) (let ((fd (socket-fd socket))) (setf *sigio-handlers* (remove fd *sigio-handlers* :key #'car)) - (sys:invalidate-descriptor fd)) - (close socket)) + (sys:invalidate-descriptor fd))) ;;;;; SERVE-EVENT From heller at common-lisp.net Tue Nov 22 10:36:23 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Nov 2005 11:36:23 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051122103623.3315388554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv18814 Modified Files: slime.el Log Message: (slime-compile-file): Call 'check-parens before compiling. (slime-find-coding-system): Return nil if the coding system isn't valid instead of signalling an error. (slime-repl-history-file-coding-system): Use slime-find-coding-system find the default. Date: Tue Nov 22 11:36:22 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.564 slime/slime.el:1.565 --- slime/slime.el:1.564 Mon Nov 21 00:24:09 2005 +++ slime/slime.el Tue Nov 22 11:36:22 2005 @@ -169,16 +169,6 @@ :type '(boolean) :group 'slime-lisp) -(defvar slime-net-coding-system - (find-if (cond ((featurep 'xemacs) - (if (fboundp 'find-coding-system) - #'find-coding-system - (lambda (x) (eq x 'binary)))) - (t #'coding-system-p)) - '(iso-latin-1-unix iso-8859-1-unix binary)) - "*Coding system used for network connections. -See also `slime-net-valid-coding-systems'.") - ;;;;; slime-mode (defgroup slime-mode nil @@ -446,16 +436,6 @@ :type 'integer :group 'slime-repl) -(defcustom slime-repl-history-file-coding-system - (cond ((featurep 'xemacs) - (cond ((find-coding-system 'utf-8-unix) 'utf-8-unix) - (t (coding-system-name default-buffer-file-coding-system)))) - ((coding-system-p 'utf-8-unix) 'utf-8-unix) - (t 'emacs-mule-unix)) - "*The coding system for the history file." - :type 'symbol - :group 'slime-repl) - ;;;; Minor modes ;;;;; slime-mode @@ -1446,15 +1426,19 @@ "Return a new or existing inferior lisp process." (cond ((not (comint-check-proc buffer)) (slime-start-lisp program program-args buffer)) - ((y-or-n-p "Create an additional *inferior-lisp*? ") - (slime-start-lisp program program-args - (generate-new-buffer-name buffer))) - (t - (when-let (conn (find (get-buffer-process buffer) - slime-net-processes + ((slime-reinitialize-inferior-lisp-p program program-args buffer) + (when-let (conn (find (get-buffer-process buffer) slime-net-processes :key #'slime-inferior-process)) (slime-net-close conn)) - (get-buffer-process buffer)))) + (get-buffer-process buffer)) + (t (slime-start-lisp program program-args + (generate-new-buffer-name buffer))))) + +(defun slime-reinitialize-inferior-lisp-p (program program-args buffer) + (let ((args (slime-inferior-lisp-args (get-buffer-process buffer)))) + (and (equal (plist-get args :program) program) + (equal (plist-get args :program-args) program-args) + (not (y-or-n-p "Create an additional *inferior-lisp*? "))))) (defun slime-start-lisp (program program-args buffer) "Does the same as `inferior-lisp' but less ugly. @@ -1493,6 +1477,7 @@ (with-current-buffer (process-buffer process) slime-inferior-lisp-args)) + ;;; XXX load-server & start-server used to separated. maybe that was better. (defun slime-init-command (port-filename coding-system) "Return a string to initialize Lisp." @@ -1622,16 +1607,6 @@ "List of functions called when a slime network connection closes. The functions are called with the process as their argument.") -(defvar slime-net-valid-coding-systems - '((iso-latin-1-unix nil :iso-latin-1-unix) - (iso-8859-1-unix nil :iso-latin-1-unix) - (binary nil :iso-latin-1-unix) - (utf-8-unix t :utf-8-unix) - (emacs-mule-unix t :emacs-mule-unix) - (euc-jp-unix t :euc-jp-unix)) - "A list of valid coding systems. -Each element is of the form: (NAME MULTIBYTEP CL-NAME)") - (defun slime-secret () "Finds the magic secret from the user's home directory. Returns nil if the file doesn't exist or is empty; otherwise the first @@ -1648,7 +1623,8 @@ "Establish a connection with a CL." (let* ((inhibit-quit nil) (proc (open-network-stream "SLIME Lisp" nil host port)) - (buffer (slime-make-net-buffer " *cl-connection*"))) + (buffer (slime-make-net-buffer " *cl-connection*")) + (coding-system (or coding-system slime-net-coding-system))) (push proc slime-net-processes) (set-process-buffer proc buffer) (set-process-filter proc 'slime-net-filter) @@ -1656,8 +1632,8 @@ (when slime-kill-without-query-p (process-kill-without-query proc)) (when (fboundp 'set-process-coding-system) - (let ((coding-system (car (slime-check-coding-system coding-system)))) - (set-process-coding-system proc coding-system coding-system))) + (slime-check-coding-system coding-system) + (set-process-coding-system proc coding-system coding-system)) (when-let (secret (slime-secret)) (slime-net-send secret proc)) proc)) @@ -1669,20 +1645,49 @@ (buffer-disable-undo)) buffer)) -(defun slime-find-coding-system (&optional coding-system) - (let* ((coding-system (or coding-system slime-net-coding-system)) - (props (assq coding-system slime-net-valid-coding-systems))) - (check-coding-system coding-system) +;;;;; Coding system madness + +(defvar slime-net-valid-coding-systems + '((iso-latin-1-unix nil :iso-latin-1-unix) + (iso-8859-1-unix nil :iso-latin-1-unix) + (binary nil :iso-latin-1-unix) + (utf-8-unix t :utf-8-unix) + (emacs-mule-unix t :emacs-mule-unix) + (euc-jp-unix t :euc-jp-unix)) + "A list of valid coding systems. +Each element is of the form: (NAME MULTIBYTEP CL-NAME)") + +(defun slime-find-coding-system (name) + "Return the coding system for the symbol NAME. +The result is either an element in `slime-net-valid-coding-systems' +of nil." + (let* ((probe (assq name slime-net-valid-coding-systems))) + (if (and probe (ignore-errors (check-coding-system (car probe)))) + probe))) + +(defvar slime-net-coding-system + (find-if 'slime-find-coding-system + '(iso-latin-1-unix iso-8859-1-unix binary)) + "*Coding system used for network connections. +See also `slime-net-valid-coding-systems'.") + +(defun slime-check-coding-system (coding-system) + "Signal an error if CODING-SYSTEM isn't a valid coding system." + (interactive) + (let ((props (slime-find-coding-system coding-system))) (unless props (error "Invalid slime-net-coding-system: %s. %s" coding-system (mapcar #'car slime-net-valid-coding-systems))) (when (and (second props) (boundp 'default-enable-multibyte-characters)) (assert default-enable-multibyte-characters)) - props)) - -(defun slime-check-coding-system (&optional coding-system) - (interactive) - (slime-find-coding-system coding-system)) + t)) + +(defcustom slime-repl-history-file-coding-system + (cond ((slime-find-coding-system 'utf-8-unix) 'utf-8-unix) + (t slime-net-coding-system)) + "*The coding system for the history file." + :type 'symbol + :group 'slime-repl) (defun slime-coding-system-mulibyte-p (coding-system) (second (slime-find-coding-system coding-system))) @@ -3168,7 +3173,8 @@ (defun slime-presentation-menu (event) (interactive "e") - (let* ((point (if (featurep 'xemacs) (event-point event) (posn-point (event-end event)))) + (let* ((point (if (featurep 'xemacs) (event-point event) + (posn-point (event-end event)))) (window (if (featurep 'xemacs) (event-window event) (caadr event))) (choice-to-lambda (make-hash-table))) (with-current-buffer (window-buffer window) @@ -3178,7 +3184,6 @@ (error "No presentation at event position")) (let ((menu (slime-menu-choices-for-presentation presentation from to choice-to-lambda))) - (setq it choice-to-lambda) (let ((choice (x-popup-menu event menu))) (when choice (call-interactively (gethash choice choice-to-lambda))))))))) @@ -4196,6 +4201,7 @@ (interactive) (unless (memq major-mode slime-lisp-modes) (error "Only valid in lisp-mode")) + (check-parens) (unless buffer-file-name (error "Buffer %s is not associated with a file." (buffer-name))) (when (and (buffer-modified-p) From heller at common-lisp.net Tue Nov 22 10:37:58 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Nov 2005 11:37:58 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051122103758.E1E3488554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv18842 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Tue Nov 22 11:37:58 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.812 slime/ChangeLog:1.813 --- slime/ChangeLog:1.812 Mon Nov 21 00:30:45 2005 +++ slime/ChangeLog Tue Nov 22 11:37:57 2005 @@ -1,3 +1,16 @@ +2005-11-22 Helmut Eller + + * slime.el (slime-compile-file): Call 'check-parens before + compiling. + (slime-compile-file): Call 'check-parens before compiling. + (slime-find-coding-system): Return nil if the coding system + isn'tvalid instead of singalling an error. + (slime-repl-history-file-coding-system): Use + slime-find-coding-system to find the default. + + * swank-cmucl.lisp (accept-connection): Remove fd-handlers if the + encoding isn't iso-latin-1. + 2005-11-21 Helmut Eller * slime.el (slime-start): Don't set slime-net-coding-system .. From heller at common-lisp.net Tue Nov 22 20:42:20 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Nov 2005 21:42:20 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051122204220.DC1F8880D7@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1045 Modified Files: slime.el Log Message: (slime-connect): Use slime-net-coding system if the optinal coding-system was not supplied. From Marco Monteiro. Date: Tue Nov 22 21:42:19 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.565 slime/slime.el:1.566 --- slime/slime.el:1.565 Tue Nov 22 11:36:22 2005 +++ slime/slime.el Tue Nov 22 21:42:19 2005 @@ -1317,11 +1317,12 @@ (when (and (interactive-p) slime-net-processes (y-or-n-p "Close old connections first? ")) (slime-disconnect)) - (slime-check-coding-system coding-system) - (message "Connecting to Swank on port %S.." port) - (let* ((process (slime-net-connect host port coding-system)) - (slime-dispatching-connection process)) - (slime-setup-connection process))) + (let ((coding-system (or coding-system slime-net-coding-system))) + (slime-check-coding-system coding-system) + (message "Connecting to Swank on port %S.." port) + (let* ((process (slime-net-connect host port coding-system)) + (slime-dispatching-connection process)) + (slime-setup-connection process)))) (defun slime-start-and-load (filename &optional package) "Start Slime, if needed, load the current file and set the package." @@ -1619,12 +1620,11 @@ (file-error nil))) ;;; Interface -(defun slime-net-connect (host port &optional coding-system) +(defun slime-net-connect (host port coding-system) "Establish a connection with a CL." (let* ((inhibit-quit nil) (proc (open-network-stream "SLIME Lisp" nil host port)) - (buffer (slime-make-net-buffer " *cl-connection*")) - (coding-system (or coding-system slime-net-coding-system))) + (buffer (slime-make-net-buffer " *cl-connection*"))) (push proc slime-net-processes) (set-process-buffer proc buffer) (set-process-filter proc 'slime-net-filter) From heller at common-lisp.net Tue Nov 22 20:44:14 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Nov 2005 21:44:14 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051122204414.F1B39880D7@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1082 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Tue Nov 22 21:44:14 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.813 slime/ChangeLog:1.814 --- slime/ChangeLog:1.813 Tue Nov 22 11:37:57 2005 +++ slime/ChangeLog Tue Nov 22 21:44:14 2005 @@ -1,3 +1,8 @@ +2005-11-22 Marco Monteiro + + * slime.el (slime-connect): Use slime-net-coding system if the + optional arg coding-system was not supplied. + 2005-11-22 Helmut Eller * slime.el (slime-compile-file): Call 'check-parens before @@ -7,7 +12,7 @@ isn'tvalid instead of singalling an error. (slime-repl-history-file-coding-system): Use slime-find-coding-system to find the default. - + * swank-cmucl.lisp (accept-connection): Remove fd-handlers if the encoding isn't iso-latin-1.