From heller at common-lisp.net Tue Jan 11 20:30:30 2011 From: heller at common-lisp.net (CVS User heller) Date: Tue, 11 Jan 2011 15:30:30 -0500 Subject: [slime-cvs] CVS slime/contrib Message-ID: Update of /project/slime/cvsroot/slime/contrib In directory cl-net:/tmp/cvs-serv32550/contrib Modified Files: ChangeLog swank-mit-scheme.scm Log Message: Some upgrades for the MIT Scheme backend. * swank-mit-scheme.scm (netcat, netcat-accept): Use netcat-openbsd syntax. This version doesn't print the port number anymore defeating the original purpose of using netcat. (start-swank): Hardcode portnumber to 4055 until somebody cares enough to write proper server ports. (emacs-rex): Include a nonsense message with the :abort reply. --- /project/slime/cvsroot/slime/contrib/ChangeLog 2010/12/10 15:05:06 1.427 +++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/11 20:30:30 1.428 @@ -1,3 +1,14 @@ +2011-01-11 Helmut Eller + + Some upgrades for MIT Scheme backend. + + * swank-mit-scheme.scm (netcat, netcat-accept): Use netcat-openbsd + syntax. This version doesn't print the port number anymore + defeating the original purpose of using netcat. + (start-swank): Hardcode portnumber to 4055 until somebody cares + enough to write proper server ports. + (emacs-rex): Include a nonsense message with the :abort reply. + 2010-12-10 Stas Boukarev * slime-sprof.el (slime-sprof-browser): Rename to --- /project/slime/cvsroot/slime/contrib/swank-mit-scheme.scm 2009/07/12 08:01:10 1.5 +++ /project/slime/cvsroot/slime/contrib/swank-mit-scheme.scm 2011/01/11 20:30:30 1.6 @@ -68,8 +68,11 @@ (define (swank port) (accept-connections (or port 4005) #f)) +;; ### hardcoded port number for now. netcat-openbsd doesn't print +;; the listener port anymore. (define (start-swank port-file) - (accept-connections #f port-file)) + (accept-connections 4055 port-file) + ) ;;;; Networking @@ -84,22 +87,18 @@ (define (netcat port) (let* ((sh (os/shell-file-name)) - (cmd (format #f "exec netcat -s localhost -q 0 -l -v ~a 2>&1" - (if port (format #f "-p ~a" port) ""))) + (cmd (format #f "exec netcat -v -q 0 -l ~a 2>&1" port)) (netcat (start-pipe-subprocess sh (vector sh "-c" cmd) scheme-subprocess-environment)) - (line (read-line (subprocess-input-port netcat))) - (match (re-string-match "^listening on \\[[^]]+\\] \\([0-9]+\\) ...$" - line))) - (cond ((not match) - (close-port (subprocess-input-port netcat)) - (error "netcat:" line)) - (else (list netcat - (string->number (re-match-extract line match 1))))))) + ;;(line (read-line (subprocess-input-port netcat))) + ;;(match (re-string-match "^listening on \\[[^]]+\\] \\([0-9]+\\) ...$" + ;; line))) + ) + (list netcat port))) (define (netcat-accept nc) - (let* ((rx "^connect to \\[[^]]+\\] from [^ ]+ \\[[^]]+\\] \\([0-9]+\\)$") + (let* ((rx "^Connection from .+ port .+ accepted$") (line (read-line (subprocess-input-port nc))) (match (re-string-match rx line))) (cond ((not match) (error "netcat:" line)) @@ -217,13 +216,13 @@ (else (nearest-repl/environment)))) (define (emacs-rex socket level sexp package thread id) - (let ((ok? #f) (result #f)) + (let ((ok? #f) (result #f) (condition #f)) (dynamic-wind (lambda () #f) (lambda () (bind-condition-handler (list condition-type:serious-condition) - (lambda (c) (invoke-sldb socket (1+ level) c)) + (lambda (c) (set! condition c) (invoke-sldb socket (1+ level) c)) (lambda () (fluid-let ((*buffer-package* package)) (set! result @@ -231,8 +230,14 @@ swank-env)) (set! ok? #t))))) (lambda () - (write-packet `(:return ,(if ok? `(:ok ,result) '(:abort)) - ,id) + (write-packet `(:return + ,(if ok? `(:ok ,result) + `(:abort + ,(if condition + (format #f "~a" + (condition/type condition)) + ""))) + ,id) socket))))) (define (swank:connection-info _) From heller at common-lisp.net Wed Jan 12 15:01:07 2011 From: heller at common-lisp.net (CVS User heller) Date: Wed, 12 Jan 2011 10:01:07 -0500 Subject: [slime-cvs] CVS slime/contrib Message-ID: Update of /project/slime/cvsroot/slime/contrib In directory cl-net:/tmp/cvs-serv22038/contrib Modified Files: ChangeLog swank-mit-scheme.scm Log Message: Some more MIT Scheme fixes. * swank-mit-scheme.scm (swank:compile-string-for-emacs) (swank:compile-file-for-emacs): Use new result format. (swank:disassemble-form): Added with the needed kludgery for quoted forms. (swank:swank-require): Define this as nop. --- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/11 20:30:30 1.428 +++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/12 15:01:07 1.429 @@ -1,3 +1,13 @@ +2011-01-12 Helmut Eller + + Some more MIT Scheme fixes. + + * swank-mit-scheme.scm (swank:compile-string-for-emacs) + (swank:compile-file-for-emacs): Use new result format. + (swank:disassemble-form): Added with the needed kludgery for + quoted forms. + (swank:swank-require): Define this as nop. + 2011-01-11 Helmut Eller Some upgrades for MIT Scheme backend. --- /project/slime/cvsroot/slime/contrib/swank-mit-scheme.scm 2011/01/11 20:30:30 1.6 +++ /project/slime/cvsroot/slime/contrib/swank-mit-scheme.scm 2011/01/12 15:01:07 1.7 @@ -10,10 +10,10 @@ 1. You need MIT Scheme (version 7.7.0 and 7.7.90 seem to work). -2. You also need the `netcat' program to create sockets. MIT Scheme - has some socket functions built-in, but I couldn't figure out how - to access the locat port number of a server socket. We shell out - to netcat to get us started. +2. You also need the `netcat' program to create sockets + (netcat-openbsd on Debian). MIT Scheme has some socket functions + built-in, but I couldn't figure out how to access the locat port + number of a server socket. We shell out to netcat to get us started. 3. The Emacs side needs some fiddling. I have the following in my .emacs: @@ -48,6 +48,7 @@ (match-string-no-properties 1))))) (setq slime-find-buffer-package-function 'find-mit-scheme-package) +(add-hook 'scheme-mode-hook (lambda () (slime-mode 1))) The `mit-scheme-init' function first loads the SOS and FORMAT libraries, then creates a package "(swank)", and loads this file @@ -76,6 +77,20 @@ ;;;; Networking +#| +;; ### doesn't work because 1) open-tcp-server-socket doesn't set the +;; SO_REUSEADDR option and 2) we can't read the port number of the +;; created socket. +(define (accept-connections port port-file) + (let ((sock (open-tcp-server-socket port (host-address-loopback)))) + (format #t "Listening on port: ~s~%" port) + (if port-file (write-port-file port port-file)) + (dynamic-wind + (lambda () #f) + (lambda () (serve (tcp-server-connection-accept sock #t #f))) + (lambda () (close-tcp-server-socket sock))))) +|# + (define (accept-connections port port-file) (let ((nc (netcat port))) (format #t "Listening on port: ~s~%" (cadr nc)) @@ -90,11 +105,7 @@ (cmd (format #f "exec netcat -v -q 0 -l ~a 2>&1" port)) (netcat (start-pipe-subprocess sh (vector sh "-c" cmd) - scheme-subprocess-environment)) - ;;(line (read-line (subprocess-input-port netcat))) - ;;(match (re-string-match "^listening on \\[[^]]+\\] \\([0-9]+\\) ...$" - ;; line))) - ) + scheme-subprocess-environment))) (list netcat port))) (define (netcat-accept nc) @@ -330,13 +341,16 @@ ;;;; Compilation (define (swank:compile-string-for-emacs _ string . x) - (call-compiler - (lambda () - (let* ((sexps (snarf-string string)) - (env (user-env *buffer-package*)) - (scode (syntax `(begin , at sexps) env)) - (compiled-expression (compile-scode scode #t))) - (scode-eval compiled-expression env))))) + (apply + (lambda (errors seconds) + `(:compilation-result ,errors t ,seconds nil nil)) + (call-compiler + (lambda () + (let* ((sexps (snarf-string string)) + (env (user-env *buffer-package*)) + (scode (syntax `(begin , at sexps) env)) + (compiled-expression (compile-scode scode #t))) + (scode-eval compiled-expression env)))))) (define (snarf-string string) (with-input-from-string string @@ -350,23 +364,32 @@ (with-timings fun (lambda (run-time gc-time real-time) (set! time real-time))) - (list 'nil (format #f "~a" (internal-time/ticks->seconds time))))) + (list 'nil (internal-time/ticks->seconds time)))) (define (swank:compiler-notes-for-emacs _) nil) (define (swank:compile-file-for-emacs socket file load?) - (call-compiler - (lambda () - (with-output-to-repl socket - (lambda () (compile-file file))) - (cond ((elisp-true? load?) - (load (pathname-new-type file "com") - (user-env *buffer-package*))))))) + (apply + (lambda (errors seconds) + (list ':compilation-result errors 't seconds load? + (->namestring (pathname-new-type file "com")))) + (call-compiler + (lambda () (with-output-to-repl socket (lambda () (compile-file file))))))) (define (swank:load-file socket file) (with-output-to-repl socket (lambda () (load file (user-env *buffer-package*))))) +(define (swank:disassemble-form _ string) + (let ((sexp (let ((sexp (read-from-string string))) + (cond ((and (pair? sexp) (eq? (car sexp) 'quote)) + (cadr sexp)) + (#t sexp))))) + (with-output-to-string + (lambda () + (compiler:disassemble + (eval sexp (user-env *buffer-package*))))))) + (define (swank:disassemble-symbol _ string) (with-output-to-string (lambda () @@ -408,6 +431,7 @@ ;;; Some unimplemented stuff. (define (swank:buffer-first-change . _) nil) (define (swank:filename-to-modulename . _) nil) +(define (swank:swank-require . _) nil) ;; M-. is beyond my capabilities. (define (swank:find-definitions-for-emacs . _) nil) From heller at common-lisp.net Thu Jan 20 22:00:12 2011 From: heller at common-lisp.net (CVS User heller) Date: Thu, 20 Jan 2011 17:00:12 -0500 Subject: [slime-cvs] CVS slime/contrib Message-ID: Update of /project/slime/cvsroot/slime/contrib In directory cl-net:/tmp/cvs-serv20510/contrib Modified Files: ChangeLog swank-mit-scheme.scm Log Message: * swank-mit-scheme.scm (swank:load-file): Print the result instead of returning it. * swank-mit-scheme.scm: Require release 9. --- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/12 15:01:07 1.429 +++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/20 22:00:11 1.430 @@ -1,3 +1,10 @@ +2011-01-20 Helmut Eller + + * swank-mit-scheme.scm (swank:load-file): Print the result + instead of returning it which breaks the protocol. + + * swank-mit-scheme.scm: Require release 9. + 2011-01-12 Helmut Eller Some more MIT Scheme fixes. --- /project/slime/cvsroot/slime/contrib/swank-mit-scheme.scm 2011/01/12 15:01:07 1.7 +++ /project/slime/cvsroot/slime/contrib/swank-mit-scheme.scm 2011/01/20 22:00:12 1.8 @@ -8,7 +8,7 @@ ;;;; Installation: #| -1. You need MIT Scheme (version 7.7.0 and 7.7.90 seem to work). +1. You need MIT Scheme 9.0.1 2. You also need the `netcat' program to create sockets (netcat-openbsd on Debian). MIT Scheme has some socket functions @@ -66,6 +66,10 @@ ;;; package: (swank) +(if (< (car (get-subsystem-version "Release")) + '9) + (error "This file requires MIT Scheme Release 9")) + (define (swank port) (accept-connections (or port 4005) #f)) @@ -378,7 +382,9 @@ (define (swank:load-file socket file) (with-output-to-repl socket - (lambda () (load file (user-env *buffer-package*))))) + (lambda () + (pprint-to-string + (load file (user-env *buffer-package*)))))) (define (swank:disassemble-form _ string) (let ((sexp (let ((sexp (read-from-string string))) From sboukarev at common-lisp.net Thu Jan 20 23:34:22 2011 From: sboukarev at common-lisp.net (CVS User sboukarev) Date: Thu, 20 Jan 2011 18:34:22 -0500 Subject: [slime-cvs] CVS slime Message-ID: Update of /project/slime/cvsroot/slime In directory cl-net:/tmp/cvs-serv14041 Modified Files: ChangeLog swank-ecl.lisp Log Message: * swank-ecl.lisp (+TAGS+): change (translate-logical-pathname #P"SYS:TAGS") to (merge-pathnames "TAGS" (translate-logical-pathname "SYS:")) because of case conversion the former results in a pathname with a name "tags", which doesn't exist. --- /project/slime/cvsroot/slime/ChangeLog 2010/12/10 15:05:05 1.2168 +++ /project/slime/cvsroot/slime/ChangeLog 2011/01/20 23:34:21 1.2169 @@ -1,3 +1,11 @@ +2011-01-20 Stas Boukarev + + * swank-ecl.lisp (+TAGS+): change + (translate-logical-pathname #P"SYS:TAGS") to + (merge-pathnames "TAGS" (translate-logical-pathname "SYS:")) + because of case conversion the former results in a pathname with a + name "tags", which doesn't exist. + 2010-12-10 Stas Boukarev * slime.el (slime-with-popup-buffer): Correct the docstring. --- /project/slime/cvsroot/slime/swank-ecl.lisp 2010/09/28 21:46:02 1.67 +++ /project/slime/cvsroot/slime/swank-ecl.lisp 2011/01/20 23:34:22 1.68 @@ -498,7 +498,8 @@ ;;;; Definitions -(defvar +TAGS+ (namestring (translate-logical-pathname #P"SYS:TAGS"))) +(defvar +TAGS+ (namestring + (merge-pathnames "TAGS" (translate-logical-pathname "SYS:")))) (defun make-file-location (file file-position) ;; File positions in CL start at 0, but Emacs' buffer positions From sboukarev at common-lisp.net Sun Jan 23 00:08:09 2011 From: sboukarev at common-lisp.net (CVS User sboukarev) Date: Sat, 22 Jan 2011 19:08:09 -0500 Subject: [slime-cvs] CVS slime/contrib Message-ID: Update of /project/slime/cvsroot/slime/contrib In directory cl-net:/tmp/cvs-serv8772 Modified Files: ChangeLog slime-repl.el Log Message: * slime-repl.el (slime-repl-shortcut-help): Don't make ? an alias for help, ? is bound to minibuffer-completion-help, and you can't enter it. --- /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/20 22:00:11 1.430 +++ /project/slime/cvsroot/slime/contrib/ChangeLog 2011/01/23 00:08:08 1.431 @@ -1,3 +1,9 @@ +2011-01-22 Stas Boukarev + + * slime-repl.el (slime-repl-shortcut-help): Don't make ? an alias + for help, ? is bound to minibuffer-completion-help, and you can't + enter it. + 2011-01-20 Helmut Eller * swank-mit-scheme.scm (swank:load-file): Print the result --- /project/slime/cvsroot/slime/contrib/slime-repl.el 2010/09/26 18:10:33 1.52 +++ /project/slime/cvsroot/slime/contrib/slime-repl.el 2011/01/23 00:08:09 1.53 @@ -1287,8 +1287,7 @@ (not (null buffer-file-name))))) (save-some-buffers))) - -(defslime-repl-shortcut slime-repl-shortcut-help ("help" "?") +(defslime-repl-shortcut slime-repl-shortcut-help ("help") (:handler 'slime-list-repl-short-cuts) (:one-liner "Display the help.")) From heller at common-lisp.net Wed Jan 26 07:17:51 2011 From: heller at common-lisp.net (CVS User heller) Date: Wed, 26 Jan 2011 02:17:51 -0500 Subject: [slime-cvs] CVS slime Message-ID: Update of /project/slime/cvsroot/slime In directory cl-net:/tmp/cvs-serv19156 Modified Files: ChangeLog swank.lisp Log Message: Allow tail-merging in call-with-bindings. * swank.lisp (call-with-bindings): Don't use progv if alist is empty alist is empty. --- /project/slime/cvsroot/slime/ChangeLog 2011/01/20 23:34:21 1.2169 +++ /project/slime/cvsroot/slime/ChangeLog 2011/01/26 07:17:50 1.2170 @@ -1,3 +1,10 @@ +2011-01-26 Helmut Eller + + Allow tail-merging in call-with-bindings. + + * swank.lisp (call-with-bindings): Don't use progv if alist is + empty alist is empty. + 2011-01-20 Stas Boukarev * swank-ecl.lisp (+TAGS+): change --- /project/slime/cvsroot/slime/swank.lisp 2010/12/09 18:51:17 1.734 +++ /project/slime/cvsroot/slime/swank.lisp 2011/01/26 07:17:51 1.735 @@ -177,11 +177,13 @@ (defun call-with-bindings (alist fun) "Call FUN with variables bound according to ALIST. ALIST is a list of the form ((VAR . VAL) ...)." - (let* ((rlist (reverse alist)) - (vars (mapcar #'car rlist)) - (vals (mapcar #'cdr rlist))) - (progv vars vals - (funcall fun)))) + (if (null alist) + (funcall fun) + (let* ((rlist (reverse alist)) + (vars (mapcar #'car rlist)) + (vals (mapcar #'cdr rlist))) + (progv vars vals + (funcall fun))))) (defmacro with-bindings (alist &body body) "See `call-with-bindings'." From sboukarev at common-lisp.net Fri Jan 28 19:19:30 2011 From: sboukarev at common-lisp.net (CVS User sboukarev) Date: Fri, 28 Jan 2011 14:19:30 -0500 Subject: [slime-cvs] CVS slime Message-ID: Update of /project/slime/cvsroot/slime In directory cl-net:/tmp/cvs-serv8371 Modified Files: ChangeLog slime.el Log Message: * slime.el (slime-check-location-filename-sanity): Guard against target-filename being NIL. --- /project/slime/cvsroot/slime/ChangeLog 2011/01/26 07:17:50 1.2170 +++ /project/slime/cvsroot/slime/ChangeLog 2011/01/28 19:19:30 1.2171 @@ -1,3 +1,8 @@ +2011-01-28 Stas Boukarev + + * slime.el (slime-check-location-filename-sanity): Guard + against target-filename being NIL. + 2011-01-26 Helmut Eller Allow tail-merging in call-with-bindings. --- /project/slime/cvsroot/slime/slime.el 2010/12/10 15:05:05 1.1352 +++ /project/slime/cvsroot/slime/slime.el 2011/01/28 19:19:30 1.1353 @@ -3222,7 +3222,8 @@ (flet ((file-truename-safe (filename) (and filename (file-truename filename)))) (let ((target-filename (file-truename-safe filename)) (buffer-filename (file-truename-safe (buffer-file-name)))) - (when buffer-filename + (when (and target-filename + buffer-filename) (slime-maybe-warn-for-different-source-root target-filename buffer-filename))))))