From mbaringer at common-lisp.net Tue Mar 1 23:23:50 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Wed, 2 Mar 2005 00:23:50 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/swank-loader.lisp Message-ID: <20050301232350.3BEE3880E2@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv20733 Modified Files: swank-loader.lisp Log Message: Look for a file in the same directory as swank-loader.lisp called site-init.lisp. If it exists we load that instead of attempting to load ~/.swank.lisp. (user-init-file): Superseded by load-user-init-file. (load-user-init-file): New function. (load-site-init-file): New function. Date: Wed Mar 2 00:23:49 2005 Author: mbaringer From mbaringer at common-lisp.net Tue Mar 1 23:24:06 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Wed, 2 Mar 2005 00:24:06 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/ChangeLog Message-ID: <20050301232406.9A184880E2@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv20759 Modified Files: ChangeLog Log Message: Date: Wed Mar 2 00:24:06 2005 Author: mbaringer From lgorrie at common-lisp.net Wed Mar 2 23:50:30 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 3 Mar 2005 00:50:30 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050302235030.B28EE88669@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6648 Modified Files: swank-sbcl.lisp Log Message: Fixed for (and requires) 0.8.20. Date: Thu Mar 3 00:50:29 2005 Author: lgorrie Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.119 slime/swank-sbcl.lisp:1.120 --- slime/swank-sbcl.lisp:1.119 Tue Mar 1 00:32:06 2005 +++ slime/swank-sbcl.lisp Thu Mar 3 00:50:29 2005 @@ -504,7 +504,7 @@ (defimplementation print-frame (frame stream) (let ((*standard-output* stream)) - (sb-debug::print-frame-call frame :verbosity 1 :number nil))) + (sb-debug::print-frame-call frame stream :verbosity 1 :number nil))) (defun code-location-source-path (code-location) (let* ((location (sb-debug::maybe-block-start-location code-location)) @@ -554,8 +554,8 @@ (:lisp (make-location (list :source-form (with-output-to-string (*standard-output*) - (sb-debug::print-code-location-source-form - code-location 100))) + (print (sb-debug::code-location-source-form + code-location 100)))) (list :position 0)))))) (defun safe-source-location-for-emacs (code-location) From lgorrie at common-lisp.net Wed Mar 2 23:51:17 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 3 Mar 2005 00:51:17 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050302235117.0AD1588669@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6665 Modified Files: ChangeLog Log Message: Date: Thu Mar 3 00:51:12 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.618 slime/ChangeLog:1.619 --- slime/ChangeLog:1.618 Wed Mar 2 00:24:05 2005 +++ slime/ChangeLog Thu Mar 3 00:50:48 2005 @@ -1,3 +1,7 @@ +2005-03-03 Nikodemus Siivola + + * swank-sbcl.lisp: Fixed for (and requires) 0.8.20. + 2005-03-02 Marco Baringer * swank-loader.lisp Look for a file in the same directory as From lgorrie at common-lisp.net Thu Mar 3 00:04:20 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 3 Mar 2005 01:04:20 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050303000420.CACCA88685@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7577 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Thu Mar 3 01:04:03 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.619 slime/ChangeLog:1.620 --- slime/ChangeLog:1.619 Thu Mar 3 00:50:48 2005 +++ slime/ChangeLog Thu Mar 3 01:03:49 2005 @@ -1,6 +1,7 @@ 2005-03-03 Nikodemus Siivola - * swank-sbcl.lisp: Fixed for (and requires) 0.8.20. + * swank-sbcl.lisp: Fixed for latest SBCL HEAD revision and + temporarily backwards-compatible with the current release. 2005-03-02 Marco Baringer From lgorrie at common-lisp.net Thu Mar 3 00:12:03 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 3 Mar 2005 01:12:03 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050303001203.DBA1988671@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv8029 Modified Files: swank-sbcl.lisp Log Message: Fixed for latest SBCL HEAD revision and temporarily backwards-compatible with the current release. Date: Thu Mar 3 01:12:02 2005 Author: lgorrie Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.120 slime/swank-sbcl.lisp:1.121 --- slime/swank-sbcl.lisp:1.120 Thu Mar 3 00:50:29 2005 +++ slime/swank-sbcl.lisp Thu Mar 3 01:11:58 2005 @@ -503,8 +503,26 @@ collect f))) (defimplementation print-frame (frame stream) - (let ((*standard-output* stream)) - (sb-debug::print-frame-call frame stream :verbosity 1 :number nil))) + (macrolet ((printer-form () + ;; MEGAKLUDGE: As SBCL 0.8.20.1 fixed its debug IO style + ;; our usage of unexported interfaces came back to haunt + ;; us. And since we still use the same interfaces it will + ;; haunt us again. + (let ((print-sym (find-symbol "PRINT-FRAME-CALL" :sb-debug))) + (if (fboundp print-sym) + (let* ((args (sb-introspect:function-arglist print-sym)) + (key-pos (position '&key args))) + (cond ((eql 2 key-pos) + `(,print-sym frame stream)) + ((eql 1 key-pos) + `(let ((*standard-output* stream)) + (,print-sym frame))) + (t + (error "*THWAP* SBCL changes internals ~ + again!")))) + (error "You're in a twisty little maze of unsupported + SBCL interfaces, all different."))))) + (printer-form))) (defun code-location-source-path (code-location) (let* ((location (sb-debug::maybe-block-start-location code-location)) @@ -528,6 +546,30 @@ (consp info) (eq :emacs-buffer (car info))))) +(defun print-code-location-source-form (code-location context) + (macrolet ((printer-form () + ;; KLUDGE: These are both unexported interfaces, used + ;; by different versions of SBCL. ...sooner or later + ;; this will change again: hopefully by then we have + ;; figured out the interface we want to drive the + ;; debugger with and requested it from the SBCL + ;; folks. + (let ((print-code-sym + (find-symbol "PRINT-CODE-LOCATION-SOURCE-FORM" + :sb-debug)) + (code-sym + (find-symbol "CODE-LOCATION-SOURCE-FORM" + :sb-debug))) + (cond ((fboundp print-code-sym) + `(,print-code-sym code-location context)) + ((fboundp code-sym) + `(prin1 (,code-sym code-location context))) + (t + (error + "*THWAP* SBCL changes its debugger interface ~ + again!")))))) + (printer-form))) + (defun source-location-for-emacs (code-location) (let* ((debug-source (sb-di:code-location-debug-source code-location)) (from (sb-di:debug-source-from debug-source)) @@ -554,8 +596,7 @@ (:lisp (make-location (list :source-form (with-output-to-string (*standard-output*) - (print (sb-debug::code-location-source-form - code-location 100)))) + (print-code-location-source-form code-location 100))) (list :position 0)))))) (defun safe-source-location-for-emacs (code-location) From heller at common-lisp.net Fri Mar 4 23:43:33 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 5 Mar 2005 00:43:33 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050304234333.7907288678@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv10678 Modified Files: slime.el Log Message: (slime-inferior-lisp): Don't display the buffer. Let callers do that. (slime): Display the inferior buffer. (slime-net-sentinel): Always print a message when the lisp disconnects. (slime-quit-lisp, slime-quit-sentinel): Use set a special sentinel and do most of the cleanups there. (slime-repl-sayoonara): Use slime-quit-lisp. (slime-restart-inferior-lisp, slime-restart-inferior-lisp-aux) (slime-restart-sentinel): Use a special sentinel to restart processes. (slime-hide-inferior-lisp-buffer): Do the windows arrangement a bit differently. Related to restart-lisp. (slime-repl-buffer): Take the connection as second optional argument. Useful for rearranging dead windows of dead processes. (slime-trace-query): The :defgeneric query was bogus. (slime-extract-context): Don't skip over the method name if we are already at the end of the name. Date: Sat Mar 5 00:43:32 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.462 slime/slime.el:1.463 --- slime/slime.el:1.462 Tue Mar 1 00:29:42 2005 +++ slime/slime.el Sat Mar 5 00:43:29 2005 @@ -1190,7 +1190,8 @@ (when (or (not (slime-bytecode-stale-p)) (slime-urge-bytecode-recompile)) (let ((proc (slime-maybe-start-lisp command buffer))) - (slime-inferior-connect proc nil))))) + (slime-inferior-connect proc nil) + (pop-to-buffer (process-buffer proc)))))) (defun slime-connect (host port &optional kill-old-p) "Connect to a running Swank server." @@ -1345,7 +1346,6 @@ (comint-mode) (comint-exec (current-buffer) "inferior-lisp" (car args) nil (cdr args)) (lisp-mode-variables t) - (pop-to-buffer (current-buffer)) (get-buffer-process (current-buffer))))) (defun slime-inferior-connect (process &optional retries) @@ -1417,16 +1417,18 @@ (let* ((buffer (if (slime-process) (process-buffer (slime-process)))) (window (if buffer (get-buffer-window buffer))) - (repl (slime-output-buffer t))) + (repl-buffer (slime-output-buffer t)) + (repl-window (get-buffer-window repl-buffer))) (when buffer (bury-buffer buffer)) - (if window - (if (null (get-buffer-window repl)) - (set-window-buffer window repl) - (save-selected-window - (select-window window) - (switch-to-buffer (other-buffer)))) - (pop-to-buffer repl)))) + (cond (repl-window + (when window + (delete-window window))) + (window + (set-window-buffer window repl-buffer)) + (t + (pop-to-buffer repl-buffer) + (goto-char (point-max)))))) ;;; Words of encouragement @@ -1571,8 +1573,7 @@ (ignore-errors (kill-buffer (process-buffer process)))) (defun slime-net-sentinel (process message) - (when (ignore-errors (eq (process-status (inferior-lisp-proc)) 'open)) - (message "Lisp connection closed unexpectedly: %s" message)) + (message "Lisp connection closed unexpectedly: %s" message) (slime-net-close process) (slime-set-state "[not connected]" process)) @@ -1599,7 +1600,6 @@ (message "net-read error: %S" error) (ding) (sleep-for 2) - (debug) (ignore-errors (slime-net-close proc)) (error "PANIC!"))))) (save-current-buffer @@ -2553,10 +2553,10 @@ (defvar slime-repl-mode-map) -(defun slime-repl-buffer (&optional create) +(defun slime-repl-buffer (&optional create connection) "Get the REPL buffer for the current connection; optionally create." (funcall (if create #'get-buffer-create #'get-buffer) - (format "*slime-repl %s*" (slime-connection-name)))) + (format "*slime-repl %s*" (slime-connection-name connection)))) (defun slime-repl-mode () "Major mode for interacting with a superior Lisp. @@ -3200,7 +3200,7 @@ (:handler (lambda () (interactive) (when (slime-connected-p) - (slime-eval-async '(swank:quit-lisp))) + (slime-quit-lisp)) (slime-kill-all-buffers))) (:one-liner "Quit all Lisps and close all SLIME buffers.")) @@ -3254,21 +3254,37 @@ (:one-liner "Recompile (but not load) an ASDF system.")) (defslime-repl-shortcut slime-restart-inferior-lisp ("restart-inferior-lisp") - (:handler (lambda () - (interactive) - (when (slime-connected-p) - (slime-eval-async '(swank:quit-lisp))) - (let ((proc (slime-process))) - (kill-process proc) - (while (memq (process-status proc) '(run stop)) - (sit-for 0 20)) - (let* ((args (mapconcat #'identity (process-command proc) " ")) - (buffer (buffer-name (process-buffer proc))) - (new-proc (slime-start-lisp args buffer - (slime-init-command)))) - (slime-inferior-connect new-proc))))) + (:handler 'slime-restart-inferior-lisp-aux) (:one-liner "Restart *inferior-lisp* and reconnect SLIME.")) +(defun slime-restart-inferior-lisp-aux () + (interactive) + (slime-eval-async '(swank:quit-lisp)) + (set-process-sentinel (slime-connection) 'slime-restart-sentinel)) + +(defun slime-restart-sentinel (process message) + "Restart the inferior lisp process. +Also rearrange windows." + (assert (process-status process) 'closed) + (let* ((proc (slime-inferior-process process)) + (args (mapconcat #'identity (process-command proc) " ")) + (buffer (buffer-name (process-buffer proc))) + (buffer-window (get-buffer-window buffer)) + (new-proc (slime-start-lisp args buffer (slime-init-command))) + (repl-buffer (slime-repl-buffer nil process)) + (repl-window (and repl-buffer (get-buffer-window repl-buffer)))) + (slime-net-close process) + (slime-inferior-connect new-proc) + (cond ((and repl-window (not buffer-window)) + (set-window-buffer repl-window buffer) + (select-window repl-window)) + (repl-window + (select-window repl-window)) + (t + (pop-to-buffer buffer))) + (switch-to-buffer buffer) + (goto-char (point-max)))) + ;;;;; Cleanup after a quit @@ -5111,6 +5127,7 @@ (defun slime-etags-definitions (name) "Search definitions matching NAME in the tags file. The result is a (possibly empty) list of definitions." + (require 'etags) (let ((defs '())) (save-excursion (let ((first-time t)) @@ -5364,19 +5381,19 @@ (message "%s" (slime-eval `(swank:swank-toggle-trace ,spec)))))))) (defun slime-trace-query (spec) - "Ask the user which function to query; SPEC is the default. + "Ask the user which function to trace; SPEC is the default. The result is a string." (cond ((symbolp spec) (slime-read-from-minibuffer "(Un)trace: " (symbol-name spec))) (t (destructure-case spec - ((:setf n) + ((setf n) (slime-read-from-minibuffer "(Un)trace: " (prin1-to-string spec))) (((:defun :defmacro) n) (slime-read-from-minibuffer "(Un)trace: " (prin1-to-string n))) ((:defgeneric n) (let* ((name (prin1-to-string n)) - (answer (slime-read-from-minibuffer "(Un)trace: " name))) + (answer (slime-read-from-minibuffer "(Un)trace: " n))) (cond ((and (string= name answer) (y-or-n-p (concat "(Un)trace also all " "methods implementing " @@ -5432,7 +5449,8 @@ (backward-up-list 1) (slime-parse-context `(setf ,name))) ((slime-in-expression-p '(defmethod *)) - (forward-sexp 1) + (unless (looking-at "\\>\\|\\s ") + (forward-sexp 1)) ; skip over the methodname (let (qualifiers arglist) (loop for e = (read (current-buffer)) until (listp e) do (push e qualifiers) @@ -5997,17 +6015,22 @@ (defun slime-quit () (error "Not implemented properly. Use `slime-interrupt' instead.")) -(defun slime-quit-lisp () +(defun slime-quit-lisp (&optional keep-buffers) "Quit lisp, kill the inferior process and associated buffers." (interactive) - (let* ((connection (slime-connection)) - (output (slime-output-buffer)) - (inferior (slime-inferior-process)) + (slime-eval-async '(swank:quit-lisp)) + (kill-buffer (slime-output-buffer)) + (set-process-sentinel (slime-connection) 'slime-quit-sentinel)) + +(defun slime-quit-sentinel (process message) + (assert (process-status process) 'closed) + (let* ((inferior (slime-inferior-process process)) (inferior-buffer (if inferior (process-buffer inferior)))) - (slime-eval-async '(swank:quit-lisp)) - (kill-buffer output) (when inferior (delete-process inferior)) - (when inferior-buffer (kill-buffer inferior-buffer)))) + (when inferior-buffer (kill-buffer inferior-buffer)) + (slime-net-close process) + (slime-set-state "[not connected]" process) + (message "Connection closed."))) (defun slime-set-package (package) (interactive (list (slime-read-package-name "Package: " From heller at common-lisp.net Fri Mar 4 23:44:18 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 5 Mar 2005 00:44:18 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-allegro.lisp Message-ID: <20050304234418.133C388678@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv10710 Modified Files: swank-allegro.lisp Log Message: (process-fspec-for-allegro, toggle-trace): Handle setf functions. (tracedp): Fix free variable. (call-with-debugging-environment, find-topframe): Hide the first 2 frames. Those are created by swank-internal functions. Date: Sat Mar 5 00:44:17 2005 Author: heller Index: slime/swank-allegro.lisp diff -u slime/swank-allegro.lisp:1.70 slime/swank-allegro.lisp:1.71 --- slime/swank-allegro.lisp:1.70 Tue Mar 1 00:32:06 2005 +++ slime/swank-allegro.lisp Sat Mar 5 00:44:17 2005 @@ -141,10 +141,15 @@ (defvar *sldb-topframe*) (defimplementation call-with-debugging-environment (debugger-loop-fn) - (let ((*sldb-topframe* (excl::int-newest-frame)) + (let ((*sldb-topframe* (find-topframe)) (excl::*break-hook* nil)) (funcall debugger-loop-fn))) +(defun find-topframe () + (do ((f (excl::int-newest-frame) (next-frame f)) + (i 0 (1+ i))) + ((= i 3) f))) + (defun next-frame (frame) (let ((next (excl::int-next-older-frame frame))) (cond ((not next) nil) @@ -415,7 +420,7 @@ ;; list-callers implemented by groveling through all fbound symbols. ;; Only symbols are considered. Functions in the constant pool are -;; searched recursevly. Closure environments are ignored at the +;; searched recursively. Closure environments are ignored at the ;; moment (constants in methods are therefore not found). (defun map-function-constants (function fn depth) @@ -687,7 +692,7 @@ (defimplementation toggle-trace (spec) (ecase (car spec) (:defgeneric (toggle-trace-generic-function-methods (second spec))) - ((:defmethod :labels :flet) + ((setf :defmethod :labels :flet) (toggle-trace-aux (process-fspec-for-allegro spec))) (:call (destructuring-bind (caller callee) (cdr spec) @@ -695,7 +700,7 @@ :inside (list (process-fspec-for-allegro caller))))))) (defun tracedp (fspec) - (member name (eval '(trace)) :test #'equal)) + (member fspec (eval '(trace)) :test #'equal)) (defun toggle-trace-aux (fspec &rest args) (cond ((tracedp fspec) @@ -720,6 +725,7 @@ (defun process-fspec-for-allegro (fspec) (cond ((consp fspec) (ecase (first fspec) + ((setf) fspec) ((:defun :defgeneric) (second fspec)) ((:defmethod) `(method ,@(rest fspec))) ((:labels) `(labels ,(process-fspec-for-allegro (second fspec)) From heller at common-lisp.net Fri Mar 4 23:44:42 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 5 Mar 2005 00:44:42 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050304234442.3F12288678@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv10730 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Sat Mar 5 00:44:38 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.620 slime/ChangeLog:1.621 --- slime/ChangeLog:1.620 Thu Mar 3 01:03:49 2005 +++ slime/ChangeLog Sat Mar 5 00:44:38 2005 @@ -1,3 +1,35 @@ +2005-03-05 Helmut Eller + + * slime.el (slime-net-sentinel): Always print a message when the + lisp disconnects. + (slime-inferior-lisp): Don't display the buffer. Let callers do + that. + (slime): Display the inferior buffer here. + (slime-quit-lisp, slime-quit-sentinel): Use set a special sentinel + and do most of the cleanups there. + (slime-repl-sayoonara): Use slime-quit-lisp. + (slime-restart-inferior-lisp, slime-restart-inferior-lisp-aux) + (slime-restart-sentinel): Use a special sentinel to restart + processes. + (slime-hide-inferior-lisp-buffer): Do the windows arrangement a + bit differently. Related to restart-lisp. + (slime-repl-buffer): Take the connection as second optional + argument. Useful for rearranging windows for dead processes. + + * swank-allegro.lisp (call-with-debugging-environment) + (find-topframe): Hide the first 2 frames. Those are created + by swank-internal functions. + +2005-03-04 Antonio Menezes Leitao + + * swank-allegro.lisp (process-fspec-for-allegro, toggle-trace): + Handle setf functions. + (tracedp): Fix free variable. + + * slime.el (slime-trace-query): The :defgeneric query was bogus. + (slime-extract-context): Don't skip over the method name if we are + already at the end of the name. + 2005-03-03 Nikodemus Siivola * swank-sbcl.lisp: Fixed for latest SBCL HEAD revision and From lgorrie at common-lisp.net Sun Mar 6 16:49:25 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 6 Mar 2005 17:49:25 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050306164925.A079B8866E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22058 Modified Files: swank.lisp Log Message: Export LOG-OUTPUT. Date: Sun Mar 6 17:49:24 2005 Author: lgorrie Index: slime/swank.lisp diff -u slime/swank.lisp:1.282 slime/swank.lisp:1.283 --- slime/swank.lisp:1.282 Tue Mar 1 00:32:58 2005 +++ slime/swank.lisp Sun Mar 6 17:49:23 2005 @@ -24,6 +24,7 @@ ;; These are user-configurable variables: #:*communication-style* #:*log-events* + #:*log-output* #:*use-dedicated-output-stream* #:*configure-emacs-indentation* #:*readtable-alist* From lgorrie at common-lisp.net Sun Mar 6 16:49:51 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 6 Mar 2005 17:49:51 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050306164951.CBA608866E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22092 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Sun Mar 6 17:49:50 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.621 slime/ChangeLog:1.622 --- slime/ChangeLog:1.621 Sat Mar 5 00:44:38 2005 +++ slime/ChangeLog Sun Mar 6 17:49:50 2005 @@ -1,3 +1,7 @@ +2005-03-06 Luke Gorrie + + * swank.lisp: Export *LOG-OUTPUT*. + 2005-03-05 Helmut Eller * slime.el (slime-net-sentinel): Always print a message when the From lgorrie at common-lisp.net Sun Mar 6 21:43:35 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 6 Mar 2005 22:43:35 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050306214335.4FC838866E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6040 Modified Files: swank.lisp Log Message: (format-arglist-for-echo-area): Use extra-keywords to enrich the list of keywords. (arglist-to-string): Remove extraneous whitespace. (keyword-arg, optional-arg): New structures. (decode-keyword-arg, decode-optional-arg): Return structure objects rather than multiple values. (encode-keyword-arg, encode-optional-arg, encode-arglist): New functions. (arglist): New slot key-p. (decode-arglist): Handle &whole, &environment. Store more information on optional and keyword args, set arglist.key-p. (values-equal?): Removed. (print-decoded-arglist-as-template): If keyword is not a keyword symbol, quote it in the template. (extra-keywords): Return a secondary value (allow-other-keys). For make-instance, try to finalize the class if it is not finalized yet (fix for Allegro CL 6.2). If class is not finalizable, use direct slots instead of slots and indicate that the keywords are not complete. (enrich-decoded-arglist-with-extra-keywords): New function, use the secondary value of extra-keywords. (arglist-for-insertion, complete-form): Use it here. (remove-keywords-alist): New variable. (remove-actual-args): When the keyword :test is provided, don't suggest :test-not and vice versa. Date: Sun Mar 6 22:43:34 2005 Author: lgorrie Index: slime/swank.lisp diff -u slime/swank.lisp:1.283 slime/swank.lisp:1.284 --- slime/swank.lisp:1.283 Sun Mar 6 17:49:23 2005 +++ slime/swank.lisp Sun Mar 6 22:43:33 2005 @@ -1149,6 +1149,9 @@ (let ((symbol (parse-symbol string))) (valid-operator-symbol-p symbol))) + +;;;; Arglists + (defslimefun arglist-for-echo-area (names) "Return the arglist for the first function, macro, or special-op in NAMES." (handler-case @@ -1166,8 +1169,21 @@ ((member :not-available) nil) (list - (arglist-to-string (cons name arglist) - (symbol-package symbol)))))) + (let ((enriched-arglist + (if (extra-keywords symbol) + ;; When there are extra keywords, we decode the + ;; arglist, merge in the keywords and encode it + ;; again. + (let ((decoded-arglist (decode-arglist arglist))) + (enrich-decoded-arglist-with-extra-keywords + decoded-arglist (list symbol)) + (encode-arglist decoded-arglist)) + ;; Otherwise, just use the original arglist. + ;; This works better for implementation-specific + ;; lambda-list-keywords like CMUCL's &parse-body. + arglist))) + (arglist-to-string (cons name enriched-arglist) + (symbol-package symbol))))))) (defun clean-arglist (arglist) "Remove &whole, &enviroment, and &aux elements from ARGLIST." @@ -1199,7 +1215,8 @@ (string (princ arg)) (cons (pprint-logical-block (nil nil :prefix "(" :suffix ")") (princ (car arg)) - (write-char #\space) + (unless (null (cdr arg)) + (write-char #\space)) (pprint-fill *standard-output* (cdr arg) nil)))) (when (null arglist) (return)) (write-char #\space) @@ -1228,65 +1245,106 @@ (*print-length* 10) (*print-circle* t)) (format nil "~A => ~A" sym (symbol-value sym))))))) +(defstruct (keyword-arg + (:conc-name keyword-arg.) + (:constructor make-keyword-arg (keyword arg-name default-arg))) + keyword + arg-name + default-arg) + (defun decode-keyword-arg (arg) "Decode a keyword item of formal argument list. Return three values: keyword, argument name, default arg." (cond ((symbolp arg) - (values (intern (symbol-name arg) keyword-package) - arg - nil)) + (make-keyword-arg (intern (symbol-name arg) keyword-package) + arg + nil)) ((and (consp arg) (consp (car arg))) - (values (caar arg) - (cadar arg) - (cadr arg))) + (make-keyword-arg (caar arg) + (cadar arg) + (cadr arg))) ((consp arg) - (values (intern (symbol-name (car arg)) keyword-package) - (car arg) - (cadr arg))) + (make-keyword-arg (intern (symbol-name (car arg)) keyword-package) + (car arg) + (cadr arg))) (t (error "Bad keyword item of formal argument list")))) -(defmacro values-equal? (exp (&rest values)) - "Are the values produced by EXP equal to VALUES." - `(equal (multiple-value-list ,exp) (list , at values))) +(defun encode-keyword-arg (arg) + (if (eql (intern (symbol-name (keyword-arg.arg-name arg)) + keyword-package) + (keyword-arg.keyword arg)) + (if (keyword-arg.default-arg arg) + (list (keyword-arg.arg-name arg) + (keyword-arg.default-arg arg)) + (keyword-arg.arg-name arg)) + (let ((keyword/name (list (keyword-arg.arg-name arg) + (keyword-arg.keyword arg)))) + (if (keyword-arg.default-arg arg) + (list keyword/name + (keyword-arg.default-arg arg)) + (list keyword/name))))) (progn - (assert (values-equal? (decode-keyword-arg 'x) (:x 'x nil))) - (assert (values-equal? (decode-keyword-arg '(x t)) (:x 'x t))) - (assert (values-equal? (decode-keyword-arg '((:x y))) (:x 'y nil))) - (assert (values-equal? (decode-keyword-arg '((:x y) t)) (:x 'y t)))) + (assert (equalp (decode-keyword-arg 'x) + (make-keyword-arg :x 'x nil)) + (assert (equalp (decode-keyword-arg '(x t)) + (make-keyword-arg :x 'x t)))) + (assert (equalp (decode-keyword-arg '((:x y))) + (make-keyword-arg :x 'y nil))) + (assert (equalp (decode-keyword-arg '((:x y) t)) + (make-keyword-arg :x 'y t)))) + +(defstruct (optional-arg + (:conc-name optional-arg.) + (:constructor make-optional-arg (arg-name default-arg))) + arg-name + default-arg) (defun decode-optional-arg (arg) "Decode an optional item of a formal argument list. -Return two values: argument name, default arg." +Return an OPTIONAL-ARG structure." (etypecase arg - (symbol (values arg nil)) - (list (values (car arg) (cadr arg))))) + (symbol (make-optional-arg arg nil)) + (list (make-optional-arg (car arg) (cadr arg))))) + +(defun encode-optional-arg (optional-arg) + (if (optional-arg.default-arg optional-arg) + (list (optional-arg.arg-name optional-arg) + (optional-arg.default-arg optional-arg)) + (optional-arg.arg-name optional-arg))) (progn - (assert (values-equal? (decode-optional-arg 'x) ('x nil))) - (assert (values-equal? (decode-optional-arg '(x t)) ('x t)))) + (assert (equalp (decode-optional-arg 'x) + (make-optional-arg 'x nil))) + (assert (equalp (decode-optional-arg '(x t)) + (make-optional-arg 'x t)))) (defstruct (arglist (:conc-name arglist.)) required-args ; list of the required arguments optional-args ; list of the optional arguments + key-p ; whether &key appeared keyword-args ; list of the keywords rest ; name of the &rest or &body argument (if any) body-p ; whether the rest argument is a &body allow-other-keys-p) ; whether &allow-other-keys appeared (defun decode-arglist (arglist) + "Parse the list ARGLIST and return an ARGLIST structure." (let ((mode nil) (result (make-arglist))) (dolist (arg arglist) - (typecase arg - ((member &key &optional &rest &body &whole &aux) - (setq mode arg)) - ((member &allow-other-keys) - (setf (arglist.allow-other-keys-p result) t)) - (t - (case mode + (cond + ((eql arg '&allow-other-keys) + (setf (arglist.allow-other-keys-p result) t)) + ((eql arg '&key) + (setf (arglist.key-p result) t + mode arg)) + ((member arg lambda-list-keywords) + (setq mode arg)) + (t + (case mode (&key (push (decode-keyword-arg arg) (arglist.keyword-args result))) @@ -1299,7 +1357,9 @@ (&rest (setf (arglist.rest result) arg)) ((nil) - (push arg (arglist.required-args result))))))) + (push arg (arglist.required-args result))) + ((&whole &environment) + (setf mode nil)))))) (setf (arglist.required-args result) (nreverse (arglist.required-args result))) (setf (arglist.optional-args result) @@ -1308,6 +1368,23 @@ (nreverse (arglist.keyword-args result))) result)) +(defun encode-arglist (decoded-arglist) + (append (arglist.required-args decoded-arglist) + (when (arglist.optional-args decoded-arglist) + '(&optional)) + (mapcar #'encode-optional-arg (arglist.optional-args decoded-arglist)) + (when (arglist.key-p decoded-arglist) + '(&key)) + (mapcar #'encode-keyword-arg (arglist.keyword-args decoded-arglist)) + (when (arglist.allow-other-keys-p decoded-arglist) + '(&allow-other-keys)) + (cond ((not (arglist.rest decoded-arglist)) + '()) + ((arglist.body-p decoded-arglist) + `(&body ,(arglist.rest decoded-arglist))) + (t + `(&rest ,(arglist.rest decoded-arglist)))))) + (defun arglist-keywords (arglist) "Return the list of keywords in ARGLIST. As a secondary value, return whether &allow-other-keys appears." @@ -1324,7 +1401,8 @@ (multiple-value-bind (kw aok) (arglist-keywords (swank-mop:method-lambda-list method)) - (setq keywords (remove-duplicates (append keywords kw)) + (setq keywords (remove-duplicates (append keywords kw) + :key #'keyword-arg.keyword) allow-other-keys (or allow-other-keys aok)))) (values keywords allow-other-keys))) @@ -1368,10 +1446,14 @@ (princ arg)) (dolist (arg (arglist.optional-args decoded-arglist)) (space) - (format t "[~A]" arg)) - (dolist (keyword (arglist.keyword-args decoded-arglist)) + (format t "[~A]" (optional-arg.arg-name arg))) + (dolist (keyword-arg (arglist.keyword-args decoded-arglist)) (space) - (format t "~W ~A" keyword keyword)) + (let ((arg-name (keyword-arg.arg-name keyword-arg)) + (keyword (keyword-arg.keyword keyword-arg))) + (format t "~W ~A" + (if (keywordp keyword) keyword `',keyword) + arg-name))) (when (and (arglist.rest decoded-arglist) (or (not (arglist.keyword-args decoded-arglist)) (arglist.allow-other-keys-p decoded-arglist))) @@ -1382,8 +1464,9 @@ (pprint-newline :fill)) (defgeneric extra-keywords (operator &rest args) - (:documentation "Return a list of extra keywords of OPERATOR (a symbol) -when applied to the (unevaluated) ARGS.")) + (:documentation "Return a list of extra keywords of OPERATOR (a +symbol) when applied to the (unevaluated) ARGS. As a secondary value, +return whether other keys are allowed.")) (defmethod extra-keywords (operator &rest args) ;; default method @@ -1402,20 +1485,51 @@ (eq (car class-name-form) 'quote)) (let* ((class-name (cadr class-name-form)) (class (find-class class-name nil))) + (unless (swank-mop:class-finalized-p class) + ;; Try to finalize the class, which can fail if + ;; superclasses are not defined yet + (handler-case (swank-mop:finalize-inheritance class) + (program-error (c) + (declare (ignore c))))) (when class ;; We have the case (make-instance 'CLASS ...) ;; with a known CLASS. - (let ((slot-init-keywords - (loop for slot in (swank-mop:class-slots class) - append (swank-mop:slot-definition-initargs slot))) - (initialize-instance-keywords - (applicable-methods-keywords #'initialize-instance - (list class)))) - (return-from extra-keywords - (append slot-init-keywords - initialize-instance-keywords)))))))) + (multiple-value-bind (slots allow-other-keys-p) + (if (swank-mop:class-finalized-p class) + (values (swank-mop:class-slots class) nil) + (values (swank-mop:class-direct-slots class) t)) + (let ((slot-init-keywords + (loop for slot in slots append + (mapcar (lambda (initarg) + (make-keyword-arg + initarg + initarg ; FIXME + (swank-mop:slot-definition-initform slot))) + (swank-mop:slot-definition-initargs slot)))) + (initialize-instance-keywords + (applicable-methods-keywords #'initialize-instance + (list class)))) + (return-from extra-keywords + (values (append slot-init-keywords + initialize-instance-keywords) + allow-other-keys-p))))))))) (call-next-method)) +(defun enrich-decoded-arglist-with-extra-keywords (decoded-arglist form) + (multiple-value-bind (extra-keywords extra-aok) + (apply #'extra-keywords form) + ;; enrich the list of keywords with the extra keywords + (when extra-keywords + (setf (arglist.key-p decoded-arglist) t) + (setf (arglist.keyword-args decoded-arglist) + (remove-duplicates + (append (arglist.keyword-args decoded-arglist) + extra-keywords) + :key #'keyword-arg.keyword))) + (setf (arglist.allow-other-keys-p decoded-arglist) + (or (arglist.allow-other-keys-p decoded-arglist) extra-aok))) + decoded-arglist) + (defslimefun arglist-for-insertion (name) (with-buffer-syntax () (let ((symbol (parse-symbol name))) @@ -1427,18 +1541,18 @@ ((member :not-available) :not-available) (list - (let ((decoded-arglist (decode-arglist arglist)) - (extra-keywords (extra-keywords symbol))) - ;; enrich the list of keywords with the extra keywords - (setf (arglist.keyword-args decoded-arglist) - (remove-duplicates - (append (arglist.keyword-args decoded-arglist) - extra-keywords))) + (let ((decoded-arglist (decode-arglist arglist))) + (enrich-decoded-arglist-with-extra-keywords decoded-arglist + (list symbol)) (decoded-arglist-to-template-string decoded-arglist *buffer-package*)))))) (t :not-available))))) +(defvar *remove-keywords-alist* + '((:test :test-not) + (:test-not :test))) + (defun remove-actual-args (decoded-arglist actual-arglist) "Remove from DECODED-ARGLIST the arguments that have already been provided in ACTUAL-ARGLIST." @@ -1451,8 +1565,13 @@ do (progn (pop actual-arglist) (pop (arglist.optional-args decoded-arglist)))) (loop for keyword in actual-arglist by #'cddr + for keywords-to-remove = (cdr (assoc keyword *remove-keywords-alist*)) do (setf (arglist.keyword-args decoded-arglist) - (delete keyword (arglist.keyword-args decoded-arglist))))) + (remove-if (lambda (kw) + (or (eql kw keyword) + (member kw keywords-to-remove))) + (arglist.keyword-args decoded-arglist) + :key #'keyword-arg.keyword)))) (defslimefun complete-form (form-string) "Read FORM-STRING in the current buffer package, then complete it @@ -1470,13 +1589,8 @@ ((member :not-available) :not-available) (list - (let ((decoded-arglist (decode-arglist arglist)) - (extra-keywords (apply #'extra-keywords form))) - ;; enrich the list of keywords with the extra keywords - (setf (arglist.keyword-args decoded-arglist) - (remove-duplicates - (append (arglist.keyword-args decoded-arglist) - extra-keywords))) + (let ((decoded-arglist (decode-arglist arglist))) + (enrich-decoded-arglist-with-extra-keywords decoded-arglist form) ;; get rid of formal args already provided (remove-actual-args decoded-arglist argument-forms) (return-from complete-form From lgorrie at common-lisp.net Sun Mar 6 21:44:42 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 6 Mar 2005 22:44:42 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-backend.lisp Message-ID: <20050306214442.9C7318866E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6075 Modified Files: swank-backend.lisp Log Message: Export FINALIZE-INHERITANCE from SWANK-MOP. Date: Sun Mar 6 22:44:41 2005 Author: lgorrie Index: slime/swank-backend.lisp diff -u slime/swank-backend.lisp:1.81 slime/swank-backend.lisp:1.82 --- slime/swank-backend.lisp:1.81 Tue Mar 1 00:30:59 2005 +++ slime/swank-backend.lisp Sun Mar 6 22:44:41 2005 @@ -83,7 +83,8 @@ #:slot-definition-readers #:slot-definition-writers ;; generic function protocol - #:compute-applicable-methods-using-classes)) + #:compute-applicable-methods-using-classes + #:finalize-inheritance)) (in-package :swank-backend) From lgorrie at common-lisp.net Sun Mar 6 21:45:12 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 6 Mar 2005 22:45:12 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050306214512.050B08866E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6116 Modified Files: slime.el Log Message: Added slime-complete-form to the menu. Date: Sun Mar 6 22:45:06 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.463 slime/slime.el:1.464 --- slime/slime.el:1.463 Sat Mar 5 00:43:29 2005 +++ slime/slime.el Sun Mar 6 22:45:04 2005 @@ -690,6 +690,7 @@ [ "Return From Definition" slime-pop-find-definition-stack ,C ] [ "Complete Symbol" slime-complete-symbol ,C ] [ "Fuzzy Complete Symbol" slime-fuzzy-complete-symbol ,C ] + [ "Complete Form" slime-complete-form ,C ] [ "Show REPL" slime-switch-to-output-buffer ,C ] "--" ("Evaluation" From lgorrie at common-lisp.net Sun Mar 6 21:45:54 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 6 Mar 2005 22:45:54 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050306214554.71A8D8866E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6712 Modified Files: ChangeLog Log Message: Date: Sun Mar 6 22:45:52 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.622 slime/ChangeLog:1.623 --- slime/ChangeLog:1.622 Sun Mar 6 17:49:50 2005 +++ slime/ChangeLog Sun Mar 6 22:45:52 2005 @@ -1,3 +1,37 @@ +2005-03-06 Matthias Koeppe + + * slime.el (slime-easy-menu): Add menu item for + slime-complete-form. + + * swank.lisp (format-arglist-for-echo-area): Use extra-keywords to + enrich the list of keywords. + (arglist-to-string): Remove extraneous whitespace. + (keyword-arg, optional-arg): New structures. + (decode-keyword-arg, decode-optional-arg): Return structure + objects rather than multiple values. + (encode-keyword-arg, encode-optional-arg, encode-arglist): New + functions. + (arglist): New slot key-p. + (decode-arglist): Handle &whole, &environment. Store more + information on optional and keyword args, set arglist.key-p. + (values-equal?): Removed. + (print-decoded-arglist-as-template): If keyword is + not a keyword symbol, quote it in the template. + (extra-keywords): Return a secondary value (allow-other-keys). + For make-instance, try to finalize the class if it is not + finalized yet (fix for Allegro CL 6.2). If class is not + finalizable, use direct slots instead of slots and indicate that + the keywords are not complete. + (enrich-decoded-arglist-with-extra-keywords): New function, use + the secondary value of extra-keywords. + (arglist-for-insertion, complete-form): Use it here. + (remove-keywords-alist): New variable. + (remove-actual-args): When the keyword :test is provided, don't + suggest :test-not and vice versa. + + * swank-backend.lisp (:swank-mop package): Export + finalize-inheritance. + 2005-03-06 Luke Gorrie * swank.lisp: Export *LOG-OUTPUT*. From lgorrie at common-lisp.net Mon Mar 7 08:47:02 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Mon, 7 Mar 2005 09:47:02 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050307084702.74D278866C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv11924 Modified Files: swank.lisp Log Message: *** empty log message *** Date: Mon Mar 7 09:46:57 2005 Author: lgorrie Index: slime/swank.lisp diff -u slime/swank.lisp:1.284 slime/swank.lisp:1.285 --- slime/swank.lisp:1.284 Sun Mar 6 22:43:33 2005 +++ slime/swank.lisp Mon Mar 7 09:46:55 2005 @@ -1288,12 +1288,12 @@ (progn (assert (equalp (decode-keyword-arg 'x) - (make-keyword-arg :x 'x nil)) + (make-keyword-arg :x 'x nil))) (assert (equalp (decode-keyword-arg '(x t)) - (make-keyword-arg :x 'x t)))) - (assert (equalp (decode-keyword-arg '((:x y))) + (make-keyword-arg :x 'x t))) + (assert (equalp (decode-keyword-arg '((:x y))) (make-keyword-arg :x 'y nil))) - (assert (equalp (decode-keyword-arg '((:x y) t)) + (assert (equalp (decode-keyword-arg '((:x y) t)) (make-keyword-arg :x 'y t)))) (defstruct (optional-arg From lgorrie at common-lisp.net Mon Mar 7 08:47:22 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Mon, 7 Mar 2005 09:47:22 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050307084722.E829B8866C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv11952 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Mar 7 09:47:22 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.623 slime/ChangeLog:1.624 --- slime/ChangeLog:1.623 Sun Mar 6 22:45:52 2005 +++ slime/ChangeLog Mon Mar 7 09:47:21 2005 @@ -1,3 +1,7 @@ +2005-03-07 Edi Weitz + + * swank.lisp: Fixed parenthesis-balancing problem. + 2005-03-06 Matthias Koeppe * slime.el (slime-easy-menu): Add menu item for From pseibel at common-lisp.net Tue Mar 8 02:35:27 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Tue, 8 Mar 2005 03:35:27 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-loader.lisp slime/ChangeLog Message-ID: <20050308023527.02DED88663@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7491 Modified Files: swank-loader.lisp ChangeLog Log Message: Changing way swank-loader determines where to save fasls. Date: Tue Mar 8 03:35:21 2005 Author: pseibel Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.38 slime/swank-loader.lisp:1.39 --- slime/swank-loader.lisp:1.38 Wed Mar 2 00:23:49 2005 +++ slime/swank-loader.lisp Tue Mar 8 03:35:19 2005 @@ -33,17 +33,62 @@ #+armedbear '("swank-abcl") ))) -(defparameter *lisp-name* - #+cmu (format nil "cmu-~A" - (substitute #\- #\/ (lisp-implementation-version))) - #+sbcl (format nil "sbcl-~A" (lisp-implementation-version)) - #+openmcl "openmcl" - #+lispworks (format nil "lispworks-~A" (lisp-implementation-version)) - #+allegro (format nil "allegro-~A" excl::*common-lisp-version-number*) - #+clisp (format nil "clisp-~A" (let ((s (lisp-implementation-version))) - (subseq s 0 (position #\space s)))) - #+armedbear "abcl" - ) +(defparameter *implementation-features* + '(:allegro :sbcl :openmcl :cmu :ccl :corman :armedbear :gcl)) + +(defparameter *os-features* + '(:macosx :linux :windows :solaris :darwin :sunos :unix)) + +(defparameter *architecture-features* + '(:powerpc :ppc :x86 :i686 :sparc)) + +(defun unique-directory-name () + "Return a name that can be used as a directory name that is +unique to a Lisp implementation, Lisp implementation version, +operating system, and hardware architecture." + (flet ((first-of (features) + (loop for f in features + when (find f *features*) return it))) + (let ((lisp (first-of *implementation-features*)) + (os (first-of *os-features*)) + (architecture (first-of *architecture-features*)) + (version + (block nil + #+cmu + (return (substitute #\- #\/ (lisp-implementation-version))) + #+sbcl + (return (lisp-implementation-version)) + #+gcl + (let ((s (lisp-implementation-version))) (subseq s 4)) + #+openmcl + (return (format nil "~d.~d" + ccl::*openmcl-major-version* + ccl::*openmcl-minor-version*)) + #+lispworks + (return (lisp-implementation-version)) + #+allegro + (return excl::*common-lisp-version-number*) + #+clisp + (return (let ((s (lisp-implementation-version))) + (subseq s 0 (position #\space s)))) + #+armedbear + (return "unknown") + + (error "Don't know how to get Lisp implementation version.")))) + + (unless lisp + (warn "No implementation feature found in ~a." + *implementation-features*) + (setf lisp "unknown")) + (unless os + (warn "No os feature found in ~a." *os-features*) + (setf os "unknown")) + (unless architecture + (warn "No architecture feature found in ~a." + *architecture-features*) + (setf architecture "unknown")) + + (format nil "~(~@{~a~^-~}~)" lisp version os architecture)))) (defparameter *swank-pathname* (make-swank-pathname "swank")) @@ -55,7 +100,8 @@ "Return the pathname where SOURCE-PATHNAME's binary should be compiled." (let ((cfp (compile-file-pathname source-pathname))) (merge-pathnames (make-pathname - :directory `(:relative ".slime" "fasl" ,*lisp-name*) + :directory + `(:relative ".slime" "fasl" ,(unique-directory-name)) :name (pathname-name cfp) :type (pathname-type cfp)) (user-homedir-pathname)))) Index: slime/ChangeLog diff -u slime/ChangeLog:1.624 slime/ChangeLog:1.625 --- slime/ChangeLog:1.624 Mon Mar 7 09:47:21 2005 +++ slime/ChangeLog Tue Mar 8 03:35:19 2005 @@ -1,3 +1,9 @@ +2005-03-07 Peter Seibel + + * swank-loader.lisp (unique-directory-name): Replaced *lisp-name* + variable with more sophisticated version that accounts for impl, + impl version, os, and hardware architecture. + 2005-03-07 Edi Weitz * swank.lisp: Fixed parenthesis-balancing problem. From pseibel at common-lisp.net Wed Mar 9 03:56:49 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Wed, 9 Mar 2005 04:56:49 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-loader.lisp slime/ChangeLog Message-ID: <20050309035649.E077F88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv28221 Modified Files: swank-loader.lisp ChangeLog Log Message: Updating feature lists for FASL directory names computing code. Date: Wed Mar 9 04:56:48 2005 Author: pseibel Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.39 slime/swank-loader.lisp:1.40 --- slime/swank-loader.lisp:1.39 Tue Mar 8 03:35:19 2005 +++ slime/swank-loader.lisp Wed Mar 9 04:56:48 2005 @@ -34,13 +34,13 @@ ))) (defparameter *implementation-features* - '(:allegro :sbcl :openmcl :cmu :ccl :corman :armedbear :gcl)) + '(:allegro :sbcl :openmcl :cmu ::clisp :ccl :corman :armedbear :gcl)) (defparameter *os-features* '(:macosx :linux :windows :solaris :darwin :sunos :unix)) (defparameter *architecture-features* - '(:powerpc :ppc :x86 :i686 :sparc)) + '(:powerpc :ppc :x86 :x86-64 :i686 :sparc)) (defun unique-directory-name () "Return a name that can be used as a directory name that is Index: slime/ChangeLog diff -u slime/ChangeLog:1.625 slime/ChangeLog:1.626 --- slime/ChangeLog:1.625 Tue Mar 8 03:35:19 2005 +++ slime/ChangeLog Wed Mar 9 04:56:48 2005 @@ -1,3 +1,10 @@ +2005-03-08 Peter Seibel + + * swank-loader.lisp (*implementation-features*): Whoops. Forgot + CLISP. + (*architecture-features*): Added :x86-64 for SBCL on AMD64 (thanks + Vincent Arkesteijn) + 2005-03-07 Peter Seibel * swank-loader.lisp (unique-directory-name): Replaced *lisp-name* From pseibel at common-lisp.net Wed Mar 9 05:17:36 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Wed, 9 Mar 2005 06:17:36 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050309051736.8EC1E88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1239 Modified Files: ChangeLog Log Message: Tweaks to doc/Makefile Date: Wed Mar 9 06:17:35 2005 Author: pseibel Index: slime/ChangeLog diff -u slime/ChangeLog:1.626 slime/ChangeLog:1.627 --- slime/ChangeLog:1.626 Wed Mar 9 04:56:48 2005 +++ slime/ChangeLog Wed Mar 9 06:17:35 2005 @@ -1,5 +1,8 @@ 2005-03-08 Peter Seibel + * doc/Makefile (clean): added clean and really_clean targets. + (all): and added slime.pdf to all prerequisites. + * swank-loader.lisp (*implementation-features*): Whoops. Forgot CLISP. (*architecture-features*): Added :x86-64 for SBCL on AMD64 (thanks From pseibel at common-lisp.net Wed Mar 9 05:17:37 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Wed, 9 Mar 2005 06:17:37 +0100 (CET) Subject: [slime-cvs] CVS update: slime/doc/Makefile Message-ID: <20050309051737.81CE38866C@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory common-lisp.net:/tmp/cvs-serv1239/doc Modified Files: Makefile Log Message: Tweaks to doc/Makefile Date: Wed Mar 9 06:17:36 2005 Author: pseibel Index: slime/doc/Makefile diff -u slime/doc/Makefile:1.5 slime/doc/Makefile:1.6 --- slime/doc/Makefile:1.5 Wed Jun 30 16:10:29 2004 +++ slime/doc/Makefile Wed Mar 9 06:17:36 2005 @@ -12,7 +12,7 @@ # Info files generated here. infofiles=slime.info -all: slime.ps slime.info +all: slime.ps slime.info slime.pdf install: install-info @@ -24,10 +24,10 @@ slime.dvi: slime.texi contributors.texi texi2dvi slime.texi -slime.pdf: slime.texi +slime.pdf: slime.texi contributors.texi texi2pdf $< -slime.info: slime.texi +slime.info: slime.texi contributors.texi makeinfo $< # Create contributors.texi, a texinfo table listing all known @@ -75,3 +75,22 @@ echo "install-info --infodir=$(infodir) --remove $(infodir)/$(infofiles)";\ install-info --infodir="$(infodir)" --remove "$(infodir)/$(infofiles)" || :; fi rm -f $(infodir)/$(infofiles) + +clean: + rm -f contributors.texi + rm -f slime.aux + rm -f slime.cp + rm -f slime.dvi + rm -f slime.fn + rm -f slime.ky + rm -f slime.log + rm -f slime.pg + rm -f slime.tmp + rm -f slime.toc + rm -f slime.tp + rm -f slime.vr + +really_clean: clean + rm -f slime.info + rm -f slime.pdf + rm -f slime.ps From pseibel at common-lisp.net Wed Mar 9 16:18:49 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Wed, 9 Mar 2005 17:18:49 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/slime.el Message-ID: <20050309161849.7B57E88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5264 Modified Files: ChangeLog slime.el Log Message: Added symbolic lisp names. Date: Wed Mar 9 17:18:47 2005 Author: pseibel Index: slime/ChangeLog diff -u slime/ChangeLog:1.627 slime/ChangeLog:1.628 --- slime/ChangeLog:1.627 Wed Mar 9 06:17:35 2005 +++ slime/ChangeLog Wed Mar 9 17:18:44 2005 @@ -1,3 +1,10 @@ +2005-03-09 Peter Seibel + + * slime.el (slime-register-lisp-implementation): Add facility for + registering lisp implementations with symbolic names that can be + passed to C-u M-x slime. + + 2005-03-08 Peter Seibel * doc/Makefile (clean): added clean and really_clean targets. Index: slime/slime.el diff -u slime/slime.el:1.464 slime/slime.el:1.465 --- slime/slime.el:1.464 Sun Mar 6 22:45:04 2005 +++ slime/slime.el Wed Mar 9 17:18:45 2005 @@ -1183,7 +1183,10 @@ (if (eq 16 (prefix-numeric-value current-prefix-arg)) (read-coding-system "set slime-coding-system: " slime-net-coding-system)))) - (let ((command (or command inferior-lisp-program)) + (let ((symbolic-lisp-name + (if (slime-symbolic-lisp-name-p command) command nil)) + (command (or (slime-find-lisp-implementation command) + inferior-lisp-program)) (buffer (or buffer "*inferior-lisp*")) (coding-system (or coding-system slime-net-coding-system))) (slime-check-coding-system coding-system) @@ -1191,10 +1194,10 @@ (when (or (not (slime-bytecode-stale-p)) (slime-urge-bytecode-recompile)) (let ((proc (slime-maybe-start-lisp command buffer))) - (slime-inferior-connect proc nil) + (slime-inferior-connect proc nil symbolic-lisp-name) (pop-to-buffer (process-buffer proc)))))) -(defun slime-connect (host port &optional kill-old-p) +(defun slime-connect (host port &optional kill-old-p symbolic-lisp-name) "Connect to a running Swank server." (interactive (list (read-from-minibuffer "Host: " "127.0.0.1") (read-from-minibuffer "Port: " "4005" nil t) @@ -1206,7 +1209,7 @@ (message "Connecting to Swank on port %S.." port) (let* ((process (slime-net-connect host port)) (slime-dispatching-connection process)) - (slime-setup-connection process))) + (slime-setup-connection process symbolic-lisp-name))) (defun slime-start-and-load (filename &optional package) "Start Slime, if needed, load the current file and set the package." @@ -1349,12 +1352,12 @@ (lisp-mode-variables t) (get-buffer-process (current-buffer))))) -(defun slime-inferior-connect (process &optional retries) +(defun slime-inferior-connect (process &optional retries symbolic-lisp-name) "Start a Swank server in the inferior Lisp and connect." (when (file-regular-p (slime-swank-port-file)) (delete-file (slime-swank-port-file))) (slime-start-swank-server process) - (slime-read-port-and-connect process retries)) + (slime-read-port-and-connect process retries symbolic-lisp-name)) (defun slime-start-swank-server (process) "Start a Swank server on the inferior lisp." @@ -1372,10 +1375,11 @@ (t "/tmp/"))) (format "slime.%S" (emacs-pid)))) -(defun slime-read-port-and-connect (inferior-process retries) +(defun slime-read-port-and-connect (inferior-process retries &optional symbolic-lisp-name) (lexical-let ((process inferior-process) (retries retries) - (attempt 0)) + (attempt 0) + (lisp-name symbolic-lisp-name)) (labels ;; A small one-state machine to attempt a connection with ;; timer-based retries. @@ -1393,7 +1397,7 @@ (cond ((file-exists-p (slime-swank-port-file)) (let ((port (slime-read-swank-port))) (delete-file (slime-swank-port-file)) - (let ((c (slime-connect "127.0.0.1" port))) + (let ((c (slime-connect "127.0.0.1" port nil lisp-name))) (slime-set-inferior-process c process)))) ((and retries (zerop retries)) (message "Failed to connect to Swank.")) @@ -1813,6 +1817,9 @@ (slime-def-connection-var slime-connection-name nil "The short name for connection.") +(slime-def-connection-var slime-symbolic-lisp-name nil + "The symbolic name passed to slime when starting connection.") + (slime-def-connection-var slime-inferior-process nil "The inferior process for the connection if any.") @@ -1825,14 +1832,14 @@ "The number of SLIME connections made. For generating serial numbers.") ;;; Interface -(defun slime-setup-connection (process) +(defun slime-setup-connection (process symbolic-lisp-name) "Make a connection out of PROCESS." (let ((slime-dispatching-connection process)) - (slime-init-connection-state process) + (slime-init-connection-state process symbolic-lisp-name) (slime-select-connection process) process)) -(defun slime-init-connection-state (proc) +(defun slime-init-connection-state (proc symbolic-lisp-name) "Initialize connection state in the process-buffer of PROC." ;; To make life simpler for the user: if this is the only open ;; connection then reset the connection counter. @@ -1841,6 +1848,8 @@ (slime-with-connection-buffer () (setq slime-buffer-connection proc)) (setf (slime-connection-number proc) (incf slime-connection-counter)) + (setf (slime-symbolic-lisp-name proc) + (slime-generate-symbolic-lisp-name symbolic-lisp-name)) ;; We do our initialization asynchronously. The current function may ;; be called from a timer, and if we setup the REPL from a timer ;; then it mysteriously uses the wrong keymap for the first command. @@ -1870,6 +1879,14 @@ :key #'slime-connection-name :test #'equal) finally (return name))) +(defun slime-generate-symbolic-lisp-name (lisp-name) + (loop for i from 1 + for name = lisp-name then (format "%s<%d>" lisp-name i) + while (find name slime-net-processes + :key #'slime-symbolic-lisp-name :test #'equal) + finally (return name))) + + (defun slime-connection-close-hook (process) (when (eq process slime-default-connection) (when slime-net-processes @@ -2557,7 +2574,9 @@ (defun slime-repl-buffer (&optional create connection) "Get the REPL buffer for the current connection; optionally create." (funcall (if create #'get-buffer-create #'get-buffer) - (format "*slime-repl %s*" (slime-connection-name connection)))) + (format "*slime-repl %s*" + (or (slime-symbolic-lisp-name connection) + (slime-connection-name connection))))) (defun slime-repl-mode () "Major mode for interacting with a superior Lisp. @@ -6975,6 +6994,34 @@ ;;;;; Connection listing + +(defvar slime-registered-lisp-implementations ()) + +(defun slime-register-lisp-implementation (name command) + (interactive "sName: \nfCommand: ") + (let ((cons (assoc name slime-registered-lisp-implementations))) + (if cons + (setf (cdr cons) command) + (push (cons name command) slime-registered-lisp-implementations))) + (if (string= inferior-lisp-program "lisp") + (slime-select-lisp-implementation name))) + +(defun slime-select-lisp-implementation (name) + (interactive "sName: ") + (setq inferior-lisp-program + (cdr (assoc name slime-registered-lisp-implementations)))) + +(defun slime-find-lisp-implementation (name) + (let ((cons (or (assoc name slime-registered-lisp-implementations) + (rassoc name slime-registered-lisp-implementations)))) + (if cons (cdr cons) name))) + +(defun slime-find-lisp-implementation-name (command) + (cdr (rassoc command slime-registered-lisp-implementations))) + +(defun slime-symbolic-lisp-name-p (name) + (assoc name slime-registered-lisp-implementations)) + (define-derived-mode slime-connection-list-mode fundamental-mode "connection-list" From pseibel at common-lisp.net Wed Mar 9 17:57:48 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Wed, 9 Mar 2005 18:57:48 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050309175748.B759F88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv10578 Modified Files: slime.el Log Message: Tweaks to new symbolic lisp names. Date: Wed Mar 9 18:57:46 2005 Author: pseibel Index: slime/slime.el diff -u slime/slime.el:1.465 slime/slime.el:1.466 --- slime/slime.el:1.465 Wed Mar 9 17:18:45 2005 +++ slime/slime.el Wed Mar 9 18:57:44 2005 @@ -1183,19 +1183,18 @@ (if (eq 16 (prefix-numeric-value current-prefix-arg)) (read-coding-system "set slime-coding-system: " slime-net-coding-system)))) - (let ((symbolic-lisp-name - (if (slime-symbolic-lisp-name-p command) command nil)) - (command (or (slime-find-lisp-implementation command) + (let ((command (or (slime-find-lisp-implementation command) inferior-lisp-program)) (buffer (or buffer "*inferior-lisp*")) (coding-system (or coding-system slime-net-coding-system))) - (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 command buffer))) - (slime-inferior-connect proc nil symbolic-lisp-name) - (pop-to-buffer (process-buffer proc)))))) + (let ((symbolic-lisp-name (slime-symbolic-lisp-name-p command))) + (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 command buffer))) + (slime-inferior-connect proc nil symbolic-lisp-name) + (pop-to-buffer (process-buffer proc))))))) (defun slime-connect (host port &optional kill-old-p symbolic-lisp-name) "Connect to a running Swank server." @@ -1880,11 +1879,12 @@ finally (return name))) (defun slime-generate-symbolic-lisp-name (lisp-name) - (loop for i from 1 - for name = lisp-name then (format "%s<%d>" lisp-name i) - while (find name slime-net-processes - :key #'slime-symbolic-lisp-name :test #'equal) - finally (return name))) + (if lisp-name + (loop for i from 1 + for name = lisp-name then (format "%s<%d>" lisp-name i) + while (find name slime-net-processes + :key #'slime-symbolic-lisp-name :test #'equal) + finally (return name)))) (defun slime-connection-close-hook (process) @@ -7020,7 +7020,9 @@ (cdr (rassoc command slime-registered-lisp-implementations))) (defun slime-symbolic-lisp-name-p (name) - (assoc name slime-registered-lisp-implementations)) + (let ((cons (or (assoc name slime-registered-lisp-implementations) + (rassoc name slime-registered-lisp-implementations)))) + (if cons (car cons)))) (define-derived-mode slime-connection-list-mode fundamental-mode From pseibel at common-lisp.net Wed Mar 9 21:34:29 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Wed, 9 Mar 2005 22:34:29 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/swank-loader.lisp Message-ID: <20050309213429.6DE6188665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22880 Modified Files: ChangeLog swank-loader.lisp Log Message: Adding missing features for unique-directory-name. Date: Wed Mar 9 22:34:28 2005 Author: pseibel Index: slime/ChangeLog diff -u slime/ChangeLog:1.628 slime/ChangeLog:1.629 --- slime/ChangeLog:1.628 Wed Mar 9 17:18:44 2005 +++ slime/ChangeLog Wed Mar 9 22:34:28 2005 @@ -1,9 +1,10 @@ 2005-03-09 Peter Seibel + * swank-loader.lisp (*architecture-features*): Added :pc386 for CLISP. + * slime.el (slime-register-lisp-implementation): Add facility for registering lisp implementations with symbolic names that can be passed to C-u M-x slime. - 2005-03-08 Peter Seibel Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.40 slime/swank-loader.lisp:1.41 --- slime/swank-loader.lisp:1.40 Wed Mar 9 04:56:48 2005 +++ slime/swank-loader.lisp Wed Mar 9 22:34:28 2005 @@ -34,13 +34,13 @@ ))) (defparameter *implementation-features* - '(:allegro :sbcl :openmcl :cmu ::clisp :ccl :corman :armedbear :gcl)) + '(:allegro :sbcl :openmcl :cmu :clisp :ccl :corman :armedbear :gcl)) (defparameter *os-features* '(:macosx :linux :windows :solaris :darwin :sunos :unix)) (defparameter *architecture-features* - '(:powerpc :ppc :x86 :x86-64 :i686 :sparc)) + '(:powerpc :ppc :x86 :x86-64 :i686 :pc386 :sparc)) (defun unique-directory-name () "Return a name that can be used as a directory name that is From pseibel at common-lisp.net Thu Mar 10 01:02:10 2005 From: pseibel at common-lisp.net (Peter Seibel) Date: Thu, 10 Mar 2005 02:02:10 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/swank-loader.lisp Message-ID: <20050310010210.9CA8288665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1950 Modified Files: ChangeLog swank-loader.lisp Log Message: Changing ERROR to WARN in unique-directory-name. Date: Thu Mar 10 02:02:03 2005 Author: pseibel Index: slime/ChangeLog diff -u slime/ChangeLog:1.629 slime/ChangeLog:1.630 --- slime/ChangeLog:1.629 Wed Mar 9 22:34:28 2005 +++ slime/ChangeLog Thu Mar 10 02:01:58 2005 @@ -1,6 +1,7 @@ 2005-03-09 Peter Seibel * swank-loader.lisp (*architecture-features*): Added :pc386 for CLISP. + (unique-directory-name): Change ERROR to WARN. * slime.el (slime-register-lisp-implementation): Add facility for registering lisp implementations with symbolic names that can be Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.41 slime/swank-loader.lisp:1.42 --- slime/swank-loader.lisp:1.41 Wed Mar 9 22:34:28 2005 +++ slime/swank-loader.lisp Thu Mar 10 02:02:00 2005 @@ -74,7 +74,8 @@ #+armedbear (return "unknown") - (error "Don't know how to get Lisp implementation version.")))) + (warn "Don't know how to get Lisp implementation version.") + (return "unknown")))) (unless lisp (warn "No implementation feature found in ~a." From lgorrie at common-lisp.net Thu Mar 10 18:44:01 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 10 Mar 2005 19:44:01 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050310184401.4611588663@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv28348 Modified Files: slime.el Log Message: (slime-toggle-trace-fdefinition): If there is no symbol at point then prompt for one. Date: Thu Mar 10 19:43:59 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.466 slime/slime.el:1.467 --- slime/slime.el:1.466 Wed Mar 9 18:57:44 2005 +++ slime/slime.el Thu Mar 10 19:43:58 2005 @@ -5394,16 +5394,15 @@ (let ((spec (if using-context-p (slime-extract-context) (slime-symbol-at-point)))) - (cond ((not spec) - (error "No symbol to trace")) - (t - (let ((spec (slime-trace-query spec))) - (message "%s" (slime-eval `(swank:swank-toggle-trace ,spec)))))))) + (let ((spec (slime-trace-query spec))) + (message "%s" (slime-eval `(swank:swank-toggle-trace ,spec)))))) (defun slime-trace-query (spec) "Ask the user which function to trace; SPEC is the default. The result is a string." - (cond ((symbolp spec) + (cond ((null spec) + (slime-read-from-minibuffer "(Un)trace: ")) + ((symbolp spec) (slime-read-from-minibuffer "(Un)trace: " (symbol-name spec))) (t (destructure-case spec From lgorrie at common-lisp.net Thu Mar 10 18:49:11 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 10 Mar 2005 19:49:11 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050310184911.85D1488663@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv29179 Modified Files: ChangeLog Log Message: Date: Thu Mar 10 19:49:10 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.630 slime/ChangeLog:1.631 --- slime/ChangeLog:1.630 Thu Mar 10 02:01:58 2005 +++ slime/ChangeLog Thu Mar 10 19:49:10 2005 @@ -1,3 +1,8 @@ +2005-03-10 Antonio Menezes Leitao + + * slime.el (slime-toggle-trace-fdefinition): If there is no symbol + at point then prompt for one. + 2005-03-09 Peter Seibel * swank-loader.lisp (*architecture-features*): Added :pc386 for CLISP. From lgorrie at common-lisp.net Sat Mar 12 01:48:49 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 02:48:49 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-backend.lisp Message-ID: <20050312014849.4134888665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv4903 Modified Files: swank-backend.lisp Log Message: Doc fix. Date: Sat Mar 12 02:48:47 2005 Author: lgorrie Index: slime/swank-backend.lisp diff -u slime/swank-backend.lisp:1.82 slime/swank-backend.lisp:1.83 --- slime/swank-backend.lisp:1.82 Sun Mar 6 22:44:41 2005 +++ slime/swank-backend.lisp Sat Mar 12 02:48:47 2005 @@ -673,7 +673,7 @@ the inspector buffer and a list specifying how to render the object for inspection. -Every elementi of the list must be either a string, which will be +Every element of the list must be either a string, which will be inserted into the buffer as is, or a list of the form: (:value object &optional format) - Render an inspectable From lgorrie at common-lisp.net Sat Mar 12 01:49:20 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 02:49:20 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-cmucl.lisp Message-ID: <20050312014920.D533A88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv4938 Modified Files: swank-cmucl.lisp Log Message: Source file cache is now moved into swank-source-file-cache.lisp Date: Sat Mar 12 02:49:20 2005 Author: lgorrie Index: slime/swank-cmucl.lisp diff -u slime/swank-cmucl.lisp:1.140 slime/swank-cmucl.lisp:1.141 --- slime/swank-cmucl.lisp:1.140 Tue Mar 1 00:32:06 2005 +++ slime/swank-cmucl.lisp Sat Mar 12 02:49:19 2005 @@ -695,8 +695,7 @@ (defun location-in-file (filename code-location debug-source) "Resolve the source location for CODE-LOCATION in FILENAME." (let* ((code-date (di:debug-source-created debug-source)) - (source-code (or (source-cache-get filename code-date) - (read-file filename)))) + (source-code (get-source-code filename code-date))) (make-location (list :file (unix-truename filename)) nil) (with-input-from-string (s source-code) (make-location (list :file (unix-truename filename)) @@ -722,23 +721,6 @@ (file-position s position) (read-snippet s)))))) -(defun read-file (filename) - "Return the entire contents of FILENAME as a string." - (with-open-file (s filename :direction :input) - (let ((string (make-string (file-length s)))) - (read-sequence string s) - string))) - -(defun read-snippet (stream) - "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM." - (read-upto-n-chars stream *source-snippet-size*)) - -(defun read-upto-n-chars (stream n) - "Return a string of upto N chars from STREAM." - (let* ((string (make-string n)) - (chars (read-sequence string stream))) - (subseq string 0 chars))) - ;;;;; Function-name locations ;;; (defun debug-info-function-name-location (debug-info) @@ -802,69 +784,6 @@ See CODE-LOCATION-STREAM-POSITION." (with-input-from-string (s string) (code-location-stream-position code-location s))) - -;;;;; Source-file cache -;;; -;;; To robustly find source locations it's useful to have the exact -;;; source code that the loaded code was compiled from. In this source -;;; we can accurately find the right location, and from that location -;;; we can extract a "snippet" of code to show what the definition -;;; looks like. Emacs can use this snippet in a best-match search to -;;; locate the right definition, which works well even if the buffer -;;; has been modified. -;;; -;;; The idea is that if a definition previously started with -;;; `(define-foo bar' then it probably still does. -;;; -;;; Whenever we see that the file on disk has the same -;;; `file-write-date' as a location we're looking for, we cache the -;;; whole file inside Lisp. That way we will still have the matching -;;; version even if the file is later modified on disk. If the file is -;;; later recompiled and reloaded then we replace our cache entry. - -(defvar *cache-sourcecode* t - "When true complete source files are cached. -The cache is used to keep known good copies of the source text which -correspond to the loaded code. Finding definitions is much more -reliable when the exact source is available, so we cache it in case it -gets edited on disk later.") - -(defvar *source-file-cache* (make-hash-table :test 'equal) - "Cache of source file contents. -Maps from truename to source-cache-entry structure.") - -(defstruct (source-cache-entry - (:conc-name source-cache-entry.) - (:constructor make-source-cache-entry (text date))) - text date) - -(defun source-cache-get (filename date) - "Return the source code for FILENAME as written on DATE in a string. -Return NIL if the right version cannot be found." - (let ((entry (gethash filename *source-file-cache*))) - (cond ((and entry (equal date (source-cache-entry.date entry))) - ;; Cache hit. - (source-cache-entry.text entry)) - ((or (null entry) - (not (equal date (source-cache-entry.date entry)))) - ;; Cache miss. - (if (equal (file-write-date filename) date) - ;; File on disk has the correct version. - (let ((source (read-file filename))) - (setf (gethash filename *source-file-cache*) - (make-source-cache-entry source date)) - source) - nil))))) - -(defun source-cached-p (filename) - "Is any version of FILENAME in the source cache?" - (if (gethash filename *source-file-cache*) t)) - -(defimplementation buffer-first-change (filename) - "Load a file into the cache when the user modifies its buffer. -This is a win if the user then saves the file and tries to M-. into it." - (unless (source-cached-p filename) - (ignore-errors (source-cache-get filename (file-write-date filename))))) ;;;; Finding definitions From lgorrie at common-lisp.net Sat Mar 12 01:49:50 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 02:49:50 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-loader.lisp Message-ID: <20050312014950.83DAD88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv4962 Modified Files: swank-loader.lisp Log Message: Updated for swank-source-file-cache.lisp (CMUCL & SBCL) Date: Sat Mar 12 02:49:49 2005 Author: lgorrie Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.42 slime/swank-loader.lisp:1.43 --- slime/swank-loader.lisp:1.42 Thu Mar 10 02:02:00 2005 +++ slime/swank-loader.lisp Sat Mar 12 02:49:48 2005 @@ -24,8 +24,8 @@ (mapcar #'make-swank-pathname (append '("nregex") - #+cmu '("swank-source-path-parser" "swank-cmucl") - #+sbcl '("swank-sbcl" "swank-source-path-parser" "swank-gray") + #+cmu '("swank-source-path-parser" "swank-source-file-cache" "swank-cmucl") + #+sbcl '("swank-sbcl" "swank-source-path-parser" "swank-source-file-cache" "swank-gray") #+openmcl '("metering" "swank-openmcl" "swank-gray") #+lispworks '("swank-lispworks" "swank-gray") #+allegro '("swank-allegro" "swank-gray") From lgorrie at common-lisp.net Sat Mar 12 01:50:19 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 02:50:19 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050312015019.B668488665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv4985 Modified Files: swank-sbcl.lisp Log Message: Use swank-source-file-cache to find snippets of definitions. M-. is now much more robust to modifications in the source file. NOTE: To be effective requires a patch to sb-introspect that I have posted to sbcl-devel. Date: Sat Mar 12 02:50:17 2005 Author: lgorrie Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.121 slime/swank-sbcl.lisp:1.122 --- slime/swank-sbcl.lisp:1.121 Thu Mar 3 01:11:58 2005 +++ slime/swank-sbcl.lisp Sat Mar 12 02:50:15 2005 @@ -293,8 +293,11 @@ (handler-case (let ((output-file (with-compilation-hooks () (compile-file filename)))) - (when (and load-p output-file) - (load output-file))) + (when output-file + ;; Cache the latest source file for definition-finding. + (source-cache-get filename (file-write-date filename)) + (when load-p + (load output-file)))) (sb-c:fatal-compiler-error () nil))) (defimplementation swank-compile-string (string &key buffer position directory) @@ -317,6 +320,37 @@ "When true don't handle errors while looking for definitions. This is useful when debugging the definition-finding code.") +(defimplementation find-definitions (name) + (append (function-definitions name) + (compiler-definitions name))) + +;;;;; Function definitions + +(defun function-definitions (name) + (flet ((loc (fn name) (safe-function-source-location fn name))) + (append + (cond ((and (symbolp name) (macro-function name)) + (list (list `(defmacro ,name) + (loc (macro-function name) name)))) + ((fboundp name) + (let ((fn (fdefinition name))) + (typecase fn + (generic-function + (cons (list `(defgeneric ,name) (loc fn name)) + (method-definitions fn))) + (t + (list (list `(function ,name) (loc fn name)))))))) + (when (compiler-macro-function name) + (list (list `(define-compiler-macro ,name) + (loc (compiler-macro-function name) name))))))) + +(defun safe-function-source-location (fun name) + (if *debug-definition-finding* + (function-source-location fun name) + (handler-case (function-source-location fun name) + (error (e) + (list (list :error (format nil "Error: ~A" e))))))) + ;;; FIXME we don't handle the compiled-interactively case yet. That ;;; should have NIL :filename & :position, and non-NIL :source-form (defun function-source-location (function &optional name) @@ -324,7 +358,12 @@ (let* ((def (sb-introspect:find-definition-source function)) (pathname (sb-introspect:definition-source-pathname def)) (path (sb-introspect:definition-source-form-path def)) - (position (sb-introspect:definition-source-character-offset def))) + (position (sb-introspect:definition-source-character-offset def)) + (stamp + ;; FIXME: Symbol doesn't exist in released SBCL yet. + (let ((sym (find-symbol "DEFINITION-SOURCE-CREATED" + (find-package "SB-INTROSPECT")))) + (when sym (funcall sym def))))) (unless pathname (return-from function-source-location (list :error (format nil "No filename for: ~S" function)))) @@ -341,14 +380,12 @@ (cond (path (list :source-path path position)) (t (list :function-name (or (and name (string name)) - (string (sb-kernel:%fun-name function)))))))))) - -(defun safe-function-source-location (fun name) - (if *debug-definition-finding* - (function-source-location fun name) - (handler-case (function-source-location fun name) - (error (e) - (list (list :error (format nil "Error: ~A" e))))))) + (string (sb-kernel:%fun-name function)))))) + (let ((source (get-source-code pathname stamp))) + (if source + (with-input-from-string (stream source) + (file-position stream position) + (list :snippet (read-snippet stream))))))))) (defun method-definitions (gf) (let ((methods (sb-mop:generic-function-methods gf)) @@ -357,23 +394,13 @@ collect (list `(method ,name ,(sb-pcl::unparse-specializers method)) (safe-function-source-location method name))))) -(defun function-definitions (name) - (flet ((loc (fn name) (safe-function-source-location fn name))) - (append - (cond ((and (symbolp name) (macro-function name)) - (list (list `(defmacro ,name) - (loc (macro-function name) name)))) - ((fboundp name) - (let ((fn (fdefinition name))) - (typecase fn - (generic-function - (cons (list `(defgeneric ,name) (loc fn name)) - (method-definitions fn))) - (t - (list (list `(function ,name) (loc fn name)))))))) - (when (compiler-macro-function name) - (list (list `(define-compiler-macro ,name) - (loc (compiler-macro-function name) name))))))) +;;;;; Compiler definitions + +(defun compiler-definitions (name) + (let ((fun-info (sb-int:info :function :info name))) + (when fun-info + (append (transform-definitions fun-info name) + (optimizer-definitions fun-info name))))) (defun transform-definitions (fun-info name) (loop for xform in (sb-c::fun-info-transforms fun-info) @@ -396,16 +423,6 @@ when fn collect `((sb-c:defoptimizer ,name) ,(safe-function-source-location fn fun-name))))) -(defun compiler-definitions (name) - (let ((fun-info (sb-int:info :function :info name))) - (when fun-info - (append (transform-definitions fun-info name) - (optimizer-definitions fun-info name))))) - -(defimplementation find-definitions (name) - (append (function-definitions name) - (compiler-definitions name))) - (defimplementation describe-symbol-for-emacs (symbol) "Return a plist describing SYMBOL. Return NIL if the symbol is unbound." @@ -447,12 +464,6 @@ (:type (describe (sb-kernel:values-specifier-type symbol))))) -(defun function-dspec (fn) - "Describe where the function FN was defined. -Return a list of the form (NAME LOCATION)." - (let ((name (sb-kernel:%fun-name fn))) - (list name (safe-function-source-location fn name)))) - (defimplementation list-callers (symbol) (let ((fn (fdefinition symbol))) (mapcar #'function-dspec (sb-introspect:find-function-callers fn)))) @@ -461,6 +472,12 @@ (let ((fn (fdefinition symbol))) (mapcar #'function-dspec (sb-introspect:find-function-callees fn)))) +(defun function-dspec (fn) + "Describe where the function FN was defined. +Return a list of the form (NAME LOCATION)." + (let ((name (sb-kernel:%fun-name fn))) + (list name (safe-function-source-location fn name)))) + ;;; macroexpansion (defimplementation macroexpand-all (form) @@ -573,7 +590,8 @@ (defun source-location-for-emacs (code-location) (let* ((debug-source (sb-di:code-location-debug-source code-location)) (from (sb-di:debug-source-from debug-source)) - (name (sb-di:debug-source-name debug-source))) + (name (sb-di:debug-source-name debug-source)) + (created (sb-di:debug-source-created debug-source))) (ecase from (:file (let ((source-path (ignore-errors @@ -583,7 +601,12 @@ (let ((position (code-location-file-position code-location))) (make-location (list :file (namestring (truename name))) - (list :source-path source-path position)))) + (list :source-path source-path position) + (let ((source (get-source-code name created))) + (if source + (with-input-from-string (stream source) + (file-position stream position) + (list :snippet (read-snippet stream)))))))) (t (let* ((dfn (sb-di:code-location-debug-fun code-location)) (fn (sb-di:debug-fun-fun dfn))) From lgorrie at common-lisp.net Sat Mar 12 01:50:47 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 02:50:47 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-source-file-cache.lisp Message-ID: <20050312015047.543F288665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5001 Added Files: swank-source-file-cache.lisp Log Message: Source file cache management factored out of swank-cmucl.lisp Date: Sat Mar 12 02:50:46 2005 Author: lgorrie From lgorrie at common-lisp.net Sat Mar 12 01:50:59 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 02:50:59 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050312015059.4171B88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5016 Modified Files: ChangeLog Log Message: Date: Sat Mar 12 02:50:58 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.631 slime/ChangeLog:1.632 --- slime/ChangeLog:1.631 Thu Mar 10 19:49:10 2005 +++ slime/ChangeLog Sat Mar 12 02:50:58 2005 @@ -1,3 +1,16 @@ +2005-03-12 Luke Gorrie + + * swank-sbcl.lisp: Use swank-source-file-cache to find snippets of + definitions. M-. is now much more robust to modifications in the + source file. + NOTE: To be effective requires a patch to sb-introspect that I + have posted to sbcl-devel. + + * swank-source-file-cache.lisp: Factored this into its own file, + from swank-cmucl.lisp. + + * swank-loader.lisp, swank-cmucl.lisp: Updated for the above. + 2005-03-10 Antonio Menezes Leitao * slime.el (slime-toggle-trace-fdefinition): If there is no symbol From lgorrie at common-lisp.net Sat Mar 12 02:44:33 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 03:44:33 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-allegro.lisp Message-ID: <20050312024433.883D188665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7537 Modified Files: swank-allegro.lisp Log Message: (toggle-trace): Fix from Antonio Menezes Leitao. Date: Sat Mar 12 03:44:28 2005 Author: lgorrie Index: slime/swank-allegro.lisp diff -u slime/swank-allegro.lisp:1.71 slime/swank-allegro.lisp:1.72 --- slime/swank-allegro.lisp:1.71 Sat Mar 5 00:44:17 2005 +++ slime/swank-allegro.lisp Sat Mar 12 03:44:27 2005 @@ -690,11 +690,13 @@ ;; can be a normal name or a (setf name) (defimplementation toggle-trace (spec) - (ecase (car spec) + (ecase (car spec) + ((setf) + (toggle-trace-aux spec)) (:defgeneric (toggle-trace-generic-function-methods (second spec))) ((setf :defmethod :labels :flet) (toggle-trace-aux (process-fspec-for-allegro spec))) - (:call + (:call (destructuring-bind (caller callee) (cdr spec) (toggle-trace-aux callee :inside (list (process-fspec-for-allegro caller))))))) @@ -718,7 +720,7 @@ (dolist (method methods (format nil "~S is now untraced." name)) (excl:funtrace (mop:method-function method)))) (t - (eval `(trace ,name)) + (eval `(trace (,name))) (dolist (method methods (format nil "~S is now traced." name)) (excl:ftrace (mop:method-function method))))))) From lgorrie at common-lisp.net Sat Mar 12 02:46:45 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 03:46:45 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050312024645.BF47388665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7796 Modified Files: slime.el Log Message: Fix from Antonio Menezes Leitao. Date: Sat Mar 12 03:46:40 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.467 slime/slime.el:1.468 --- slime/slime.el:1.467 Thu Mar 10 19:43:58 2005 +++ slime/slime.el Sat Mar 12 03:46:38 2005 @@ -5412,12 +5412,12 @@ (slime-read-from-minibuffer "(Un)trace: " (prin1-to-string n))) ((:defgeneric n) (let* ((name (prin1-to-string n)) - (answer (slime-read-from-minibuffer "(Un)trace: " n))) + (answer (slime-read-from-minibuffer "(Un)trace: " name))) (cond ((and (string= name answer) (y-or-n-p (concat "(Un)trace also all " "methods implementing " name "? "))) - (prin1-to-string `(:defgeneric ,name))) + (prin1-to-string `(:defgeneric ,n))) (t answer)))) ((:defmethod &rest _) @@ -5480,7 +5480,7 @@ (slime-in-expression-p `(,name))) ;; looks like a regular call (let ((toplevel (ignore-errors (slime-parse-toplevel-form)))) - (cond ((slime-in-expression-p `(setf *)) ;a setf-call + (cond ((slime-in-expression-p `(setf (*))) ;a setf-call (if toplevel `(:call ,toplevel (setf ,name)) `(setf ,name))) From lgorrie at common-lisp.net Sat Mar 12 02:48:08 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 03:48:08 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050312024808.C6F2A88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv7996 Modified Files: ChangeLog Log Message: Date: Sat Mar 12 03:48:06 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.632 slime/ChangeLog:1.633 --- slime/ChangeLog:1.632 Sat Mar 12 02:50:58 2005 +++ slime/ChangeLog Sat Mar 12 03:48:03 2005 @@ -1,5 +1,8 @@ 2005-03-12 Luke Gorrie + * swank-allegro.lisp (toggle-trace): Fix from Antonio Menezes + Leitao. + * swank-sbcl.lisp: Use swank-source-file-cache to find snippets of definitions. M-. is now much more robust to modifications in the source file. From lgorrie at common-lisp.net Sat Mar 12 16:01:29 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 17:01:29 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050312160129.6D401884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv19993 Modified Files: slime.el Log Message: (slime-edit-value): New function on `C-c E'. Prompts for a Lisp expression, evaluates and displays the result in a new buffer for editing, and then setf's the edited value in Lisp after you press C-c C-c. Usage example: `C-c E asdf:*central-registry*' Minor docstring and pull-down-menu changes. Date: Sat Mar 12 17:01:27 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.468 slime/slime.el:1.469 --- slime/slime.el:1.468 Sat Mar 12 03:46:38 2005 +++ slime/slime.el Sat Mar 12 17:01:24 2005 @@ -389,7 +389,7 @@ ;;;;; slime-mode (define-minor-mode slime-mode - "\\ + "\\\ SLIME: The Superior Lisp Interaction Mode for Emacs (minor-mode). Commands to compile the current buffer's source file and visually @@ -453,7 +453,7 @@ ;;;;; inferior-slime-mode (define-minor-mode inferior-slime-mode - "\\ + "\\\ Inferior SLIME mode: The Inferior Superior Lisp Mode for Emacs. This mode is intended for use with `inferior-lisp-mode'. It provides a @@ -565,6 +565,7 @@ ("\C-\M-x" slime-eval-defun) (":" slime-interactive-eval :prefixed t :sldb t) ("\C-e" slime-interactive-eval :prefixed t :sldb t :inferior t) + ("E" slime-edit-value :prefixed t :sldb t :inferior t) ("\C-z" slime-switch-to-output-buffer :prefixed t :sldb t) ("\C-b" slime-interrupt :prefixed t :inferior t :sldb t) ("\M-g" slime-quit :prefixed t :inferior t :sldb t) @@ -698,8 +699,9 @@ [ "Eval Last Expression" slime-eval-last-expression ,C ] [ "Eval And Pretty-Print" slime-pprint-eval-last-expression ,C ] [ "Eval Region" slime-eval-region ,C ] - [ "Interactive Eval" slime-interactive-eval ,C ] - [ "Scratch Buffer" slime-scratch ,C ]) + [ "Scratch Buffer" slime-scratch ,C ] + [ "Interactive Eval..." slime-interactive-eval ,C ] + [ "Edit Lisp Value..." slime-edit-value ,C ]) ("Debugging" [ "Macroexpand Once..." slime-macroexpand-1 ,C ] [ "Macroexpand All..." slime-macroexpand-all ,C ] @@ -781,6 +783,7 @@ [ "Eval in Frame..." sldb-eval-in-frame ,C ] [ "Eval in Frame (pretty print)..." sldb-pprint-eval-in-frame ,C ] [ "Inspect In Frame..." sldb-inspect-in-frame ,C ] + [ "Inspect Condition Object" sldb-inspect-condition ,C ] [ "Print Condition to REPL" sldb-print-condition t ] "--" [ "Restart Frame" sldb-restart-frame ,C ] @@ -3015,6 +3018,7 @@ ("\C-c\C-b" 'slime-interrupt) ("\C-c:" 'slime-interactive-eval) ("\C-c\C-e" 'slime-interactive-eval) + ("\C-cE" 'slime-edit-value) ;("\t" 'slime-complete-symbol) ("\t" 'slime-indent-and-complete-symbol) (" " 'slime-space) @@ -3681,7 +3685,7 @@ (define-derived-mode slime-compiler-notes-mode fundamental-mode "Compiler Notes" - "\\ + "\\\ \\{slime-compiler-notes-mode-map}" (slime-set-truncate-lines)) @@ -4769,7 +4773,7 @@ fundamental-mode "Fuzzy Completions" "Major mode for presenting fuzzy completion results. -\\ +\\\ \\{slime-fuzzy-completions-map}" (use-local-map slime-fuzzy-completions-map)) @@ -5380,6 +5384,57 @@ (insert "\n") (slime-eval-print string)) +;;;; Edit Lisp value +;;; +(defun slime-edit-value (form-string) + "\\\ +Edit the value of a setf'able form in a new buffer. +The value is inserted into a temporary buffer for editing and then set +in Lisp when committed with \\[slime-edit-value-commit]." + (interactive + (list (slime-read-from-minibuffer "Edit value (evaluated): " + (slime-sexp-at-point)))) + (slime-eval-async `(swank:value-for-editing ,form-string) + (lexical-let ((form-string form-string) + (package (slime-current-package))) + (lambda (result) + (slime-edit-value-callback form-string result package))))) + +(make-variable-buffer-local + (defvar slime-edit-form-string nil + "The form being edited by `slime-edit-value'.")) + +(define-minor-mode slime-edit-value-mode + "Mode for editing a Lisp value." + nil + " edit" + '(("\C-c\C-c" . slime-edit-value-commit))) + +(defun slime-edit-value-callback (form-string current-value package) + (let ((name (generate-new-buffer-name (format "*Edit %s*" form-string)))) + (with-current-buffer (slime-get-temp-buffer-create name :mode 'lisp-mode) + (slime-mode 1) + (slime-edit-value-mode 1) + (setq slime-edit-form-string form-string) + (setq slime-buffer-connection (slime-connection)) + (setq slime-buffer-package package) + (insert current-value) + (pop-to-buffer (current-buffer))))) + +(defun slime-edit-value-commit () + "Commit the edited value to the Lisp image. +\\(See `slime-edit-value'.)" + (interactive) + (if (null slime-edit-form-string) + (error "Not editing a value.") + (let ((value (buffer-substring-no-properties (point-min) (point-max)))) + (lexical-let ((buffer (current-buffer))) + (slime-eval-async `(swank:commit-edited-value ,slime-edit-form-string + ,value) + (lambda (_) + (with-current-buffer buffer + (slime-dismiss-temp-buffer) + (kill-buffer buffer)))))))) ;;;; Tracing @@ -5772,7 +5827,7 @@ "Buffer local variable in xref windows.") (define-derived-mode slime-xref-mode lisp-mode "xref" - "\\ + "\\\ \\{slime-xref-mode-map}" (setq font-lock-defaults nil) (setq delayed-mode-hooks nil) From lgorrie at common-lisp.net Sat Mar 12 16:02:09 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 17:02:09 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050312160209.C3983884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv20015 Modified Files: swank.lisp Log Message: (value-for-editing, commit-edited-value): New functions for slime-edit-value. Date: Sat Mar 12 17:02:05 2005 Author: lgorrie Index: slime/swank.lisp diff -u slime/swank.lisp:1.285 slime/swank.lisp:1.286 --- slime/swank.lisp:1.285 Mon Mar 7 09:46:55 2005 +++ slime/swank.lisp Sat Mar 12 17:02:04 2005 @@ -1772,6 +1772,18 @@ (t what)))) (send-oob-to-emacs `(:ed ,target)))) +(defslimefun value-for-editing (form) + "Return a readable value of FORM for editing in Emacs. +FORM is expected, but not required, to be SETF'able." + ;; FIXME: Can we check FORM for setfability? -luke (12/Mar/2005) + (prin1-to-string (eval (read-from-string form)))) + +(defslimefun commit-edited-value (form value) + "Set the value of a setf'able FORM to VALUE. +FORM and VALUE are both strings from Emacs." + (eval `(setf ,(read-from-string form) ',(read-from-string value))) + t) + ;;;; Debugger From lgorrie at common-lisp.net Sat Mar 12 16:02:29 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 17:02:29 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050312160229.41A6E884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv20040 Modified Files: ChangeLog Log Message: Date: Sat Mar 12 17:02:28 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.633 slime/ChangeLog:1.634 --- slime/ChangeLog:1.633 Sat Mar 12 03:48:03 2005 +++ slime/ChangeLog Sat Mar 12 17:02:28 2005 @@ -1,5 +1,14 @@ 2005-03-12 Luke Gorrie + * slime.el (slime-edit-value): New function on `C-c E'. Prompts + for a Lisp expression, evaluates and displays the result in a new + buffer for editing, and then setf's the edited value in Lisp after + you press C-c C-c. Usage example: `C-c E asdf:*central-registry*' + Minor docstring and pull-down-menu changes. + + * swank.lisp (value-for-editing, commit-edited-value): New + functions for slime-edit-value. + * swank-allegro.lisp (toggle-trace): Fix from Antonio Menezes Leitao. From lgorrie at common-lisp.net Sat Mar 12 16:10:36 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sat, 12 Mar 2005 17:10:36 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050312161036.5C502884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv20080 Modified Files: slime.el Log Message: Fix to slime-edit-value-callback to disable slime-temp-buffer-mode. Otherwise 'q' dismisses the buffer. Date: Sat Mar 12 17:10:35 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.469 slime/slime.el:1.470 --- slime/slime.el:1.469 Sat Mar 12 17:01:24 2005 +++ slime/slime.el Sat Mar 12 17:10:35 2005 @@ -5414,6 +5414,7 @@ (let ((name (generate-new-buffer-name (format "*Edit %s*" form-string)))) (with-current-buffer (slime-get-temp-buffer-create name :mode 'lisp-mode) (slime-mode 1) + (slime-temp-buffer-mode -1) ; don't want binding of 'q' (slime-edit-value-mode 1) (setq slime-edit-form-string form-string) (setq slime-buffer-connection (slime-connection)) From lgorrie at common-lisp.net Sun Mar 13 00:39:42 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 01:39:42 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-loader.lisp Message-ID: <20050313003942.9A4C5884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17086 Modified Files: swank-loader.lisp Log Message: (*os-features*): Added :mswindows. Thanks Will Glozer. Date: Sun Mar 13 01:39:41 2005 Author: lgorrie Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.43 slime/swank-loader.lisp:1.44 --- slime/swank-loader.lisp:1.43 Sat Mar 12 02:49:48 2005 +++ slime/swank-loader.lisp Sun Mar 13 01:39:41 2005 @@ -37,7 +37,7 @@ '(:allegro :sbcl :openmcl :cmu :clisp :ccl :corman :armedbear :gcl)) (defparameter *os-features* - '(:macosx :linux :windows :solaris :darwin :sunos :unix)) + '(:macosx :linux :windows :mswindows :solaris :darwin :sunos :unix)) (defparameter *architecture-features* '(:powerpc :ppc :x86 :x86-64 :i686 :pc386 :sparc)) From lgorrie at common-lisp.net Sun Mar 13 00:40:00 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 01:40:00 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050313004000.492FF884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17115 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Sun Mar 13 01:39:59 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.634 slime/ChangeLog:1.635 --- slime/ChangeLog:1.634 Sat Mar 12 17:02:28 2005 +++ slime/ChangeLog Sun Mar 13 01:39:59 2005 @@ -1,3 +1,8 @@ +2005-03-13 Luke Gorrie + + * swank-loader.lisp (*os-features*): Added :mswindows. Thanks Will + Glozer. + 2005-03-12 Luke Gorrie * slime.el (slime-edit-value): New function on `C-c E'. Prompts From lgorrie at common-lisp.net Sun Mar 13 02:57:51 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 03:57:51 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050313025751.258F2884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv24663 Modified Files: swank-sbcl.lisp Log Message: Updated for revisted sb-introspect patch: s/DEFINITION-SOURCE-CREATED/DEFINITION-SOURCE-WRITE-DATE/ Date: Sun Mar 13 03:57:46 2005 Author: lgorrie Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.122 slime/swank-sbcl.lisp:1.123 --- slime/swank-sbcl.lisp:1.122 Sat Mar 12 02:50:15 2005 +++ slime/swank-sbcl.lisp Sun Mar 13 03:57:45 2005 @@ -361,7 +361,7 @@ (position (sb-introspect:definition-source-character-offset def)) (stamp ;; FIXME: Symbol doesn't exist in released SBCL yet. - (let ((sym (find-symbol "DEFINITION-SOURCE-CREATED" + (let ((sym (find-symbol "DEFINITION-SOURCE-FILE-WRITE-DATE" (find-package "SB-INTROSPECT")))) (when sym (funcall sym def))))) (unless pathname From lgorrie at common-lisp.net Sun Mar 13 03:01:31 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 04:01:31 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-source-file-cache.lisp Message-ID: <20050313030131.EB7DD884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv25092 Modified Files: swank-source-file-cache.lisp Log Message: (read-snippet): Skip comments and whitespace in SBCL. The source-positions reported by SBCL are not adjusted to skip over whitespace before the definition. Date: Sun Mar 13 04:01:31 2005 Author: lgorrie Index: slime/swank-source-file-cache.lisp diff -u slime/swank-source-file-cache.lisp:1.1 slime/swank-source-file-cache.lisp:1.2 --- slime/swank-source-file-cache.lisp:1.1 Sat Mar 12 02:50:46 2005 +++ slime/swank-source-file-cache.lisp Sun Mar 13 04:01:30 2005 @@ -86,12 +86,18 @@ text search.") (defun read-snippet (stream) - "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM. -Skip leading whitespace." - (loop while (member (peek-char nil stream) - '(#\Space #\Tab #\Newline #\Linefeed)) - do (read-char stream)) + "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM." + #+SBCL (skip-comments-and-whitespace stream) (read-upto-n-chars stream *source-snippet-size*)) + +(defun skip-comments-and-whitespace (stream) + (case (peek-char nil stream) + ((#\Space #\Tab #\Newline #\Linefeed) + (read-char stream) + (skip-comments-and-whitespace stream)) + (#\; + (read-line stream) + (skip-comments-and-whitespace stream)))) (defun read-upto-n-chars (stream n) "Return a string of upto N chars from STREAM." From lgorrie at common-lisp.net Sun Mar 13 03:02:34 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 04:02:34 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050313030234.141A3884E2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv25503 Modified Files: ChangeLog Log Message: Date: Sun Mar 13 04:02:33 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.635 slime/ChangeLog:1.636 --- slime/ChangeLog:1.635 Sun Mar 13 01:39:59 2005 +++ slime/ChangeLog Sun Mar 13 04:02:32 2005 @@ -1,5 +1,13 @@ 2005-03-13 Luke Gorrie + * swank-source-file-cache.lisp (read-snippet): Skip comments and + whitespace in SBCL. The source-positions reported by SBCL are not + adjusted to skip over whitespace before the definition. + + * swank-sbcl.lisp (function-source-location): Updated for revised + sb-introspect patch: + s/DEFINITION-SOURCE-CREATED/DEFINITION-SOURCE-WRITE-DATE/ + * swank-loader.lisp (*os-features*): Added :mswindows. Thanks Will Glozer. From lgorrie at common-lisp.net Sun Mar 13 15:16:17 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 16:16:17 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050313151617.B2DB38866C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv2246 Modified Files: swank.lisp Log Message: (inspect-for-emacs symbol): Add an "unintern it" action for symbols. Date: Sun Mar 13 16:16:16 2005 Author: lgorrie Index: slime/swank.lisp diff -u slime/swank.lisp:1.286 slime/swank.lisp:1.287 --- slime/swank.lisp:1.286 Sat Mar 12 17:02:04 2005 +++ slime/swank.lisp Sun Mar 13 16:16:16 2005 @@ -3193,6 +3193,8 @@ ,@(if (eq :internal status) `((:action " [export it]" ,(lambda () (export symbol package))))) + (:action " [unintern it]" + ,(lambda () (unintern symbol package))) (:newline)) '("It is a non-interned symbol." (:newline))) ;; From lgorrie at common-lisp.net Sun Mar 13 15:16:33 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 16:16:33 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050313151633.C6BA48866C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv2266 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Sun Mar 13 16:16:32 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.636 slime/ChangeLog:1.637 --- slime/ChangeLog:1.636 Sun Mar 13 04:02:32 2005 +++ slime/ChangeLog Sun Mar 13 16:16:31 2005 @@ -1,5 +1,8 @@ 2005-03-13 Luke Gorrie + * swank.lisp (inspect-for-emacs symbol): Add an "unintern it" + action for symbols. + * swank-source-file-cache.lisp (read-snippet): Skip comments and whitespace in SBCL. The source-positions reported by SBCL are not adjusted to skip over whitespace before the definition. From lgorrie at common-lisp.net Sun Mar 13 19:39:16 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 20:39:16 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050313193916.A0D7D88669@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17863 Modified Files: slime.el Log Message: (slime-dispatch-event): Use `slime-busy-p' to control the "; pipelined request" message. This way it takes requests blocked in the debugger into account and avoids spurious messages. Date: Sun Mar 13 20:39:15 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.470 slime/slime.el:1.471 --- slime/slime.el:1.470 Sat Mar 12 17:10:35 2005 +++ slime/slime.el Sun Mar 13 20:39:15 2005 @@ -2188,7 +2188,7 @@ ;; ((:emacs-rex form package thread continuation) (slime-set-state "|eval...") - (when (and (slime-rex-continuations) (slime-use-sigint-for-interrupt)) + (when (and (slime-use-sigint-for-interrupt) (slime-busy-p)) (message "; pipelined request... %S" form)) (let ((id (incf (slime-continuation-counter)))) (push (cons id continuation) (slime-rex-continuations)) From lgorrie at common-lisp.net Sun Mar 13 19:41:01 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Sun, 13 Mar 2005 20:41:01 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050313194101.35CED88669@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17920 Modified Files: ChangeLog Log Message: Date: Sun Mar 13 20:41:00 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.637 slime/ChangeLog:1.638 --- slime/ChangeLog:1.637 Sun Mar 13 16:16:31 2005 +++ slime/ChangeLog Sun Mar 13 20:41:00 2005 @@ -1,5 +1,9 @@ 2005-03-13 Luke Gorrie + * slime.el (slime-dispatch-event): Use `slime-busy-p' to control + the "; pipelined request" message. This way it takes requests + blocked in the debugger into account and avoids spurious messages. + * swank.lisp (inspect-for-emacs symbol): Add an "unintern it" action for symbols. From heller at common-lisp.net Wed Mar 16 21:58:58 2005 From: heller at common-lisp.net (Helmut Eller) Date: Wed, 16 Mar 2005 22:58:58 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050316215858.D9ACA88677@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv16641 Modified Files: slime.el Log Message: (slime-run-when-idle): New function to hide Emacs/XEmacs differences. See Steven E. Harris' message from 15 Mar 2005. (slime-process-available-input): Use it. Date: Wed Mar 16 22:58:57 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.471 slime/slime.el:1.472 --- slime/slime.el:1.471 Sun Mar 13 20:39:15 2005 +++ slime/slime.el Wed Mar 16 22:58:55 2005 @@ -1595,6 +1595,12 @@ (insert string)) (slime-process-available-input))) +(defun slime-run-when-idle (function) + "Call FUNCTION as soon as Emacs is idle." + (run-at-time (if (featurep 'xemacs) itimer-short-interval 0) + nil + function)) + (defun slime-process-available-input () "Process all complete messages that have arrived from Lisp." (unwind-protect @@ -1615,7 +1621,7 @@ (dolist (p slime-net-processes) (with-current-buffer (process-buffer p) (when (slime-net-have-input-p) - (run-at-time 0 nil 'slime-process-available-input)))))) + (slime-run-when-idle 'slime-process-available-input)))))) (defun slime-net-have-input-p () "Return true if a complete message is available." @@ -4552,8 +4558,7 @@ (slime-completion-window-active-p)) ;; XEmacs does not allow us to restore a window configuration from ;; pre-command-hook, so we do it asynchronously. - (run-at-time - 0 nil + (slime-run-when-idle (lambda () (save-excursion (set-window-configuration From heller at common-lisp.net Wed Mar 16 22:03:19 2005 From: heller at common-lisp.net (Helmut Eller) Date: Wed, 16 Mar 2005 23:03:19 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050316220319.057E688677@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17446 Modified Files: swank.lisp Log Message: (*macroexpand-printer-bindings*): New user variable. (apply-macro-expander): Use it. (call-with-bindings): Bind reverse the list. Makes it easer to cons or push a new binding at the front the list. (with-bindings): New macro. Date: Wed Mar 16 23:03:19 2005 Author: heller Index: slime/swank.lisp diff -u slime/swank.lisp:1.287 slime/swank.lisp:1.288 --- slime/swank.lisp:1.287 Sun Mar 13 16:16:16 2005 +++ slime/swank.lisp Wed Mar 16 23:03:18 2005 @@ -33,6 +33,7 @@ #:*sldb-printer-bindings* #:*swank-pprint-bindings* #:*default-worker-thread-bindings* + #:*macroexpand-printer-bindings* ;; These are re-exported directly from the backend: #:buffer-first-change #:frame-source-location-for-emacs @@ -92,16 +93,6 @@ (*print-escape* . t)) "A set of printer variables used in the debugger.") -(defvar *swank-pprint-bindings* - `((*print-level* . nil) - (*print-length* . nil) - (*print-circle* . t) - (*print-gensym* . t) - (*print-readably* . nil) - (*print-pprint-dispatch* . ,(copy-pprint-dispatch nil))) - "A list of variables bindings during pretty printing. -Used when printing macroexpansions and pprint-eval.") - (defvar *default-worker-thread-bindings* '() "An alist to initialize dynamic variables in worker threads. The list has the form ((VAR . VALUE) ...). Each variable VAR will be @@ -110,11 +101,16 @@ (defun call-with-bindings (alist fun) "Call FUN with variables bound according to ALIST. ALIST is a list of the form ((VAR . VAL) ...)." - (let ((vars (mapcar #'car alist)) - (vals (mapcar #'cdr alist))) + (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'." + `(call-with-bindings ,alist (lambda () , at body))) + ;;; The `DEFSLIMEFUN' macro defines a function that Emacs can call via ;;; RPC. @@ -530,9 +526,8 @@ (defun spawn-worker-thread (connection) (spawn (lambda () - (call-with-bindings *default-worker-thread-bindings* - (lambda () - (handle-request connection)))) + (with-bindings *default-worker-thread-bindings* + (handle-request connection))) :name "worker")) (defun dispatch-event (event socket-io) @@ -1722,18 +1717,25 @@ (makunbound name) (prin1-to-string (eval form)))))) +(defvar *swank-pprint-bindings* + `((*print-pretty* . t) + (*print-level* . nil) + (*print-length* . nil) + (*print-circle* . t) + (*print-gensym* . t) + (*print-readably* . nil)) + "A list of variables bindings during pretty printing. +Used by pprint-eval.") + (defun swank-pprint (list) "Bind some printer variables and pretty print each object in LIST." (with-buffer-syntax () - (call-with-bindings - *swank-pprint-bindings* - (lambda () - (let ((*print-pretty* t)) - (cond ((null list) "; No value") - (t (with-output-to-string (*standard-output*) - (dolist (o list) - (pprint o) - (terpri)))))))))) + (with-bindings *swank-pprint-bindings* + (cond ((null list) "; No value") + (t (with-output-to-string (*standard-output*) + (dolist (o list) + (pprint o) + (terpri)))))))) (defslimefun pprint-eval (string) (with-buffer-syntax () @@ -1776,7 +1778,8 @@ "Return a readable value of FORM for editing in Emacs. FORM is expected, but not required, to be SETF'able." ;; FIXME: Can we check FORM for setfability? -luke (12/Mar/2005) - (prin1-to-string (eval (read-from-string form)))) + (with-buffer-syntax () + (prin1-to-string (eval (read-from-string form))))) (defslimefun commit-edited-value (form value) "Set the value of a setf'able FORM to VALUE. @@ -1838,11 +1841,9 @@ (*sldb-stepping-p* nil) (*swank-state-stack* (cons :swank-debugger-hook *swank-state-stack*))) (force-user-output) - (call-with-bindings - *sldb-printer-bindings* - (lambda () - (call-with-debugging-environment - (lambda () (sldb-loop *sldb-level*))))))) + (with-bindings *sldb-printer-bindings* + (call-with-debugging-environment + (lambda () (sldb-loop *sldb-level*)))))) (defun sldb-loop (level) (unwind-protect @@ -2135,10 +2136,18 @@ ;;;; Macroexpansion +(defvar *macroexpand-printer-bindings* + '((*print-circle* . nil) + (*print-pretty* . t) + (*print-escape* . t) + (*print-level* . nil) + (*print-length* . nil))) + (defun apply-macro-expander (expander string) (declare (type function expander)) (with-buffer-syntax () - (swank-pprint (list (funcall expander (from-string string)))))) + (with-bindings *macroexpand-printer-bindings* + (prin1-to-string (funcall expander (from-string string)))))) (defslimefun swank-macroexpand-1 (string) (apply-macro-expander #'macroexpand-1 string)) From heller at common-lisp.net Wed Mar 16 22:07:45 2005 From: heller at common-lisp.net (Helmut Eller) Date: Wed, 16 Mar 2005 23:07:45 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-loader.lisp Message-ID: <20050316220745.BCD3888677@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17499 Modified Files: swank-loader.lisp Log Message: (unique-directory-name): Rewritten to avoid the rather irritating warning that (warn "Don't know ...") is unreachable. Date: Wed Mar 16 23:07:45 2005 Author: heller Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.44 slime/swank-loader.lisp:1.45 --- slime/swank-loader.lisp:1.44 Sun Mar 13 01:39:41 2005 +++ slime/swank-loader.lisp Wed Mar 16 23:07:44 2005 @@ -24,8 +24,10 @@ (mapcar #'make-swank-pathname (append '("nregex") - #+cmu '("swank-source-path-parser" "swank-source-file-cache" "swank-cmucl") - #+sbcl '("swank-sbcl" "swank-source-path-parser" "swank-source-file-cache" "swank-gray") + #+cmu '("swank-source-path-parser" "swank-source-file-cache" + "swank-cmucl") + #+sbcl '("swank-sbcl" "swank-source-path-parser" + "swank-source-file-cache" "swank-gray") #+openmcl '("metering" "swank-openmcl" "swank-gray") #+lispworks '("swank-lispworks" "swank-gray") #+allegro '("swank-allegro" "swank-gray") @@ -34,7 +36,7 @@ ))) (defparameter *implementation-features* - '(:allegro :sbcl :openmcl :cmu :clisp :ccl :corman :armedbear :gcl)) + '(:allegro :sbcl :openmcl :cmu :clisp :ccl :corman :armedbear)) (defparameter *os-features* '(:macosx :linux :windows :mswindows :solaris :darwin :sunos :unix)) @@ -42,54 +44,41 @@ (defparameter *architecture-features* '(:powerpc :ppc :x86 :x86-64 :i686 :pc386 :sparc)) +(defun lisp-version-string () + #+cmu (substitute #\- #\/ (lisp-implementation-version)) + #+sbcl (lisp-implementation-version) + #+openmcl (format nil "~d.~d" + ccl::*openmcl-major-version* + ccl::*openmcl-minor-version*) + #+lispworks (lisp-implementation-version) + #+allegro excl::*common-lisp-version-number* + #+clisp (let ((s (lisp-implementation-version))) + (subseq s 0 (position #\space s))) + #+armedbear (lisp-implementation-version)) + (defun unique-directory-name () "Return a name that can be used as a directory name that is unique to a Lisp implementation, Lisp implementation version, operating system, and hardware architecture." (flet ((first-of (features) (loop for f in features - when (find f *features*) return it))) - (let ((lisp (first-of *implementation-features*)) - (os (first-of *os-features*)) - (architecture (first-of *architecture-features*)) - (version - (block nil - #+cmu - (return (substitute #\- #\/ (lisp-implementation-version))) - #+sbcl - (return (lisp-implementation-version)) - #+gcl - (let ((s (lisp-implementation-version))) (subseq s 4)) - #+openmcl - (return (format nil "~d.~d" - ccl::*openmcl-major-version* - ccl::*openmcl-minor-version*)) - #+lispworks - (return (lisp-implementation-version)) - #+allegro - (return excl::*common-lisp-version-number*) - #+clisp - (return (let ((s (lisp-implementation-version))) - (subseq s 0 (position #\space s)))) - #+armedbear - (return "unknown") - - (warn "Don't know how to get Lisp implementation version.") - (return "unknown")))) - - (unless lisp - (warn "No implementation feature found in ~a." - *implementation-features*) - (setf lisp "unknown")) - (unless os - (warn "No os feature found in ~a." *os-features*) - (setf os "unknown")) - (unless architecture - (warn "No architecture feature found in ~a." - *architecture-features*) - (setf architecture "unknown")) - - (format nil "~(~@{~a~^-~}~)" lisp version os architecture)))) + when (find f *features*) return it)) + (maybe-warn (value fstring &rest args) + (cond (value) + (t (apply #'warn fstring args) + "unknown")))) + (let ((lisp (maybe-warn (first-of *implementation-features*) + "No implementation feature found in ~a." + *implementation-features*)) + (os (maybe-warn (first-of *os-features*) + "No os feature found in ~a." *os-features*)) + (arch (maybe-warn (first-of *architecture-features*) + "No architecture feature found in ~a." + *architecture-features*)) + (version (maybe-warn (lisp-version-string) + "Don't know how to get Lisp ~ + implementation version."))) + (format nil "~(~@{~a~^-~}~)" lisp version os arch)))) (defparameter *swank-pathname* (make-swank-pathname "swank")) From heller at common-lisp.net Wed Mar 16 22:11:25 2005 From: heller at common-lisp.net (Helmut Eller) Date: Wed, 16 Mar 2005 23:11:25 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050316221125.9C56B88677@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17545 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Wed Mar 16 23:11:24 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.638 slime/ChangeLog:1.639 --- slime/ChangeLog:1.638 Sun Mar 13 20:41:00 2005 +++ slime/ChangeLog Wed Mar 16 23:11:24 2005 @@ -1,3 +1,20 @@ +2005-03-16 Helmut Eller + + * slime/swank.lisp (*macroexpand-printer-bindings*): New user + variable. + (apply-macro-expander): Use it. + (call-with-bindings): Bind variables in reverse order. Thit makes + it easer to cons or push a new binding at the front the list. + (with-bindings): New macro. + + * slime.el (slime-run-when-idle): New function to hide + Emacs/XEmacs differences. + (slime-process-available-input): Use it. + + * swank-loader.lisp (unique-directory-name): Rewritten to avoid + the rather irritating warning that (warn "Don't know ...") is + unreachable. + 2005-03-13 Luke Gorrie * slime.el (slime-dispatch-event): Use `slime-busy-p' to control From lgorrie at common-lisp.net Fri Mar 18 19:27:41 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Fri, 18 Mar 2005 20:27:41 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050318192741.712E188669@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv12044 Modified Files: slime.el Log Message: (slime-complete-symbol*-fancy): Now nil by default. Date: Fri Mar 18 20:27:35 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.472 slime/slime.el:1.473 --- slime/slime.el:1.472 Wed Mar 16 22:58:55 2005 +++ slime/slime.el Fri Mar 18 20:27:31 2005 @@ -206,8 +206,10 @@ (const :tag "Compound" slime-complete-symbol*) (const :tag "Fuzzy" slime-fuzzy-complete-symbol))) -(defcustom slime-complete-symbol*-fancy t - "Use information from argument lists for DWIM'ish symbol completion.") +(defcustom slime-complete-symbol*-fancy nil + "Use information from argument lists for DWIM'ish symbol completion." + :group 'slime-mode + :type 'boolean) (defcustom slime-space-information-p t "Have the SPC key offer arglist information." From heller at common-lisp.net Fri Mar 18 22:23:37 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 18 Mar 2005 23:23:37 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050318222337.AD3C4886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22205 Modified Files: swank-sbcl.lisp Log Message: (swank-compile-string): Re-implemented. This time with temp-files and proper source-location tracking. (install-debug-source-patch, debug-source-for-info-advice): Patch SBCL's debug-source-for-info so that we can dump our own bits of debug info. (temp-file-name, call/temp-file): New utilities. (function-source-location, code-location-source-path): Rewritten to handle C-c C-c functions. Also use the source-path to locate the position. (locate-compiler-note): Renamed from resolve-note-location. (file-source-location, lisp-source-location) (temp-file-source-location, source-file-source-location) (string-source-position, code-location-debug-source-info) (code-location-debug-source-name, code-location-debug-source-created,) (code-location-debug-fun-fun, code-location-from-emacs-buffer-p) (function-from-emacs-buffer-p, function-debug-source-info) (info-from-emacs-buffer-p, code-location-has-debug-block-info-p) (stream-source-position): Lots of new helper functions. (with-debootstrapping): Moved upwards so that it can be used for source location searching. (source-location-for-emacs): Deleted Date: Fri Mar 18 23:23:36 2005 Author: heller Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.123 slime/swank-sbcl.lisp:1.124 --- slime/swank-sbcl.lisp:1.123 Sun Mar 13 03:57:45 2005 +++ slime/swank-sbcl.lisp Fri Mar 18 23:23:36 2005 @@ -152,6 +152,77 @@ (defimplementation quit-lisp () (sb-ext:quit)) + +;;;; Support for SBCL syntax + +(defun feature-in-list-p (feature list) + (etypecase feature + (symbol (member feature list :test #'eq)) + (cons (flet ((subfeature-in-list-p (subfeature) + (feature-in-list-p subfeature list))) + (ecase (first feature) + (:or (some #'subfeature-in-list-p (rest feature))) + (:and (every #'subfeature-in-list-p (rest feature))) + (:not (destructuring-bind (e) (cdr feature) + (not (subfeature-in-list-p e))))))))) + +(defun shebang-reader (stream sub-character infix-parameter) + (declare (ignore sub-character)) + (when infix-parameter + (error "illegal read syntax: #~D!" infix-parameter)) + (let ((next-char (read-char stream))) + (unless (find next-char "+-") + (error "illegal read syntax: #!~C" next-char)) + ;; When test is not satisfied + ;; FIXME: clearer if order of NOT-P and (NOT NOT-P) were reversed? then + ;; would become "unless test is satisfied".. + (when (let* ((*package* (find-package "KEYWORD")) + (*read-suppress* nil) + (not-p (char= next-char #\-)) + (feature (read stream))) + (if (feature-in-list-p feature *features*) + not-p + (not not-p))) + ;; Read (and discard) a form from input. + (let ((*read-suppress* t)) + (read stream t nil t)))) + (values)) + +(defvar *shebang-readtable* + (let ((*readtable* (copy-readtable nil))) + (set-dispatch-macro-character #\# #\! + (lambda (s c n) (shebang-reader s c n)) + *readtable*) + *readtable*)) + +(defun shebang-readtable () + *shebang-readtable*) + +(defun sbcl-package-p (package) + (let ((name (package-name package))) + (eql (mismatch "SB-" name) 3))) + +(defvar *debootstrap-packages* t) + +(defmacro with-debootstrapping (&body body) + (let ((not-found (find-symbol "BOOTSTRAP-PACKAGE-NOT-FOUND" "SB-INT")) + (debootstrap (find-symbol "DEBOOTSTRAP-PACKAGE" "SB-INT"))) + (if (and not-found debootstrap) + `(handler-bind ((,not-found #',debootstrap)) , at body) + `(progn , at body)))) + +(defimplementation call-with-syntax-hooks (fn) + (cond ((and *debootstrap-packages* + (sbcl-package-p *package*)) + (with-debootstrapping (funcall fn))) + (t + (funcall fn)))) + +(defimplementation default-readtable-alist () + (let ((readtable (shebang-readtable))) + (loop for p in (remove-if-not #'sbcl-package-p (list-all-packages)) + collect (cons (package-name p) readtable)))) + ;;; Utilities (defimplementation arglist ((fname t)) @@ -200,47 +271,27 @@ (t condition))) (defun compiler-note-location (context) - (cond (context - (resolve-note-location - *buffer-name* - (sb-c::compiler-error-context-file-name context) - (sb-c::compiler-error-context-file-position context) - (current-compiler-error-source-path context) - (sb-c::compiler-error-context-original-source context))) + (if context + (with-struct (sb-c::compiler-error-context- file-name) context + (locate-compiler-note file-name (compiler-source-path context))) + (list :error "No error location available"))) + +(defun locate-compiler-note (file source-path) + (cond ((and (pathnamep file) *buffer-name*) + ;; Compiling from a buffer + (let ((position (+ *buffer-offset* + (source-path-string-position + source-path *buffer-substring*)))) + (make-location (list :buffer *buffer-name*) + (list :position position)))) + ((and (pathnamep file) (null *buffer-name*)) + ;; Compiling from a file + (make-location (list :file (namestring file)) + (list :position + (1+ (source-path-file-position + source-path file))))) (t - (resolve-note-location *buffer-name* nil nil nil nil)))) - -(defgeneric resolve-note-location (buffer file-name file-position - source-path source)) - -(defmethod resolve-note-location ((b (eql nil)) (f pathname) pos path source) - (make-location - `(:file ,(namestring (truename f))) - `(:position ,(1+ (source-path-file-position path f))))) - -;; SBCL doesn't have compile-from-stream, so C-c C-c ends up here -(defmethod resolve-note-location ((b string) (f (eql :lisp)) pos path source) - ;; Remove the surrounding lambda from the path (was added by - ;; swank-compile-string) - (destructuring-bind (_ form &rest rest) path - (declare (ignore _)) - (make-location - `(:buffer ,b) - `(:position ,(+ *buffer-offset* - (source-path-string-position (list* (- form 2) rest) - *buffer-substring*)))))) - -(defmethod resolve-note-location (b (f (eql :lisp)) pos path (source string)) - (make-location - `(:source-form ,source) - `(:position 1))) - -(defmethod resolve-note-location (buffer - (file (eql nil)) - (pos (eql nil)) - (path (eql nil)) - (source (eql nil))) - (list :error "No error location available")) + (error "unhandled case")))) (defun brief-compiler-message-for-emacs (condition) "Briefly describe a compiler error for Emacs. @@ -261,7 +312,7 @@ (format nil "~@[--> ~{~<~%--> ~1:;~A~> ~}~%~]~@[~{==>~%~A~%~}~]~A" enclosing source condition)))) -(defun current-compiler-error-source-path (context) +(defun compiler-source-path (context) "Return the source-path for the current compiler error. Returns NIL if this cannot be determined by examining internal compiler state." @@ -300,19 +351,61 @@ (load output-file)))) (sb-c:fatal-compiler-error () nil))) +;;;; compile-string + +;;; We patch sb-c::debug-source-for-info so that we can dump our own +;;; bits of source info. Our *user-source-info* is stored in the +;;; debug-source-info slot. + +(defvar *real-debug-source-for-info*) +(defvar *user-source-info*) + +(defun debug-source-for-info-advice (info) + (destructuring-bind (source) (funcall *real-debug-source-for-info* info) + (when (boundp '*user-source-info*) + (setf (sb-c::debug-source-info source) *user-source-info*)) + (list source))) + +(defun install-debug-source-patch () + (unless (boundp '*real-debug-source-for-info*) + (setq *real-debug-source-for-info* #'sb-c::debug-source-for-info)) + (sb-ext:without-package-locks + (setf (symbol-function 'sb-c::debug-source-for-info) + #'debug-source-for-info-advice))) + (defimplementation swank-compile-string (string &key buffer position directory) (declare (ignore directory)) - (let ((form (read-from-string (format nil "(~S () ~A)" 'lambda string)))) - (flet ((compileit (cont) - (with-compilation-hooks () - (let ((*buffer-name* buffer) - (*buffer-offset* position) - (*buffer-substring* string)) - (funcall cont (compile nil form)))))) - (cond (*trap-load-time-warnings* - (compileit #'funcall)) - (t - (funcall (compileit #'identity))))))) + (install-debug-source-patch) + (call/temp-file + string + (lambda (filename) + (let ((*user-source-info* (list :emacs-buffer buffer :emacs-string string + :emacs-position position)) + (*buffer-name* buffer) + (*buffer-offset* position) + (*buffer-substring* string)) + (let ((fasl (with-compilation-hooks () + (compile-file filename)))) + (load fasl) + (delete-file fasl)))))) + +(defun call/temp-file (string fun) + (let ((filename (temp-file-name))) + (unwind-protect + (with-open-file (s filename :direction :output :if-exists :error) + (write-string string s) + (finish-output s) + (funcall fun filename)) + (when (probe-file filename) + (delete-file filename))))) + +(defun temp-file-name () + "Return a temporary file name to compile strings into." + (sb-alien:alien-funcall + (sb-alien:extern-alien + "tmpnam" + (function sb-alien:c-string sb-alien:system-area-pointer)) + (sb-sys:int-sap 0))) ;;;; Definitions @@ -356,36 +449,44 @@ (defun function-source-location (function &optional name) "Try to find the canonical source location of FUNCTION." (let* ((def (sb-introspect:find-definition-source function)) - (pathname (sb-introspect:definition-source-pathname def)) - (path (sb-introspect:definition-source-form-path def)) - (position (sb-introspect:definition-source-character-offset def)) - (stamp - ;; FIXME: Symbol doesn't exist in released SBCL yet. - (let ((sym (find-symbol "DEFINITION-SOURCE-FILE-WRITE-DATE" - (find-package "SB-INTROSPECT")))) - (when sym (funcall sym def))))) - (unless pathname - (return-from function-source-location - (list :error (format nil "No filename for: ~S" function)))) - (multiple-value-bind (truename condition) - (ignore-errors (truename pathname)) - (when condition - (return-from function-source-location - (list :error (format nil "~A" condition)))) - (make-location - (list :file (namestring truename)) - ;; source-paths depend on the file having been compiled with - ;; lotsa debugging. If not present, return the function name - ;; for emacs to attempt to find with a regex - (cond (path (list :source-path path position)) - (t (list :function-name - (or (and name (string name)) - (string (sb-kernel:%fun-name function)))))) - (let ((source (get-source-code pathname stamp))) - (if source - (with-input-from-string (stream source) - (file-position stream position) - (list :snippet (read-snippet stream))))))))) + (stamp (definition-source-file-write-date def))) + (with-struct (sb-introspect::definition-source- + pathname form-path character-offset) def + (cond ((function-from-emacs-buffer-p function) + (let ((info (function-debug-source-info function))) + (destructuring-bind (&key emacs-buffer emacs-position + emacs-string) info + (let ((pos (if form-path + (with-debootstrapping + (source-path-string-position + form-path emacs-string)) + character-offset))) + (make-location `(:buffer ,(getf info :emacs-buffer)) + `(:position ,(+ pos emacs-position))))))) + (t + (let* ((filename (namestring (truename pathname))) + (pos (if form-path + (with-debootstrapping + (source-path-file-position form-path filename) ) + character-offset))) + (make-location + `(:file ,filename) + (if pos + `(:position ,pos) + `(:function-name + ,(or (and name (string name)) + (string (sb-kernel:%fun-name function))))) + (let ((source (get-source-code pathname stamp))) + (if source + (with-input-from-string (stream source) + (file-position stream pos) + (list :snippet (read-snippet stream)))))))))))) + +;; FIXME: Symbol doesn't exist in released SBCL yet. +(defun definition-source-file-write-date (def) + (let ((sym (find-symbol "DEFINITION-SOURCE-FILE-WRITE-DATE" + (find-package "SB-INTROSPECT")))) + (when sym (funcall sym def)))) (defun method-definitions (gf) (let ((methods (sb-mop:generic-function-methods gf)) @@ -541,27 +642,103 @@ SBCL interfaces, all different."))))) (printer-form))) -(defun code-location-source-path (code-location) - (let* ((location (sb-debug::maybe-block-start-location code-location)) - (form-num (sb-di:code-location-form-number location))) - (let ((translations (sb-debug::get-toplevel-form location))) - (unless (< form-num (length translations)) - (error "Source path no longer exists.")) - (reverse (cdr (svref translations form-num)))))) - -(defun code-location-file-position (code-location) - (let* ((debug-source (sb-di:code-location-debug-source code-location)) - (filename (sb-di:debug-source-name debug-source)) - (path (code-location-source-path code-location))) - (source-path-file-position path filename))) +;;;; Code-location -> source-location translation -;;; source-path-file-position and friends are in swank-source-path-parser +(defun code-location-source-location (code-location) + (let ((dsource (sb-di:code-location-debug-source code-location))) + (ecase (sb-di:debug-source-from dsource) + (:file (file-source-location code-location)) + (:lisp (lisp-source-location code-location))))) + +(defun file-source-location (code-location) + (cond ((code-location-has-debug-block-info-p code-location) + (if (code-location-from-emacs-buffer-p code-location) + (temp-file-source-location code-location) + (source-file-source-location code-location))) + (t + (let ((fun (code-location-debug-fun-fun code-location))) + (cond (fun (function-source-location fun)) + (t (error "Cannot find source location for: ~A " + code-location))))))) + +(defun lisp-source-location (code-location) + (let ((source (with-output-to-string (*standard-output*) + (print-code-location-source-form code-location 100)))) + (make-location `(:source-form ,source) '(:position 0)))) + +(defun temp-file-source-location (code-location) + (let ((info (code-location-debug-source-info code-location))) + (destructuring-bind (&key emacs-buffer emacs-position emacs-string) info + (let* ((pos (string-source-position code-location emacs-string)) + (snipped (with-input-from-string (s emacs-string) + (file-position s pos) + (read-snippet s)))) + (make-location `(:buffer ,emacs-buffer) + `(:position ,(+ emacs-position pos)) + `(:snippet ,snipped)))))) + +(defun source-file-source-location (code-location) + (let* ((code-date (code-location-debug-source-created code-location)) + (filename (code-location-debug-source-name code-location)) + (source-code (get-source-code filename code-date)) + (cloc code-location)) + (with-input-from-string (s source-code) + (make-location `(:file ,filename) + `(:position ,(1+ (stream-source-position cloc s))) + `(:snippet ,(read-snippet s)))))) + +(defun string-source-position (code-location string) + (with-input-from-string (s string) + (stream-source-position code-location s))) + +(defun code-location-debug-source-info (code-location) + (sb-c::debug-source-info (sb-di::code-location-debug-source code-location))) + +(defun code-location-debug-source-name (code-location) + (sb-c::debug-source-name (sb-di::code-location-debug-source code-location))) + +(defun code-location-debug-source-created (code-location) + (sb-c::debug-source-created + (sb-di::code-location-debug-source code-location))) + +(defun code-location-debug-fun-fun (code-location) + (sb-di:debug-fun-fun (sb-di:code-location-debug-fun code-location))) + +(defun code-location-from-emacs-buffer-p (code-location) + (info-from-emacs-buffer-p (code-location-debug-source-info code-location))) + +(defun function-from-emacs-buffer-p (function) + (info-from-emacs-buffer-p (function-debug-source-info function))) + +(defun function-debug-source-info (function) + (let* ((comp (sb-di::compiled-debug-fun-component + (sb-di::fun-debug-fun function)))) + (sb-c::debug-source-info (car (sb-c::debug-info-source + (sb-kernel:%code-debug-info comp)))))) + +(defun info-from-emacs-buffer-p (info) + (and info + (consp info) + (eq :emacs-buffer (car info)))) + +(defun code-location-has-debug-block-info-p (code-location) + (handler-case + (progn (sb-di:code-location-debug-block code-location) + t) + (sb-di:no-debug-blocks () nil))) + +(defun stream-source-position (code-location stream) + (let* ((cloc (sb-debug::maybe-block-start-location code-location)) + (tlf-number (sb-di::code-location-toplevel-form-offset cloc)) + (form-number (sb-di::code-location-form-number cloc))) + (multiple-value-bind (tlf pos-map) (read-source-form tlf-number stream) + (let* ((path-table (sb-di::form-number-translations tlf 0)) + (source-path (if (<= (length path-table) form-number) + (list 0) ; file is out of sync + (reverse (cdr (aref path-table form-number)))))) + (source-path-source-position source-path tlf pos-map))))) -(defun debug-source-info-from-emacs-buffer-p (debug-source) - (let ((info (sb-c::debug-source-info debug-source))) - (and info - (consp info) - (eq :emacs-buffer (car info))))) +;;; source-path-file-position and friends are in swank-source-path-parser (defun print-code-location-source-form (code-location context) (macrolet ((printer-form () @@ -587,43 +764,8 @@ again!")))))) (printer-form))) -(defun source-location-for-emacs (code-location) - (let* ((debug-source (sb-di:code-location-debug-source code-location)) - (from (sb-di:debug-source-from debug-source)) - (name (sb-di:debug-source-name debug-source)) - (created (sb-di:debug-source-created debug-source))) - (ecase from - (:file - (let ((source-path (ignore-errors - (code-location-source-path code-location)))) - (cond (source-path - ;; XXX: code-location-source-path reads the source !! - (let ((position (code-location-file-position code-location))) - (make-location - (list :file (namestring (truename name))) - (list :source-path source-path position) - (let ((source (get-source-code name created))) - (if source - (with-input-from-string (stream source) - (file-position stream position) - (list :snippet (read-snippet stream)))))))) - (t - (let* ((dfn (sb-di:code-location-debug-fun code-location)) - (fn (sb-di:debug-fun-fun dfn))) - (unless fn - (error "Cannot find source location for: ~A " - code-location)) - (function-source-location - fn (sb-di:debug-fun-name dfn))))))) - - (:lisp - (make-location - (list :source-form (with-output-to-string (*standard-output*) - (print-code-location-source-form code-location 100))) - (list :position 0)))))) - (defun safe-source-location-for-emacs (code-location) - (handler-case (source-location-for-emacs code-location) + (handler-case (code-location-source-location code-location) (error (c) (list :error (format nil "~A" c))))) (defimplementation frame-source-location-for-emacs (index) @@ -827,77 +969,6 @@ `("Pretty arglist: " (:value ,(sb-pcl::generic-function-pretty-arglist o)) (:newline) "Initial methods: " (:value ,(sb-pcl::generic-function-initial-methods o))))))) - - -;;;; Support for SBCL syntax - -(defun feature-in-list-p (feature list) - (etypecase feature - (symbol (member feature list :test #'eq)) - (cons (flet ((subfeature-in-list-p (subfeature) - (feature-in-list-p subfeature list))) - (ecase (first feature) - (:or (some #'subfeature-in-list-p (rest feature))) - (:and (every #'subfeature-in-list-p (rest feature))) - (:not (destructuring-bind (e) (cdr feature) - (not (subfeature-in-list-p e))))))))) - -(defun shebang-reader (stream sub-character infix-parameter) - (declare (ignore sub-character)) - (when infix-parameter - (error "illegal read syntax: #~D!" infix-parameter)) - (let ((next-char (read-char stream))) - (unless (find next-char "+-") - (error "illegal read syntax: #!~C" next-char)) - ;; When test is not satisfied - ;; FIXME: clearer if order of NOT-P and (NOT NOT-P) were reversed? then - ;; would become "unless test is satisfied".. - (when (let* ((*package* (find-package "KEYWORD")) - (*read-suppress* nil) - (not-p (char= next-char #\-)) - (feature (read stream))) - (if (feature-in-list-p feature *features*) - not-p - (not not-p))) - ;; Read (and discard) a form from input. - (let ((*read-suppress* t)) - (read stream t nil t)))) - (values)) - -(defvar *shebang-readtable* - (let ((*readtable* (copy-readtable nil))) - (set-dispatch-macro-character #\# #\! - (lambda (s c n) (shebang-reader s c n)) - *readtable*) - *readtable*)) - -(defun shebang-readtable () - *shebang-readtable*) - -(defun sbcl-package-p (package) - (let ((name (package-name package))) - (eql (mismatch "SB-" name) 3))) - -(defvar *debootstrap-packages* t) - -(defmacro with-debootstrapping (&body body) - (let ((not-found (find-symbol "BOOTSTRAP-PACKAGE-NOT-FOUND" "SB-INT")) - (debootstrap (find-symbol "DEBOOTSTRAP-PACKAGE" "SB-INT"))) - (if (and not-found debootstrap) - `(handler-bind ((,not-found #',debootstrap)) , at body) - `(progn , at body)))) - -(defimplementation call-with-syntax-hooks (fn) - (cond ((and *debootstrap-packages* - (sbcl-package-p *package*)) - (with-debootstrapping (funcall fn))) - (t - (funcall fn)))) - -(defimplementation default-readtable-alist () - (let ((readtable (shebang-readtable))) - (loop for p in (remove-if-not #'sbcl-package-p (list-all-packages)) - collect (cons (package-name p) readtable)))) ;;;; Multiprocessing From heller at common-lisp.net Fri Mar 18 22:25:34 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 18 Mar 2005 23:25:34 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050318222534.BD8D1886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22245 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Fri Mar 18 23:25:33 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.639 slime/ChangeLog:1.640 --- slime/ChangeLog:1.639 Wed Mar 16 23:11:24 2005 +++ slime/ChangeLog Fri Mar 18 23:25:33 2005 @@ -1,3 +1,27 @@ +2005-03-18 Helmut Eller + + * swank-sbcl.lisp (swank-compile-string): Re-implemented. This + time with temp-files and proper source-location tracking. + (install-debug-source-patch, debug-source-for-info-advice): Patch + SBCL's debug-source-for-info so that we can dump our own bits of + debug info. + (function-source-location, code-location-source-path): Rewritten + to handle C-c C-c functions. Also use the source-path to locate + the position. + (locate-compiler-note): Renamed from resolve-note-location. + (temp-file-name, call/temp-file): New utilities. + (file-source-location, lisp-source-location) + (temp-file-source-location, source-file-source-location) + (string-source-position, code-location-debug-source-info) + (code-location-debug-source-name, code-location-debug-source-created,) + (code-location-debug-fun-fun, code-location-from-emacs-buffer-p) + (function-from-emacs-buffer-p, function-debug-source-info) + (info-from-emacs-buffer-p, code-location-has-debug-block-info-p) + (stream-source-position): Lots of new helper functions. + (with-debootstrapping): Moved upwards so that it can be used for + source location searching. + (source-location-for-emacs): Deleted + 2005-03-16 Helmut Eller * slime/swank.lisp (*macroexpand-printer-bindings*): New user From heller at common-lisp.net Fri Mar 18 22:34:03 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 18 Mar 2005 23:34:03 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050318223403.69D81886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv23120 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Fri Mar 18 23:33:59 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.640 slime/ChangeLog:1.641 --- slime/ChangeLog:1.640 Fri Mar 18 23:25:33 2005 +++ slime/ChangeLog Fri Mar 18 23:33:59 2005 @@ -1,5 +1,8 @@ 2005-03-18 Helmut Eller + * swank-source-path-parser.lisp (make-source-recording-readtable): + Ignore non-ascii chars. + * swank-sbcl.lisp (swank-compile-string): Re-implemented. This time with temp-files and proper source-location tracking. (install-debug-source-patch, debug-source-for-info-advice): Patch From heller at common-lisp.net Fri Mar 18 22:34:35 2005 From: heller at common-lisp.net (Helmut Eller) Date: Fri, 18 Mar 2005 23:34:35 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-source-path-parser.lisp Message-ID: <20050318223435.4B7EF886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv23166 Modified Files: swank-source-path-parser.lisp Log Message: (make-source-recording-readtable): Ignore non-ascii chars. Date: Fri Mar 18 23:34:34 2005 Author: heller Index: slime/swank-source-path-parser.lisp diff -u slime/swank-source-path-parser.lisp:1.11 slime/swank-source-path-parser.lisp:1.12 --- slime/swank-source-path-parser.lisp:1.11 Thu Dec 16 22:13:49 2004 +++ slime/swank-source-path-parser.lisp Fri Mar 18 23:34:34 2005 @@ -47,7 +47,7 @@ The source locations are stored in SOURCE-MAP." (let* ((tab (copy-readtable readtable)) (*readtable* tab)) - (dotimes (code char-code-limit) + (dotimes (code 128) (let ((char (code-char code))) (multiple-value-bind (fn term) (get-macro-character char tab) (when fn @@ -70,7 +70,7 @@ (defun read-source-form (n stream) "Read the Nth toplevel form number with source location recording. Return the form and the source-map." - (let ((*read-suppress* t)) + (let ((*read-suppress* t)) (dotimes (i n) (read stream))) (let ((*read-suppress* nil)) From eweitz at common-lisp.net Sun Mar 20 23:11:58 2005 From: eweitz at common-lisp.net (Edi Weitz) Date: Mon, 21 Mar 2005 00:11:58 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/swank-loader.lisp Message-ID: <20050320231158.85301886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv32334 Modified Files: ChangeLog swank-loader.lisp Log Message: Added LW features Date: Mon Mar 21 00:11:51 2005 Author: eweitz Index: slime/ChangeLog diff -u slime/ChangeLog:1.641 slime/ChangeLog:1.642 --- slime/ChangeLog:1.641 Fri Mar 18 23:33:59 2005 +++ slime/ChangeLog Mon Mar 21 00:11:50 2005 @@ -1,3 +1,8 @@ +2003-05-21 Edi Weitz + + * swank-loader-lisp (*implementation-features*, *os-features*, + *architecture-features*): LispWorks was completely missing. + 2005-03-18 Helmut Eller * swank-source-path-parser.lisp (make-source-recording-readtable): Index: slime/swank-loader.lisp diff -u slime/swank-loader.lisp:1.45 slime/swank-loader.lisp:1.46 --- slime/swank-loader.lisp:1.45 Wed Mar 16 23:07:44 2005 +++ slime/swank-loader.lisp Mon Mar 21 00:11:50 2005 @@ -36,13 +36,13 @@ ))) (defparameter *implementation-features* - '(:allegro :sbcl :openmcl :cmu :clisp :ccl :corman :armedbear)) + '(:allegro :lispworks :sbcl :openmcl :cmu :clisp :ccl :corman :armedbear)) (defparameter *os-features* - '(:macosx :linux :windows :mswindows :solaris :darwin :sunos :unix)) + '(:macosx :linux :windows :mswindows :win32 :solaris :darwin :sunos :unix)) (defparameter *architecture-features* - '(:powerpc :ppc :x86 :x86-64 :i686 :pc386 :sparc)) + '(:powerpc :ppc :x86 :x86-64 :i686 :pc386 :iapx386 :sparc)) (defun lisp-version-string () #+cmu (substitute #\- #\/ (lisp-implementation-version)) From lgorrie at common-lisp.net Sun Mar 20 23:34:34 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Mon, 21 Mar 2005 00:34:34 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050320233434.BACEC886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1547 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Mar 21 00:34:33 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.642 slime/ChangeLog:1.643 --- slime/ChangeLog:1.642 Mon Mar 21 00:11:50 2005 +++ slime/ChangeLog Mon Mar 21 00:34:33 2005 @@ -3,6 +3,10 @@ * swank-loader-lisp (*implementation-features*, *os-features*, *architecture-features*): LispWorks was completely missing. +2005-03-18 Luke Gorrie + + * slime.el (slime-complete-symbol*-fancy): Now nil by default. + 2005-03-18 Helmut Eller * swank-source-path-parser.lisp (make-source-recording-readtable): From lgorrie at common-lisp.net Mon Mar 21 00:38:43 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Mon, 21 Mar 2005 01:38:43 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050321003843.B3244886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5205 Modified Files: swank-sbcl.lisp Log Message: (function-source-location): For definitions compiled in Emacs buffers, include the :emacs-string as a :snippet hint for search-based M-. lookup. Date: Mon Mar 21 01:38:43 2005 Author: lgorrie Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.124 slime/swank-sbcl.lisp:1.125 --- slime/swank-sbcl.lisp:1.124 Fri Mar 18 23:23:36 2005 +++ slime/swank-sbcl.lisp Mon Mar 21 01:38:43 2005 @@ -462,7 +462,8 @@ form-path emacs-string)) character-offset))) (make-location `(:buffer ,(getf info :emacs-buffer)) - `(:position ,(+ pos emacs-position))))))) + `(:position ,(+ pos emacs-position)) + `(:snippet ,(getf info :emacs-string))))))) (t (let* ((filename (namestring (truename pathname))) (pos (if form-path From lgorrie at common-lisp.net Mon Mar 21 00:43:24 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Mon, 21 Mar 2005 01:43:24 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050321004324.887AB886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv5249 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Mar 21 01:43:23 2005 Author: lgorrie Index: slime/ChangeLog diff -u slime/ChangeLog:1.643 slime/ChangeLog:1.644 --- slime/ChangeLog:1.643 Mon Mar 21 00:34:33 2005 +++ slime/ChangeLog Mon Mar 21 01:43:23 2005 @@ -1,3 +1,9 @@ +2005-03-21 Luke Gorrie + + * swank-sbcl.lisp (function-source-location): For definitions + compiled in Emacs buffers, include the :emacs-string as a :snippet + hint for search-based M-. lookup. + 2003-05-21 Edi Weitz * swank-loader-lisp (*implementation-features*, *os-features*, From heller at common-lisp.net Mon Mar 21 00:57:28 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 01:57:28 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050321005728.2C070886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6185 Modified Files: swank-sbcl.lisp Log Message: (quit-lisp): If we are running multithreaded, terminate all other threads too. (still broken in 0.8.20.27; used to work in ~0.8.20.2.) (with-debootstrapping, call-with-debootstrapping): Remove ugly backward compatibility code. (sbcl-source-file-p, guess-readtable-for-filename): New utilities. (function-source-location): Handle work off to helper functions. (find-function-source-location): New function. Use the shebang-readtable for SBCL source files. (function-source-position, function-source-filename) (function-source-write-date, function-toplevel-form-number) (function-hint-snippet, function-has-start-location-p) (function-start-location): New helpers. (safe-source-location-for-emacs): Don't catch errors if *debug-definition-finding* is true. (inspect-for-emacs): Minor beautifications. Date: Mon Mar 21 01:57:27 2005 Author: heller Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.125 slime/swank-sbcl.lisp:1.126 --- slime/swank-sbcl.lisp:1.125 Mon Mar 21 01:38:43 2005 +++ slime/swank-sbcl.lisp Mon Mar 21 01:57:27 2005 @@ -135,7 +135,7 @@ (defun accept (socket) "Like socket-accept, but retry on EAGAIN." - (loop (handler-case + (loop (handler-case (return (sb-bsd-sockets:socket-accept socket)) (sb-bsd-sockets:interrupted-error ())))) @@ -149,9 +149,6 @@ (defimplementation lisp-implementation-type-name () "sbcl") -(defimplementation quit-lisp () - (sb-ext:quit)) - ;;;; Support for SBCL syntax @@ -202,14 +199,24 @@ (let ((name (package-name package))) (eql (mismatch "SB-" name) 3))) +(defun sbcl-source-file-p (filename) + (loop for (_ pattern) in (logical-pathname-translations "SYS") + thereis (pathname-match-p filename pattern))) + +(defun guess-readtable-for-filename (filename) + (if (sbcl-source-file-p filename) + (shebang-readtable) + *readtable*)) + (defvar *debootstrap-packages* t) +(defun call-with-debootstrapping (fun) + (handler-bind ((sb-int:bootstrap-package-not-found + #'sb-int:debootstrap-package)) + (funcall fun))) + (defmacro with-debootstrapping (&body body) - (let ((not-found (find-symbol "BOOTSTRAP-PACKAGE-NOT-FOUND" "SB-INT")) - (debootstrap (find-symbol "DEBOOTSTRAP-PACKAGE" "SB-INT"))) - (if (and not-found debootstrap) - `(handler-bind ((,not-found #',debootstrap)) , at body) - `(progn , at body)))) + `(call-with-debootstrapping (lambda () , at body))) (defimplementation call-with-syntax-hooks (fn) (cond ((and *debootstrap-packages* @@ -442,48 +449,82 @@ (function-source-location fun name) (handler-case (function-source-location fun name) (error (e) - (list (list :error (format nil "Error: ~A" e))))))) + (list :error (format nil "Error: ~A" e)))))) -;;; FIXME we don't handle the compiled-interactively case yet. That -;;; should have NIL :filename & :position, and non-NIL :source-form (defun function-source-location (function &optional name) "Try to find the canonical source location of FUNCTION." - (let* ((def (sb-introspect:find-definition-source function)) - (stamp (definition-source-file-write-date def))) + (declare (type function function)) + (if (function-from-emacs-buffer-p function) + (find-temp-function-source-location function) + (find-function-source-location function))) + +(defun find-function-source-location (function) + (cond #+(or) ;; doesn't work unknown reasons + ((function-has-start-location-p function) + (code-location-source-location (function-start-location function))) + ((not (function-source-filename function)) + (error "Source filename not recorded for ~A" function)) + (t + (let* ((pos (function-source-position function)) + (snippet (function-hint-snippet function pos))) + (make-location `(:file ,(function-source-filename function)) + `(:position ,pos) + `(:snippet ,snippet)))))) + +(defun function-source-position (function) + ;; We only consider the toplevel form number here. + (let* ((tlf (function-toplevel-form-number function)) + (filename (function-source-filename function)) + (*readtable* (guess-readtable-for-filename filename))) + (with-debootstrapping + (source-path-file-position (list tlf) filename)))) + +(defun function-source-filename (function) + (ignore-errors + (namestring + (truename + (sb-introspect:definition-source-pathname + (sb-introspect:find-definition-source function)))))) + +(defun function-source-write-date (function) + (definition-source-file-write-date + (sb-introspect:find-definition-source function))) + +(defun function-toplevel-form-number (function) + (car + (sb-introspect:definition-source-form-path + (sb-introspect:find-definition-source function)))) + +(defun function-hint-snippet (function position) + (let ((source (get-source-code (function-source-filename function) + (function-source-write-date function)))) + (with-input-from-string (s source) + (file-position s position) + (read-snippet s)))) + +(defun function-has-start-location-p (function) + (ignore-errors (function-start-location function))) + +(defun function-start-location (function) + (let ((dfun (sb-di:fun-debug-fun function))) + (and dfun (sb-di:debug-fun-start-location dfun)))) + +(defun find-temp-function-source-location (function) + (let ((info (function-debug-source-info function))) (with-struct (sb-introspect::definition-source- - pathname form-path character-offset) def - (cond ((function-from-emacs-buffer-p function) - (let ((info (function-debug-source-info function))) - (destructuring-bind (&key emacs-buffer emacs-position - emacs-string) info - (let ((pos (if form-path - (with-debootstrapping - (source-path-string-position - form-path emacs-string)) - character-offset))) - (make-location `(:buffer ,(getf info :emacs-buffer)) - `(:position ,(+ pos emacs-position)) - `(:snippet ,(getf info :emacs-string))))))) - (t - (let* ((filename (namestring (truename pathname))) - (pos (if form-path - (with-debootstrapping - (source-path-file-position form-path filename) ) - character-offset))) - (make-location - `(:file ,filename) - (if pos - `(:position ,pos) - `(:function-name - ,(or (and name (string name)) - (string (sb-kernel:%fun-name function))))) - (let ((source (get-source-code pathname stamp))) - (if source - (with-input-from-string (stream source) - (file-position stream pos) - (list :snippet (read-snippet stream)))))))))))) + form-path character-offset) + (sb-introspect:find-definition-source function) + (destructuring-bind (&key emacs-buffer emacs-position emacs-string) info + (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))))))) -;; FIXME: Symbol doesn't exist in released SBCL yet. +;; FIXME: Symbol doesn't exist in released SBCL (0.8.20) yet. (defun definition-source-file-write-date (def) (let ((sym (find-symbol "DEFINITION-SOURCE-FILE-WRITE-DATE" (find-package "SB-INTROSPECT")))) @@ -493,9 +534,14 @@ (let ((methods (sb-mop:generic-function-methods gf)) (name (sb-mop:generic-function-name gf))) (loop for method in methods - collect (list `(method ,name ,(sb-pcl::unparse-specializers method)) - (safe-function-source-location method name))))) + collect (list `(method ,name ,(sb-pcl::unparse-specializers method)) + (method-source-location method))))) +(defun method-source-location (method) + (safe-function-source-location (or (sb-pcl::method-fast-function method) + (sb-pcl:method-function method)) + nil)) + ;;;;; Compiler definitions (defun compiler-definitions (name) @@ -630,7 +676,7 @@ (let ((print-sym (find-symbol "PRINT-FRAME-CALL" :sb-debug))) (if (fboundp print-sym) (let* ((args (sb-introspect:function-arglist print-sym)) - (key-pos (position '&key args))) + (key-pos (position '&key args))) (cond ((eql 2 key-pos) `(,print-sym frame stream)) ((eql 1 key-pos) @@ -681,11 +727,10 @@ (defun source-file-source-location (code-location) (let* ((code-date (code-location-debug-source-created code-location)) (filename (code-location-debug-source-name code-location)) - (source-code (get-source-code filename code-date)) - (cloc code-location)) + (source-code (get-source-code filename code-date))) (with-input-from-string (s source-code) (make-location `(:file ,filename) - `(:position ,(1+ (stream-source-position cloc s))) + `(:position ,(1+(stream-source-position code-location s))) `(:snippet ,(read-snippet s)))))) (defun string-source-position (code-location string) @@ -730,7 +775,7 @@ (defun stream-source-position (code-location stream) (let* ((cloc (sb-debug::maybe-block-start-location code-location)) - (tlf-number (sb-di::code-location-toplevel-form-offset cloc)) + (tlf-number (1- (sb-di::code-location-toplevel-form-offset cloc))) (form-number (sb-di::code-location-form-number cloc))) (multiple-value-bind (tlf pos-map) (read-source-form tlf-number stream) (let* ((path-table (sb-di::form-number-translations tlf 0)) @@ -766,8 +811,10 @@ (printer-form))) (defun safe-source-location-for-emacs (code-location) - (handler-case (code-location-source-location code-location) - (error (c) (list :error (format nil "~A" c))))) + (if *debug-definition-finding* + (code-location-source-location code-location) + (handler-case (code-location-source-location code-location) + (error (c) (list :error (format nil "~A" c)))))) (defimplementation frame-source-location-for-emacs (index) (safe-source-location-for-emacs @@ -868,59 +915,36 @@ (defmethod inspect-for-emacs ((o t) (inspector sbcl-inspector)) (declare (ignore inspector)) (cond ((sb-di::indirect-value-cell-p o) - (values "A value cell." - `("Value: " (:value ,(sb-kernel:value-cell-ref o))))) + (values "A value cell." (label-value-line* + (:value (sb-kernel:value-cell-ref o))))) (t - (multiple-value-bind (text labeledp parts) - (sb-impl::inspected-parts o) - (if labeledp - (values text - (loop for (label . value) in parts - collect `(:value ,label) - collect " = " - collect `(:value ,value) - collect '(:newline))) - (values text - (loop for value in parts - for i from 0 - collect (princ-to-string i) - collect " = " - collect `(:value ,value) - collect '(:newline)))))))) + (multiple-value-bind (text label parts) (sb-impl::inspected-parts o) + (if label + (values text (loop for (l . v) in parts + append (label-value-line l v))) + (values text (loop for value in parts for i from 0 + append (label-value-line i value)))))))) (defmethod inspect-for-emacs ((o function) (inspector sbcl-inspector)) (declare (ignore inspector)) (let ((header (sb-kernel:widetag-of o))) (cond ((= header sb-vm:simple-fun-header-widetag) - (values "A simple-fun." - `("Name: " (:value ,(sb-kernel:%simple-fun-name o)) - (:newline) - "Arglist: " (:value ,(sb-kernel:%simple-fun-arglist o)) - (:newline) - ,@(when (documentation o t) - `("Documentation: " (:newline) ,(documentation o t) (:newline))) - "Self: " (:value ,(sb-kernel:%simple-fun-self o)) - (:newline) - "Next: " (:value ,(sb-kernel:%simple-fun-next o)) - (:newline) - "Type: " (:value ,(sb-kernel:%simple-fun-type o)) - (:newline) - "Code Object: " (:value ,(sb-kernel:fun-code-header o))))) + (values "A simple-fun." + (label-value-line* + (:name (sb-kernel:%simple-fun-name o)) + (:arglist (sb-kernel:%simple-fun-arglist o)) + (:self (sb-kernel:%simple-fun-self o)) + (:next (sb-kernel:%simple-fun-next o)) + (:type (sb-kernel:%simple-fun-type o)) + (:code (sb-kernel:fun-code-header o))))) ((= header sb-vm:closure-header-widetag) (values "A closure." - `("Function: " (:value ,(sb-kernel:%closure-fun o)) - (:newline) - ,@(when (documentation o t) - `("Documentation: " (:newline) ,(documentation o t) (:newline))) - "Closed over values:" - (:newline) - ,@(loop for i from 0 - below (- (sb-kernel:get-closure-length o) - (1- sb-vm:closure-info-offset)) - collect (princ-to-string i) - collect " = " - collect `(:value ,(sb-kernel:%closure-index-ref o i)) - collect '(:newline))))) + (append + (label-value-line :function (sb-kernel:%closure-fun o)) + `("Closed over values:" (:newline)) + (loop for i below (1- (sb-kernel:get-closure-length o)) + append (label-value-line + i (sb-kernel:%closure-index-ref o i)))))) (t (call-next-method o))))) (defmethod inspect-for-emacs ((o sb-kernel:code-component) (_ sbcl-inspector)) @@ -946,7 +970,8 @@ (sb-disassem::align (+ (logandc2 (sb-kernel:get-lisp-obj-address o) sb-vm:lowtag-mask) - (* sb-vm:code-constants-offset sb-vm:n-word-bytes)) + (* sb-vm:code-constants-offset + sb-vm:n-word-bytes)) (ash 1 sb-vm:n-lowtag-bits)) (ash (sb-kernel:%code-code-size o) sb-vm:word-shift) :stream s)))))))) @@ -954,22 +979,21 @@ (defmethod inspect-for-emacs ((o sb-kernel:fdefn) (inspector sbcl-inspector)) (declare (ignore inspector)) (values "A fdefn object." - `("Name: " (:value ,(sb-kernel:fdefn-name o)) - (:newline) - "Function" (:value,(sb-kernel:fdefn-fun o)) - (:newline) - ,@(when (documentation o t) - `("Documentation: " (:newline) ,(documentation o t) (:newline)))))) + (label-value-line* + (:name (sb-kernel:fdefn-name o)) + (:function (sb-kernel:fdefn-fun o))))) -(defmethod inspect-for-emacs :around ((o generic-function) (inspector sbcl-inspector)) +(defmethod inspect-for-emacs :around ((o generic-function) + (inspector sbcl-inspector)) (declare (ignore inspector)) - (multiple-value-bind (title contents) - (call-next-method) + (multiple-value-bind (title contents) (call-next-method) (values title - (append contents - `("Pretty arglist: " (:value ,(sb-pcl::generic-function-pretty-arglist o)) - (:newline) - "Initial methods: " (:value ,(sb-pcl::generic-function-initial-methods o))))))) + (append + contents + (label-value-line* + (:pretty-arglist (sb-pcl::generic-function-pretty-arglist o)) + (:initial-methods (sb-pcl::generic-function-initial-methods o)) + ))))) ;;;; Multiprocessing @@ -1034,6 +1058,9 @@ (defimplementation kill-thread (thread) (sb-thread:terminate-thread thread)) + (defimplementation thread-alive-p (thread) + (ignore-errors (sb-thread:interrupt-thread thread (lambda ())) t)) + (defvar *mailbox-lock* (sb-thread:make-mutex :name "mailbox lock")) (defvar *mailboxes* (list)) (declaim (type list *mailboxes*)) @@ -1071,6 +1098,12 @@ mutex)))))))) ) + +(defimplementation quit-lisp () + #+sb-thread + (dolist (thread (remove (current-thread) (all-threads))) + (ignore-errors (sb-thread:terminate-thread thread))) + (sb-ext:quit)) ;;Trace implementations From heller at common-lisp.net Mon Mar 21 00:58:16 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 01:58:16 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-cmucl.lisp Message-ID: <20050321005816.E8947886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6222 Modified Files: swank-cmucl.lisp Log Message: (call-with-debugging-environment): Rebind kernel:*current-level* 0. Useful for debugging pretty printer code. (inspect-for-emacs): Show details of interpreted functions. Date: Mon Mar 21 01:58:16 2005 Author: heller Index: slime/swank-cmucl.lisp diff -u slime/swank-cmucl.lisp:1.141 slime/swank-cmucl.lisp:1.142 --- slime/swank-cmucl.lisp:1.141 Sat Mar 12 02:49:19 2005 +++ slime/swank-cmucl.lisp Mon Mar 21 01:58:15 2005 @@ -696,12 +696,10 @@ "Resolve the source location for CODE-LOCATION in FILENAME." (let* ((code-date (di:debug-source-created debug-source)) (source-code (get-source-code filename code-date))) - (make-location (list :file (unix-truename filename)) nil) (with-input-from-string (s source-code) (make-location (list :file (unix-truename filename)) - (list :position - (1+ (code-location-stream-position - code-location s))) + (list :position (1+ (code-location-stream-position + code-location s))) `(:snippet ,(read-snippet s)))))) (defun location-in-stream (code-location debug-source) @@ -1427,7 +1425,8 @@ (defimplementation call-with-debugging-environment (debugger-loop-fn) (unix:unix-sigsetmask 0) (let* ((*sldb-stack-top* (or debug:*stack-top-hint* (di:top-frame))) - (debug:*stack-top-hint* nil)) + (debug:*stack-top-hint* nil) + (kernel:*current-level* 0)) (handler-bind ((di::unhandled-condition (lambda (condition) (error (make-condition @@ -1637,7 +1636,9 @@ (let ((info (di:breakpoint-info breakpoint))) (if (vectorp info) (known-return-point-values sc info) - (list "<>")))) + (progn + ;;(break) + (list "<>" info))))) (:unknown-return (let ((mv-return-pc (di::compiled-code-location-pc cl))) (if (= mv-return-pc *breakpoint-pc*) @@ -1850,7 +1851,9 @@ (loop for i from 0 below (1- (kernel:get-closure-length o)) append (label-value-line i (kernel:%closure-index-ref o i)))))) - (t + ((eval::interpreted-function-p o) + (cmucl-inspect o)) + (t (call-next-method))))) From heller at common-lisp.net Mon Mar 21 00:58:48 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 01:58:48 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20050321005848.A7D6C886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6244 Modified Files: swank.lisp Log Message: (commit-edited-value): Use buffer syntax. (compile-file-for-emacs, compile-string-for-emacs): Bind *compile-print* to nil. Date: Mon Mar 21 01:58:47 2005 Author: heller Index: slime/swank.lisp diff -u slime/swank.lisp:1.288 slime/swank.lisp:1.289 --- slime/swank.lisp:1.288 Wed Mar 16 23:03:18 2005 +++ slime/swank.lisp Mon Mar 21 01:58:46 2005 @@ -1784,8 +1784,9 @@ (defslimefun commit-edited-value (form value) "Set the value of a setf'able FORM to VALUE. FORM and VALUE are both strings from Emacs." - (eval `(setf ,(read-from-string form) ',(read-from-string value))) - t) + (with-buffer-syntax () + (eval `(setf ,(read-from-string form) ',(read-from-string value))) + t)) ;;;; Debugger @@ -2071,7 +2072,8 @@ "Compile FILENAME and, when LOAD-P, load the result. Record compiler notes signalled as `compiler-condition's." (with-buffer-syntax () - (swank-compiler (lambda () (swank-compile-file filename load-p))))) + (let ((*compile-print* nil)) + (swank-compiler (lambda () (swank-compile-file filename load-p)))))) (defslimefun compile-string-for-emacs (string buffer position directory) "Compile STRING (exerpted from BUFFER at POSITION). @@ -2079,8 +2081,9 @@ (with-buffer-syntax () (swank-compiler (lambda () - (swank-compile-string string :buffer buffer :position position - :directory directory))))) + (let ((*compile-print* nil) (*compile-verbose* t)) + (swank-compile-string string :buffer buffer :position position + :directory directory)))))) (defslimefun operate-on-system-for-emacs (system-name operation &rest keywords) "Compile and load SYSTEM using ASDF. From heller at common-lisp.net Mon Mar 21 00:59:09 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 01:59:09 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050321005909.BC047886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv6265 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Mar 21 01:59:08 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.644 slime/ChangeLog:1.645 --- slime/ChangeLog:1.644 Mon Mar 21 01:43:23 2005 +++ slime/ChangeLog Mon Mar 21 01:59:08 2005 @@ -1,3 +1,31 @@ +2005-03-20 Helmut Eller + + * swank-sbcl.lisp (quit-lisp): If we are running multithreaded, + terminate all other threads too. (still broken in 0.8.20.27; used + to work in ~0.8.20.2.) + (with-debootstrapping, call-with-debootstrapping): Remove ugly + backward compatibility code. + (sbcl-source-file-p, guess-readtable-for-filename): New utilities. + (function-source-location): Handle work off to helper functions. + (find-function-source-location): New function. Use the + shebang-readtable for SBCL source files. + (function-source-position, function-source-filename) + (function-source-write-date, function-toplevel-form-number) + (function-hint-snippet, function-has-start-location-p) + (function-start-location): New helpers. + (safe-source-location-for-emacs): Don't catch errors if + *debug-definition-finding* is true. + (inspect-for-emacs): Minor beautifications. + + * swank.lisp (commit-edited-value): Use buffer syntax. + (compile-file-for-emacs, compile-string-for-emacs): Bind + *compile-print* to nil. + + * swank-cmucl.lisp (call-with-debugging-environment): Rebind + kernel:*current-level* 0. Useful for debugging pretty printer + code. + (inspect-for-emacs): Show details of interpreted functions. + 2005-03-21 Luke Gorrie * swank-sbcl.lisp (function-source-location): For definitions From heller at common-lisp.net Mon Mar 21 11:03:14 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 12:03:14 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050321110314.ACEF188665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv8339 Modified Files: swank-sbcl.lisp Log Message: (locate-compiler-note): Handle errors in macros better. Date: Mon Mar 21 12:03:12 2005 Author: heller Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.126 slime/swank-sbcl.lisp:1.127 --- slime/swank-sbcl.lisp:1.126 Mon Mar 21 01:57:27 2005 +++ slime/swank-sbcl.lisp Mon Mar 21 12:03:11 2005 @@ -279,11 +279,13 @@ (defun compiler-note-location (context) (if context - (with-struct (sb-c::compiler-error-context- file-name) context - (locate-compiler-note file-name (compiler-source-path context))) + (locate-compiler-note + (sb-c::compiler-error-context-file-name context) + (compiler-source-path context) + (sb-c::compiler-error-context-original-source context)) (list :error "No error location available"))) -(defun locate-compiler-note (file source-path) +(defun locate-compiler-note (file source-path source) (cond ((and (pathnamep file) *buffer-name*) ;; Compiling from a buffer (let ((position (+ *buffer-offset* @@ -297,6 +299,10 @@ (list :position (1+ (source-path-file-position source-path file))))) + ((and (eq file :lisp) (stringp source)) + ;; Compiling macro generated code + (make-location (list :source-form source) + (list :position 1))) (t (error "unhandled case")))) @@ -459,7 +465,7 @@ (find-function-source-location function))) (defun find-function-source-location (function) - (cond #+(or) ;; doesn't work unknown reasons + (cond #+(or) ;; doesn't work for unknown reasons ((function-has-start-location-p function) (code-location-source-location (function-start-location function))) ((not (function-source-filename function)) From heller at common-lisp.net Mon Mar 21 11:04:12 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 12:04:12 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050321110412.74EF588665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv8515 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Mar 21 12:04:09 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.645 slime/ChangeLog:1.646 --- slime/ChangeLog:1.645 Mon Mar 21 01:59:08 2005 +++ slime/ChangeLog Mon Mar 21 12:04:06 2005 @@ -1,3 +1,8 @@ +2005-03-21 Helmut Eller + + * swank-sbcl.lisp (locate-compiler-note): Handle errors in macros + better. + 2005-03-20 Helmut Eller * swank-sbcl.lisp (quit-lisp): If we are running multithreaded, From heller at common-lisp.net Mon Mar 21 17:40:12 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 18:40:12 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-source-file-cache.lisp Message-ID: <20050321174012.3ECCA88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv31662 Modified Files: swank-source-file-cache.lisp Log Message: (read-snippet): Take the start position as optional argument. Date: Mon Mar 21 18:40:11 2005 Author: heller Index: slime/swank-source-file-cache.lisp diff -u slime/swank-source-file-cache.lisp:1.2 slime/swank-source-file-cache.lisp:1.3 --- slime/swank-source-file-cache.lisp:1.2 Sun Mar 13 04:01:30 2005 +++ slime/swank-source-file-cache.lisp Mon Mar 21 18:40:10 2005 @@ -85,8 +85,11 @@ the definitions looks like, so that it can accurately find them by text search.") -(defun read-snippet (stream) - "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM." +(defun read-snippet (stream &optional position) + "Read a string of upto *SOURCE-SNIPPET-SIZE* characters from STREAM. +If POSITION is given, set the STREAM's file position first." + (when position + (file-position stream position)) #+SBCL (skip-comments-and-whitespace stream) (read-upto-n-chars stream *source-snippet-size*)) From heller at common-lisp.net Mon Mar 21 17:40:41 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 18:40:41 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-sbcl.lisp Message-ID: <20050321174041.26F4A88665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv31692 Modified Files: swank-sbcl.lisp Log Message: (source-file-source-location): Read the snippet at the right position. Date: Mon Mar 21 18:40:40 2005 Author: heller Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.127 slime/swank-sbcl.lisp:1.128 --- slime/swank-sbcl.lisp:1.127 Mon Mar 21 12:03:11 2005 +++ slime/swank-sbcl.lisp Mon Mar 21 18:40:40 2005 @@ -505,8 +505,7 @@ (let ((source (get-source-code (function-source-filename function) (function-source-write-date function)))) (with-input-from-string (s source) - (file-position s position) - (read-snippet s)))) + (read-snippet s position)))) (defun function-has-start-location-p (function) (ignore-errors (function-start-location function))) @@ -724,8 +723,7 @@ (destructuring-bind (&key emacs-buffer emacs-position emacs-string) info (let* ((pos (string-source-position code-location emacs-string)) (snipped (with-input-from-string (s emacs-string) - (file-position s pos) - (read-snippet s)))) + (read-snippet s pos)))) (make-location `(:buffer ,emacs-buffer) `(:position ,(+ emacs-position pos)) `(:snippet ,snipped)))))) @@ -735,13 +733,11 @@ (filename (code-location-debug-source-name code-location)) (source-code (get-source-code filename code-date))) (with-input-from-string (s source-code) + (let* ((pos (stream-source-position code-location s)) + (snippet (read-snippet s pos))) (make-location `(:file ,filename) - `(:position ,(1+(stream-source-position code-location s))) - `(:snippet ,(read-snippet s)))))) - -(defun string-source-position (code-location string) - (with-input-from-string (s string) - (stream-source-position code-location s))) + `(:position ,(1+ pos)) + `(:snippet ,snippet)))))) (defun code-location-debug-source-info (code-location) (sb-c::debug-source-info (sb-di::code-location-debug-source code-location))) @@ -781,14 +777,20 @@ (defun stream-source-position (code-location stream) (let* ((cloc (sb-debug::maybe-block-start-location code-location)) - (tlf-number (1- (sb-di::code-location-toplevel-form-offset cloc))) + (tlf-number (sb-di::code-location-toplevel-form-offset cloc)) (form-number (sb-di::code-location-form-number cloc))) (multiple-value-bind (tlf pos-map) (read-source-form tlf-number stream) (let* ((path-table (sb-di::form-number-translations tlf 0)) - (source-path (if (<= (length path-table) form-number) - (list 0) ; file is out of sync - (reverse (cdr (aref path-table form-number)))))) - (source-path-source-position source-path tlf pos-map))))) + (path (cond ((<= (length path-table) form-number) + (warn "inconsistend form-number-translations") + (list 0)) + (t + (reverse (cdr (aref path-table form-number))))))) + (source-path-source-position path tlf pos-map))))) + +(defun string-source-position (code-location string) + (with-input-from-string (s string) + (stream-source-position code-location s))) ;;; source-path-file-position and friends are in swank-source-path-parser From heller at common-lisp.net Mon Mar 21 17:40:56 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 21 Mar 2005 18:40:56 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050321174056.CFAE788665@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv31713 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Mar 21 18:40:56 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.646 slime/ChangeLog:1.647 --- slime/ChangeLog:1.646 Mon Mar 21 12:04:06 2005 +++ slime/ChangeLog Mon Mar 21 18:40:55 2005 @@ -2,8 +2,13 @@ * swank-sbcl.lisp (locate-compiler-note): Handle errors in macros better. + (source-file-source-location): Read the snippet at the right + position. -2005-03-20 Helmut Eller + * swank-source-file-cache.lisp (read-snippet): Take the start + position as optional argument. + +2005-03-21 Helmut Eller * swank-sbcl.lisp (quit-lisp): If we are running multithreaded, terminate all other threads too. (still broken in 0.8.20.27; used From heller at common-lisp.net Tue Mar 22 10:12:23 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Mar 2005 11:12:23 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-lispworks.lisp Message-ID: <20050322101223.B0B8B886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv23507 Modified Files: swank-lispworks.lisp Log Message: (swank-compile-string): Bind *print-radix* to t, to avoid problems if somebody uses different values for *print-base* and *read-base*. Reported by Alain Picard. (emacs-connected): Add default methods for environment-display-notifier and environment-display-debugger. Date: Tue Mar 22 11:12:20 2005 Author: heller Index: slime/swank-lispworks.lisp diff -u slime/swank-lispworks.lisp:1.67 slime/swank-lispworks.lisp:1.68 --- slime/swank-lispworks.lisp:1.67 Tue Mar 1 00:32:06 2005 +++ slime/swank-lispworks.lisp Tue Mar 22 11:12:19 2005 @@ -520,9 +520,12 @@ (tmpname (hcl:make-temp-file nil "lisp"))) (with-swank-compilation-unit (location) (compile-from-temp-file - (format nil "~S~%~A" `(eval-when (:compile-toplevel) - (setq dspec::*location* (list , at location))) - string) + (with-output-to-string (s) + (let ((*print-radix* t)) + (print `(eval-when (:compile-toplevel) + (setq dspec::*location* (list , at location))) + s)) + (write-string string s)) tmpname)))) ;;; xref @@ -535,7 +538,7 @@ (defxref who-macroexpands hcl:who-calls) ; macros are in the calls table too (defxref calls-who hcl:calls-who) (defxref list-callers list-callers-internal) -(defxref list-callees list-callees-internal) +;; (defxref list-callees list-callees-internal) (defun list-callers-internal (name) (let ((callers (make-array 100 @@ -700,7 +703,16 @@ (defimplementation emacs-connected () (when (eq (eval (swank-sym :*communication-style*)) nil) - (set-sigint-handler))) + (set-sigint-handler)) + ;; pop up the slime debugger by default + (let ((lw:*handle-warn-on-redefinition* :warn)) + (defmethod env-internals:environment-display-notifier + (env &key restarts condition) + (declare (ignore restarts)) + (funcall (find-symbol (string :swank-debugger-hook) :swank) + condition *debugger-hook*)) + (defmethod env-internals:environment-display-debugger (env) + *debug-io*))) (defimplementation make-stream-interactive (stream) (unless (find-method #'stream:stream-soft-force-output nil `((eql ,stream)) From heller at common-lisp.net Tue Mar 22 10:13:37 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 22 Mar 2005 11:13:37 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050322101337.F1A92886FB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv23544 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Tue Mar 22 11:13:34 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.647 slime/ChangeLog:1.648 --- slime/ChangeLog:1.647 Mon Mar 21 18:40:55 2005 +++ slime/ChangeLog Tue Mar 22 11:13:32 2005 @@ -1,3 +1,11 @@ +2005-03-22 Helmut Eller + + * swank-lispworks.lisp (swank-compile-string): Bind *print-radix* + to t, to avoid problems if somebody uses different values for + *print-base* and *read-base*. Reported by Alain Picard. + (emacs-connected): Add default methods for + environment-display-notifier and environment-display-debugger. + 2005-03-21 Helmut Eller * swank-sbcl.lisp (locate-compiler-note): Handle errors in macros From mbaringer at common-lisp.net Wed Mar 23 12:23:06 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Wed, 23 Mar 2005 13:23:06 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/swank.lisp Message-ID: <20050323122306.175A68866D@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv17373 Modified Files: swank.lisp Log Message: (commit-edited-value): Read a backquated string, instead of quating the result of read. This allows one to put ,(form) into edit-value buffers. Date: Wed Mar 23 13:23:06 2005 Author: mbaringer From mbaringer at common-lisp.net Wed Mar 23 12:23:27 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Wed, 23 Mar 2005 13:23:27 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/ChangeLog Message-ID: <20050323122327.C36968866D@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv17401 Modified Files: ChangeLog Log Message: Date: Wed Mar 23 13:23:26 2005 Author: mbaringer From heller at common-lisp.net Sun Mar 27 18:40:53 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sun, 27 Mar 2005 20:40:53 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/swank-clisp.lisp Message-ID: <20050327184053.390AF88678@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv14429 Modified Files: swank-clisp.lisp Log Message: *** empty log message *** Date: Sun Mar 27 20:40:52 2005 Author: heller Index: slime/swank-clisp.lisp diff -u slime/swank-clisp.lisp:1.45 slime/swank-clisp.lisp:1.46 --- slime/swank-clisp.lisp:1.45 Wed Dec 15 23:35:20 2004 +++ slime/swank-clisp.lisp Sun Mar 27 20:40:51 2005 @@ -82,7 +82,10 @@ #+unix (defmethod getpid () - (system::program-id)) + (funcall (or (find-symbol "PROGRAM-ID" :system) + (find-symbol "PROCESS-ID" :system) + (error "getpid not implemented")))) + #+win32 (defmethod getpid () (cond ((find-package :win32) @@ -333,7 +336,7 @@ (defmacro dynamic-flet (names-functions &body body) "(dynamic-flet ((NAME FUNCTION) ...) BODY ...) -Execute BODY with NAME's funtion slot set to FUNCTION." +Execute BODY with NAME's function slot set to FUNCTION." `(ext:letf* ,(loop for (name function) in names-functions collect `((symbol-function ',name) ,function)) , at body)) From heller at common-lisp.net Sun Mar 27 18:41:17 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sun, 27 Mar 2005 20:41:17 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050327184117.BA80D88678@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv14464 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Sun Mar 27 20:41:16 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.649 slime/ChangeLog:1.650 --- slime/ChangeLog:1.649 Wed Mar 23 13:23:26 2005 +++ slime/ChangeLog Sun Mar 27 20:41:16 2005 @@ -1,3 +1,8 @@ +2005-03-27 Russell McManus + + * swank-clisp.lisp (getpid): Try sys::process-id if + sys::program-id doesn't exist. + 2005-03-23 Marco Baringer * swank.lisp (commit-edited-value): Read a backquated string, From heller at common-lisp.net Sun Mar 27 19:06:38 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sun, 27 Mar 2005 21:06:38 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/doc/slime.texi Message-ID: <20050327190638.6127788672@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory common-lisp.net:/tmp/cvs-serv16200 Modified Files: slime.texi Log Message: Mention Unicode support and some multi-threading issues. Date: Sun Mar 27 21:06:33 2005 Author: heller Index: slime/doc/slime.texi diff -u slime/doc/slime.texi:1.32 slime/doc/slime.texi:1.33 --- slime/doc/slime.texi:1.32 Wed Oct 6 00:15:07 2004 +++ slime/doc/slime.texi Sun Mar 27 21:06:31 2005 @@ -45,8 +45,8 @@ @code{\command\}@* @end macro - at set EDITION 1.0 - at set UPDATED @code{$Date: 2004/10/05 22:15:07 $} + at set EDITION 1.2 + at set UPDATED @code{$Date: 2005/03/27 19:06:31 $} @titlepage @title SLIME User Manual @@ -65,7 +65,7 @@ @top SLIME @SLIME{} is the ``Superior Lisp Interaction Mode for Emacs''. This is -the manual for version 1.0. +the manual for version 1.2. @end ifinfo @menu @@ -210,17 +210,17 @@ @itemize @bullet @item -CMU Common Lisp (@acronym{CMUCL}) +CMU Common Lisp (@acronym{CMUCL}), 18e or newer @item -Steel Bank Common Lisp (@acronym{SBCL}) +Steel Bank Common Lisp (@acronym{SBCL}), from version 0.8.15 to 0.8.20 @item -OpenMCL +OpenMCL, version 0.14.3 @item -LispWorks +LispWorks, version 4.3 or newer @item -Allegro Common Lisp (@acronym{ACL}) +Allegro Common Lisp (@acronym{ACL}), version 4.3 or newer @item - at acronym{CLISP} + at acronym{CLISP}, version 2.33.2 or newer @item Armed Bear Common Lisp (@acronym{ABCL}) @end itemize @@ -363,6 +363,7 @@ * Temporary buffers:: * Key bindings:: * inferior-lisp:: +* Multithreading:: @end menu @node Temporary buffers, Key bindings, User-interface conventions, User-interface conventions @@ -411,7 +412,7 @@ C-h} will actually list the bindings for all documentation commands. This feature is just a bit too useful to clobber! - at node inferior-lisp, , Key bindings, User-interface conventions + at node inferior-lisp, Multithreading, Key bindings, User-interface conventions @subsection @code{*inferior-lisp*} buffer @SLIME{} internally uses the @code{inferior-lisp} package to start @@ -438,6 +439,32 @@ doesn't belong to @SLIME{}, and you should probably lookup our equivalent. + at node Multithreading, , inferior-lisp, User-interface conventions + at subsection Multithreading + +If the Lisp system supports multithreading, SLIME spawns a new thread +for each request, e.g., @kbd{C-x C-e} creates a new thread to evaluate +the expression. An exception to this rule are requests from the + at REPL{}: all commands entered in the @REPL{} buffer are evaluated in a +dedicated @REPL{} thread. + +Some complications arise with multithreading and special variables. +Non-global special bindings are thread-local, e.g., changing the value +of a let bound special variable in one thread has no effect on the +binding of the variables with the same name in other threads. This +makes it sometimes difficult to change the printer or reader behaviour +for new threads. The variable + at code{swank:*default-worker-thread-bindings*} was introduced for such +situtuations: instead of modifying the global value of a variable, add a +binding the @code{swank:*default-worker-thread-bindings*}. E.g., with +the following code, new threads will read floating point values as +doubles by default: + + at example +(push '(*read-default-float-format* . double-float) + swank:*default-worker-thread-bindings*). + at end example + @node Commands, Semantic indentation, User-interface conventions, slime-mode @section Commands @@ -523,7 +550,7 @@ @kbditem{C-M-x, slime-eval-defun} Evaluate top-level form. - at kbditem{C-c C-e, slime-eval-last-expression} + at kbditem{C-x C-e, slime-eval-last-expression} Evaluate the expression before point. @kbditem{C-c C-p, slime-pprint-eval-last-expression} @@ -542,6 +569,10 @@ @end table +If `C-M-x' or `C-x C-e' is given a numeric argument, it inserts the +value into the current buffer at point, rather than displaying it in the +echo area. + @node Documentation, Programming Helpers, Lisp Evaluation, Commands @subsection Documentation @@ -609,13 +640,16 @@ function at point, if there is one. @kbditem{C-c C-m, slime-macroexpand-1} -Macroexpand the expression at point once. +Macroexpand the expression at point once. If invoked with a prefix +argument, use macroexpand instead of macroexpand-1. @kbditem{C-c M-m, slime-macroexpand-all} Fully macroexpand the expression at point. @kbditem{C-c C-t, slime-toggle-trace-fdefinition} -Toggle tracing of the function at point. +Toggle tracing of the function at point. If invoked with a prefix +argument, read additional information, like which particular method +should be traced. @kbditem{C-c M-d, slime-disassemble-symbol} Disassemble the function definition of the symbol at point. @@ -945,9 +979,6 @@ @kbditem{i, sldb-inspect-in-frame} Inspect the result of evaluating an expression in the frame. - at kbditem{l, sldb-list-locals} -List the local variables and their bindings in the frame. - @end table @node Restarts, Frame Navigation, Examining frames, Debugger @@ -1192,6 +1223,16 @@ structure (different ``mount points''). This is most common with @acronym{SMB}-based file sharing. + at item slime-net-coding-system +If you want to transmit Unicode characters between Emacs and the Lisp +system, you should customize this variable. E.g., if you use SBCL, you +can set @code{slime-net-coding-system} to @code{utf-8-unix}. To +actually display a Unicode character you also need apropriate fonts, +otherwise the character will be rendered as a hollow box. If you are +using Allegro CL and GNU Emacs, you can also use @code{emacs-mule-unix} +as coding system. GNU Emacs has often nicer fonts for the later +encoding. + @end table @menu @@ -1311,9 +1352,17 @@ to handle all debugging in the Lisp image. This is for debugging multithreaded and callback-driven applications. - at item SWANK:*SLDB-PPRINT-FRAMES* - at code{*PRINT-PRETTY*} is bound to this value while formatting -backtraces in @SLDB{}. The default value is @code{NIL}. + at item SWANK:*SLDB-PRINTER-BINDINGS* + at item SWANK:*MACROEXPAND-PRINTER-BINDINGS* + at item SWANK:*SWANK-PPRINT-BINDINGS* +These variables can be used to customize the printer in various +situations. The values of the variables are association lists of +printer variable names with the corresponding value. E.g., to enable +the pretty printer for formatting backtraces in @SLDB{}, you can use: + + at example +(push '(*print-pretty* . t) swank:*sldb-printer-bindings*). + at end example @item SWANK:*USE-DEDICATED-OUTPUT-STREAM* This variable controls an optimization for sending printed output from From heller at common-lisp.net Sun Mar 27 19:41:18 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sun, 27 Mar 2005 21:41:18 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/NEWS Message-ID: <20050327194118.9D3E088672@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv17964 Modified Files: NEWS Log Message: *** empty log message *** Date: Sun Mar 27 21:41:18 2005 Author: heller Index: slime/NEWS diff -u slime/NEWS:1.7 slime/NEWS:1.8 --- slime/NEWS:1.7 Sat Sep 4 00:10:26 2004 +++ slime/NEWS Sun Mar 27 21:41:17 2005 @@ -1,5 +1,37 @@ * SLIME News -*- outline -*- +* 1.2 (March 2005) + +** New inspector +The lisp side now returns a specially formated list of "things" to +format which are then passed to emacs and rendered in the inspector +buffer. Things can be either text, recursivly inspectable values, or +functions to call. The new inspector has much better support CLOS +objects and methods. + +** Unicode +It's now possible to send non-ascii characters to Emacs, if the +communication channel is configured properly. See the variable +`slime-net-coding-system'. + +** Arglist lookup while debugging +Previously, arglist lookup was disabled while debugging. This +restriction was removed. + +** Extended tracing command +It's now possible to trace individual a single methods or all methods +of a generic function. Also tracing can be restricted to situations +in which the traced function is called from a specific function. + +** M-x slime-browse-classes +A simple class browser was added. + +** FASL files +The fasl files for different Lisp/OS/hardware combinations are now +placed in different directories. + +** Many other small improvements and bugfixes + * 1.0 (September 2004) ** slime-interrupt From heller at common-lisp.net Sun Mar 27 19:41:47 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sun, 27 Mar 2005 21:41:47 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/PROBLEMS Message-ID: <20050327194147.951DB88672@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv18005 Modified Files: PROBLEMS Log Message: *** empty log message *** Date: Sun Mar 27 21:41:46 2005 Author: heller Index: slime/PROBLEMS diff -u slime/PROBLEMS:1.3 slime/PROBLEMS:1.4 --- slime/PROBLEMS:1.3 Tue Aug 31 00:28:16 2004 +++ slime/PROBLEMS Sun Mar 27 21:41:46 2005 @@ -21,7 +21,8 @@ ** SBCL -We require SBCL 0.8.13 or higher. +SBCL versions from 0.8.15 to 0.8.20 should work. Newer SBCL's may or +may not work. 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 @@ -30,25 +31,18 @@ The XREF commands are not implemented. -When using the :SPAWN communication style (the default on x86 if -threads are available) disconnecting Emacs from Lisp will leave two -threads hanging around. - ** OpenMCL -We support OpenMCL 0.14.2p1, however our debugger can't invoke -restarts in this version due to a bug in -INVOKE-RESTART-INTERACTIVELY. This bug has been fixed in OpenMCL's CVS -repository and we recommend upgrading to either the CVS copy or a -later release if available. +We support OpenMCL 0.14.3. The XREF commands are not available. ** LispWorks -In LispWorks on OSX it is necessary to remove the :ADDRESS argument to -CREATE-SOCKET in swank-lispworks.lisp. This is a workaround for a -LispWorks bug. +On Windows, SLIME hangs when calling foreign functions or certain +other functions. The reason for this problem is unknown. + +We only support latin1 encoding. (Unicode wouldn't be hard to add.) ** Allegro CL @@ -58,10 +52,15 @@ ** CLISP -We require version 2.32 or higher. We also require socket support, so +We require version 2.33.2 or higher. We also require socket support, so you may have to start CLISP with "clisp -K full". -The backtrace for compiled functions is not very informative. +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 +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. M-. (find-definition) only works if the fasl file is in the same From heller at common-lisp.net Sun Mar 27 19:42:56 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sun, 27 Mar 2005 21:42:56 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20050327194256.81EF488672@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv18038 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Sun Mar 27 21:42:55 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.650 slime/ChangeLog:1.651 --- slime/ChangeLog:1.650 Sun Mar 27 20:41:16 2005 +++ slime/ChangeLog Sun Mar 27 21:42:54 2005 @@ -1,3 +1,8 @@ +2005-03-27 Helmut Eller + + * PROBLEMS, NEWS, doc/slime.texi: Some updates for the upcoming + release. + 2005-03-27 Russell McManus * swank-clisp.lisp (getpid): Try sys::process-id if From lgorrie at common-lisp.net Thu Mar 31 19:33:44 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 31 Mar 2005 21:33:44 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20050331193344.6353388672@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv27031 Modified Files: slime.el Log Message: (slime-selector): Removed unneeded "the" prefixes in descriptions of what the selector methods do. Date: Thu Mar 31 21:33:41 2005 Author: lgorrie Index: slime/slime.el diff -u slime/slime.el:1.473 slime/slime.el:1.474 --- slime/slime.el:1.473 Fri Mar 18 20:27:31 2005 +++ slime/slime.el Thu Mar 31 21:33:40 2005 @@ -7507,7 +7507,7 @@ #'< :key #'car))) -(def-slime-selector-method ?? "the Select help buffer." +(def-slime-selector-method ?? "Selector help buffer." (ignore-errors (kill-buffer "*Select Help*")) (with-current-buffer (get-buffer-create "*Select Help*") (insert "Select Methods:\n\n") @@ -7521,45 +7521,45 @@ (current-buffer)) (def-slime-selector-method ?r - "the SLIME Read-Eval-Print-Loop." + "SLIME Read-Eval-Print-Loop." (slime-output-buffer)) (def-slime-selector-method ?s - "the *slime-scratch* buffer." + "*slime-scratch* buffer." (slime-scratch-buffer)) (def-slime-selector-method ?i - "the *inferior-lisp* buffer." + "*inferior-lisp* buffer." (cond ((and (slime-connected-p) (slime-process)) (process-buffer (slime-process))) (t "*inferior-lisp*"))) (def-slime-selector-method ?v - "the *slime-events* buffer." + "*slime-events* buffer." slime-event-buffer-name) (def-slime-selector-method ?l - "the most recently visited lisp-mode buffer." + "most recently visited lisp-mode buffer." (slime-recently-visited-buffer 'lisp-mode)) (def-slime-selector-method ?d - "the *sldb* buffer for the current connection." + "*sldb* buffer for the current connection." (unless (sldb-get-default-buffer) (error "No debugger buffer")) (sldb-get-default-buffer)) (def-slime-selector-method ?e - "the most recently visited emacs-lisp-mode buffer." + "most recently visited emacs-lisp-mode buffer." (slime-recently-visited-buffer 'emacs-lisp-mode)) (def-slime-selector-method ?c - "the SLIME connections buffer." + "SLIME connections buffer." (slime-list-connections) "*SLIME connections*") (def-slime-selector-method ?t - "the SLIME threads buffer." + "SLIME threads buffer." (slime-list-threads) "*slime-threads*") From lgorrie at common-lisp.net Thu Mar 31 20:21:09 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 31 Mar 2005 22:21:09 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/doc/slime.texi Message-ID: <20050331202109.A4E2B88672@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory common-lisp.net:/tmp/cvs-serv29659 Modified Files: slime.texi Log Message: (slime-selector): New section. (Inspector): Updated for the post-1.0 inspector. Date: Thu Mar 31 22:21:08 2005 Author: lgorrie Index: slime/doc/slime.texi diff -u slime/doc/slime.texi:1.33 slime/doc/slime.texi:1.34 --- slime/doc/slime.texi:1.33 Sun Mar 27 21:06:31 2005 +++ slime/doc/slime.texi Thu Mar 31 22:21:08 2005 @@ -46,7 +46,7 @@ @end macro @set EDITION 1.2 - at set UPDATED @code{$Date: 2005/03/27 19:06:31 $} + at set UPDATED @code{$Date: 2005/03/31 20:21:08 $} @titlepage @title SLIME User Manual @@ -109,6 +109,7 @@ * Temporary buffers:: * Key bindings:: * inferior-lisp:: +* Multithreading:: Commands @@ -137,6 +138,7 @@ Extras +* slime-selector:: * slime-autodoc-mode:: * Multiple connections:: * Typeout frames:: @@ -363,7 +365,7 @@ * Temporary buffers:: * Key bindings:: * inferior-lisp:: -* Multithreading:: +* Multithreading:: @end menu @node Temporary buffers, Key bindings, User-interface conventions, User-interface conventions @@ -412,7 +414,7 @@ C-h} will actually list the bindings for all documentation commands. This feature is just a bit too useful to clobber! - at node inferior-lisp, Multithreading, Key bindings, User-interface conventions + at node inferior-lisp, Multithreading, Key bindings, User-interface conventions @subsection @code{*inferior-lisp*} buffer @SLIME{} internally uses the @code{inferior-lisp} package to start @@ -439,7 +441,7 @@ doesn't belong to @SLIME{}, and you should probably lookup our equivalent. - at node Multithreading, , inferior-lisp, User-interface conventions + at node Multithreading, , inferior-lisp, User-interface conventions @subsection Multithreading If the Lisp system supports multithreading, SLIME spawns a new thread @@ -562,6 +564,7 @@ @kbditem{C-c :, slime-interactive-eval} Evaluate an expression read from the minibuffer. + at anchor{slime-scratch} @item M-x slime-scratch Create a @file{*slime-scratch*} buffer. In this buffer you can enter Lisp expressions and evaluate them with @@ -725,19 +728,25 @@ @node Inspector, Profiling, Cross-reference, Commands @subsection Inspector -The @SLIME{} inspector is an Emacs-based version of the Lisp function - at code{INSPECT} which uses an Emacs buffer to display, navigate and -operate on lisp objects. - -The inspector can be adapted to new objects by defining an appropiate -method on the generic function @code{SWANK:INSPECT-FOR-EMACS}. +The @SLIME{} inspector is a very fancy Emacs-based alternative to the +standard @code{INSPECT} function. The inspector presents objects in +Emacs buffers using a combination of plain text, hyperlinks to related +objects, and ``actions'' that can be selected to invoke Lisp code on +the inspected object. For example, to present a generic function the +inspector shows the documentation in plain text and presents each +method with both a hyperlink to inspect the method object and a +``remove method'' action that you can invoke interactively. + +The inspector can easily be specialized for the objects in your own +programs. For details see the the @code{inspect-for-emacs} generic +function in @file{swank-backend.lisp}. @table @kbd @kbditem{C-c I, slime-inspect} Inspect the value of an expression entered in the minibuffer. @end table -The commands available in the inspector are: +The standard commands available in the inspector are: @table @kbd @@ -1055,12 +1064,48 @@ @chapter Extras @menu +* slime-selector:: * slime-autodoc-mode:: * Multiple connections:: * Typeout frames:: @end menu - at node slime-autodoc-mode, Multiple connections, Extras, Extras + at node slime-selector, slime-autodoc-mode, Extras, Extras + at section @code{slime-selector} + +The @code{slime-selector} is for quickly switching to important +buffers: the @REPL{}, @SLDB{}, the Lisp source you were just hacking, +etc. Once invoked the command prompts for a single letter to specify +which buffer it should display. Here are some of the options: + + at table @kbd + at item ? +A help buffer listing all @code{slime-selectors}'s available buffers. + at item r +The @REPL{} buffer for the current @SLIME{} connection. + at item d +The most recently activated @SLDB{} buffer for the current connection. + at item l +The most recently visited @code{lisp-mode} source buffer. + at item s +The @code{*slime-scratch*} buffer. @xref{slime-scratch}. + at end table + + at code{slime-selector} doesn't have a key binding by default but we +suggest that you assign it a global one. You can bind @kbd{C-c s} like +this: + + at example +(global-set-key "\C-cs" 'slime-selector) + at end example + +And then you can switch to the @REPL{} from anywhere with @kbd{C-c s +r}. + +The macro @code{def-slime-selector-method} can be used to define new +buffers for @code{slime-selector} to find. + + at node slime-autodoc-mode, Multiple connections, slime-selector, Extras @section @code{slime-autodoc-mode} @code{slime-autodoc-mode} is an additional minor-mode for From lgorrie at common-lisp.net Thu Mar 31 20:39:20 2005 From: lgorrie at common-lisp.net (Luke Gorrie) Date: Thu, 31 Mar 2005 22:39:20 +0200 (CEST) Subject: [slime-cvs] CVS update: slime/doc/slime.texi Message-ID: <20050331203920.543EA88672@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory common-lisp.net:/tmp/cvs-serv30614 Modified Files: slime.texi Log Message: slime-selector: minor edit. Date: Thu Mar 31 22:39:19 2005 Author: lgorrie Index: slime/doc/slime.texi diff -u slime/doc/slime.texi:1.34 slime/doc/slime.texi:1.35 --- slime/doc/slime.texi:1.34 Thu Mar 31 22:21:08 2005 +++ slime/doc/slime.texi Thu Mar 31 22:39:19 2005 @@ -46,7 +46,7 @@ @end macro @set EDITION 1.2 - at set UPDATED @code{$Date: 2005/03/31 20:21:08 $} + at set UPDATED @code{$Date: 2005/03/31 20:39:19 $} @titlepage @title SLIME User Manual @@ -1073,10 +1073,10 @@ @node slime-selector, slime-autodoc-mode, Extras, Extras @section @code{slime-selector} -The @code{slime-selector} is for quickly switching to important -buffers: the @REPL{}, @SLDB{}, the Lisp source you were just hacking, -etc. Once invoked the command prompts for a single letter to specify -which buffer it should display. Here are some of the options: +The @code{slime-selector} command is for quickly switching to +important buffers: the @REPL{}, @SLDB{}, the Lisp source you were just +hacking, etc. Once invoked the command prompts for a single letter to +specify which buffer it should display. Here are some of the options: @table @kbd @item ?