Changeset 2593
- Timestamp:
- 02/22/08 13:00:39 (11 months ago)
- Files:
-
- trunk/thirdparty/slime/CVS/Entries (modified) (2 diffs)
- trunk/thirdparty/slime/ChangeLog (modified) (5 diffs)
- trunk/thirdparty/slime/contrib/CVS/Entries (modified) (2 diffs)
- trunk/thirdparty/slime/contrib/ChangeLog (modified) (1 diff)
- trunk/thirdparty/slime/contrib/slime-indentation.el (added)
- trunk/thirdparty/slime/contrib/slime-motd.el (added)
- trunk/thirdparty/slime/contrib/slime-presentations.el (modified) (1 diff)
- trunk/thirdparty/slime/contrib/slime-scheme.el (added)
- trunk/thirdparty/slime/contrib/swank-goo.goo (added)
- trunk/thirdparty/slime/contrib/swank-indentation.lisp (added)
- trunk/thirdparty/slime/contrib/swank-kawa.scm (added)
- trunk/thirdparty/slime/contrib/swank-motd.lisp (added)
- trunk/thirdparty/slime/contrib/swank-presentations.lisp (modified) (1 diff)
- trunk/thirdparty/slime/slime.el (modified) (12 diffs)
- trunk/thirdparty/slime/swank-loader.lisp (modified) (8 diffs)
- trunk/thirdparty/slime/swank.asd (modified) (1 diff)
- trunk/thirdparty/slime/swank.lisp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/thirdparty/slime/CVS/Entries
r2475 r2593 13 13 /slime-autoloads.el/1.4/Thu Feb 7 08:07:30 2008// 14 14 /swank-gray.lisp/1.10/Thu Oct 11 14:10:25 2007// 15 /swank-loader.lisp/1.77/Thu Feb 7 08:07:31 2008//16 15 /swank-source-file-cache.lisp/1.8/Thu Oct 11 14:10:25 2007// 17 16 /swank-source-path-parser.lisp/1.18/Thu Feb 7 07:59:36 2008// 18 /swank.asd/1.5/Thu Oct 11 14:10:25 2007//19 17 /test-all.sh/1.2/Thu Oct 11 14:10:25 2007// 20 18 /test.sh/1.9/Thu Oct 11 14:10:25 2007// 21 19 /xref.lisp/1.2/Thu Oct 11 14:10:25 2007// 22 /ChangeLog/1.1289/Mon Feb 11 14:20:11 2008//23 /slime.el/1.904/Mon Feb 11 14:20:11 2008//24 20 /swank-abcl.lisp/1.47/Mon Feb 11 14:20:11 2008// 25 21 /swank-allegro.lisp/1.101/Mon Feb 11 14:20:11 2008// … … 33 29 /swank-sbcl.lisp/1.191/Mon Feb 11 14:20:11 2008// 34 30 /swank-scl.lisp/1.18/Mon Feb 11 14:20:11 2008// 35 /swank.lisp/1.531/Mon Feb 11 14:20:11 2008// 31 /ChangeLog/1.1294/Fri Feb 22 11:53:48 2008// 32 /swank.lisp/1.534/Result of merge// 33 /slime.el/1.907/Fri Feb 22 11:56:31 2008// 34 /swank-loader.lisp/1.81/Fri Feb 22 11:56:31 2008// 35 /swank.asd/1.6/Fri Feb 22 11:56:31 2008// trunk/thirdparty/slime/ChangeLog
r2475 r2593 1 2008-02-21 Tobias C. Rittweiler <tcr@freebits.de> 2 3 Fix regressions in the `find-definition' test case on SBCL: 4 5 M-. on e.g. SWANK::READ-FROM-EMACS would bring the user to 6 7 (|defun read-from-emacs ...) 8 9 and not 10 11 |(defun read-from-emacs ...) 12 13 * swank-sbcl.lisp (source-file-position): Don't 1+ the returned 14 position; i.e. return a position usable as a CL /file position/ 15 which start from 0, and not a position usable in Emacs where 16 buffer points start from 1. This is important because the return 17 value is passed to SWANK-BACKEND::READ-SNIPPET which invokes 18 CL:FILE-POSITION on it. 19 (make-definition-source-location): Adapted to 1+ the position 20 passed to Emacs, to reflect above change. 21 22 2008-02-20 Helmut Eller <heller@common-lisp.net> 23 24 Better factorization for M-. and xref commands. 25 26 * slime.el (slime-xref): Renamed from slime-definition. 27 (slime-location, slime-location-p): New ADT def. 28 (slime-xref-has-location-p, slime-analyze-xrefs): New functions. 29 This work used to be done on the Lisp side. 30 (slime-pop-to-location): New function. 31 (slime-edit-definition, slime-edit-definition-cont): Simplified. 32 (slime-find-definitions): New function. 33 (slime-goto-definition, slime-goto-definition-other-window) 34 (slime-pop-to-other-window, slime-show-definitions): Deleted. 35 (slime-insert-xrefs): Simplified. 36 (slime-insert-xref-location): Deleted. No need to show the filename 37 twice. 38 39 * swank.lisp (find-definitions-for-emacs, xref): Use common 40 representation for "definitions" and "xrefs". 41 (xref>elisp): New helper. 42 (group-xrefs, alistify, parition, location-position<, xref-position) 43 (xref-buffer, location-valid-p): Deleted. This work is now done on 44 the Emacs side. 45 46 2008-02-20 Helmut Eller <heller@common-lisp.net> 47 48 Emit a warning if the SWANK package already exists. 49 50 * swank-loader.lisp (init): Issue a warning when SWANK will not be 51 reloaded. 52 53 2008-02-18 Helmut Eller <heller@common-lisp.net> 54 55 Minor cleanups for inspector code. 56 57 * swank.lisp (inspector-content, inspect-list-aux): Slight 58 cleanups. 59 60 2008-02-17 Marco Baringer <mb@bese.it> 61 62 * swank.asd: Update for recent changes to swank-loader.lisp, we 63 need to call swank-loader::init after loading. 64 65 2008-02-16 Helmut Eller <heller@common-lisp.net> 66 67 In the REPL, mark the trailing newline also as input. 68 69 * slime.el (slime-repl-send-input): Mark the newline with 70 the 'slime-repl-old-input property. 71 (slime-repl-grab-old-input): Strip the newline. 72 73 2008-02-16 Helmut Eller <heller@common-lisp.net> 74 75 Split loading and initialization (again). 76 77 * swank-loader.lisp (init): New. Delete old packages only if 78 explicitly requested. Also, if the swank package already exists 79 don't load swank again. 80 (setup): New function. 81 82 * swank.lisp (setup): New function. Moved over here from 83 swank-loader.lisp. 84 85 * slime.el (slime-init-command): Call swank-loader:init. 86 1 87 2008-02-10 Helmut Eller <heller@common-lisp.net> 2 88 … … 2876 2962 (slime-repl-next-input-starting-with-current-input): New functions, 2877 2963 work like the old slime-repl-previous-input / next-input. 2878 (slime-repl-matching-input-regexp): Restore old version. 2964 (slime-repl-matching-input-regexp): Restore old version. 2879 2965 (slime-repl-mode-map): Bind s-r-p-i-s-w-c-i and s-r-n-i-s-w-c-i 2880 2966 to M-p and M-n respectively. slime-repl-previous-input and 2881 2967 slime-repl-next-input are still accessible with C-up / C-down. 2882 2968 2883 2969 2006-11-25 Helmut Eller <heller@common-lisp.net> 2884 2970 2885 2971 * slime.el (slime-repl-read-break): Use a :emacs-interrupt message 2886 instead of a RPC to swank:simple-break. Suggested by Taylor R 2972 instead of a RPC to swank:simple-break. Suggested by Taylor R. 2887 2973 Campbell. 2888 2974 … … 3429 3515 time zones. 3430 3516 3431 2006-09-13 Taylor R Campbell <campbell@mumble.net>3517 2006-09-13 Taylor R. Campbell <campbell@mumble.net> 3432 3518 3433 3519 * slime.el (slime-init-output-buffer): Initial directory and … … 3614 3700 3615 3701 * slime.el (slime-thread-quit): Call swank:quit-thread-browser. 3616 Reported by Taylor R Campbell.3702 Reported by Taylor R. Campbell. 3617 3703 3618 3704 2006-07-28 Willem Broekema <metawilm@gmail.com> … … 4971 5057 * slime.el (slime48): New command. 4972 5058 4973 2005-09-19 Taylor Campbell <campbell@mumble.net>5059 2005-09-19 Taylor R. Campbell <campbell@mumble.net> 4974 5060 4975 5061 * swank-scheme48/: New backend. trunk/thirdparty/slime/contrib/CVS/Entries
r2486 r2593 10 10 /slime-parse.el/1.10/Thu Feb 7 07:59:35 2008// 11 11 /slime-presentation-streams.el/1.2/Thu Oct 11 14:10:25 2007// 12 /slime-presentations.el/1.12/Thu Feb 7 07:59:35 2008//13 12 /slime-references.el/1.4/Thu Oct 11 14:10:25 2007// 14 13 /slime-scratch.el/1.4/Thu Oct 11 14:10:25 2007// … … 21 20 /swank-listener-hooks.lisp/1.1/Thu Oct 11 14:10:25 2007// 22 21 /swank-presentation-streams.lisp/1.5/Thu Feb 7 08:07:32 2008// 23 /swank-presentations.lisp/1.4/Thu Oct 11 14:10:25 2007//24 22 /slime-fancy-inspector.el/1.3/Mon Feb 11 14:20:11 2008// 25 23 /slime-fancy.el/1.5/Mon Feb 11 14:20:11 2008// 26 24 /swank-fancy-inspector.lisp/1.11/Mon Feb 11 14:20:11 2008// 27 /ChangeLog/1.91/Wed Feb 13 19:38:01 2008//28 25 /slime-c-p-c.el/1.9/Wed Feb 13 19:38:01 2008// 29 /slime-indentation.el/1.1/Wed Feb 13 19:38:02 2008//30 /slime-motd.el/1.1/Wed Feb 13 19:38:02 2008//31 /slime-scheme.el/1.1/Wed Feb 13 19:38:02 2008//32 26 /slime-xref-browser.el/1.2/Wed Feb 13 19:38:02 2008// 33 /swank-goo.goo/1.1/Wed Feb 13 19:38:03 2008// 34 /swank-indentation.lisp/1.1/Wed Feb 13 19:38:03 2008// 35 /swank-kawa.scm/1.1/Wed Feb 13 19:38:03 2008// 36 /swank-motd.lisp/1.1/Wed Feb 13 19:38:03 2008// 27 /ChangeLog/1.94/Fri Feb 22 11:53:56 2008// 28 /slime-indentation.el/1.1/Fri Feb 22 11:53:56 2008// 29 /slime-motd.el/1.1/Fri Feb 22 11:53:56 2008// 30 /slime-presentations.el/1.13/Fri Feb 22 11:53:57 2008// 31 /slime-scheme.el/1.1/Fri Feb 22 11:53:57 2008// 32 /swank-goo.goo/1.1/Fri Feb 22 11:53:57 2008// 33 /swank-indentation.lisp/1.1/Fri Feb 22 11:53:57 2008// 34 /swank-kawa.scm/1.2/Fri Feb 22 11:53:57 2008// 35 /swank-motd.lisp/1.1/Fri Feb 22 11:53:57 2008// 36 /swank-presentations.lisp/1.5/Fri Feb 22 11:53:57 2008// 37 37 D trunk/thirdparty/slime/contrib/ChangeLog
r2486 r2593 1 2008-02-21 Tobias C. Rittweiler <tcr@freebits.de> 2 3 Having the `slime-presentations' contrib enabled, (princ 10) 4 resulted in "1010" rather than "10\n10". (This also caused a 5 regression in the `repl-test' test case.) 6 7 * swank-presentations.lisp (present-repl-results): Emit fresh-line 8 as the original SEND-REPL-RESULTS-TO-EMACS does. 9 10 2008-02-18 Helmut Eller <heller@common-lisp.net> 11 12 Update Kawa backend to the changed inspector protocol. 13 14 * swank-kawa.scm (inspect-object): Return a list (content len 15 start end). 16 (<inspector-state>): New field: content. 17 (content-range, subseq): New functions. 18 19 2008-02-15 Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de> 20 21 * slime-presentations.el (slime-previous-presentation) 22 (slime-next-presentation): Accept a standard prefix argument. 23 1 24 2008-02-13 Helmut Eller <heller@common-lisp.net> 2 25 trunk/thirdparty/slime/contrib/slime-presentations.el
r2410 r2593 480 480 (push-mark end nil t))) 481 481 482 (defun slime-previous-presentation () 483 "Move point to the beginning of the first presentation before point." 484 (interactive) 485 ;; First skip outside the current surrounding presentation (if any) 486 (multiple-value-bind (presentation start end) 487 (slime-presentation-around-point (point)) 488 (when presentation 489 (goto-char start))) 490 (let ((p (previous-single-property-change (point) 'slime-repl-presentation))) 491 (unless p 492 (error "No previous presentation")) 493 (multiple-value-bind (presentation start end) 494 (slime-presentation-around-or-before-point-or-error p) 495 (goto-char start)))) 496 497 (defun slime-next-presentation () 498 "Move point to the beginning of the next presentation after point." 499 (interactive) 500 ;; First skip outside the current surrounding presentation (if any) 501 (multiple-value-bind (presentation start end) 502 (slime-presentation-around-point (point)) 503 (when presentation 504 (goto-char end))) 505 (let ((p (next-single-property-change (point) 'slime-repl-presentation))) 506 (unless p 507 (error "No next presentation")) 508 (multiple-value-bind (presentation start end) 509 (slime-presentation-around-or-before-point-or-error p) 510 (goto-char start)))) 482 (defun slime-previous-presentation (&optional arg) 483 "Move point to the beginning of the first presentation before point. 484 With ARG, do this that many times. 485 A negative argument means move forward instead." 486 (interactive "p") 487 (unless arg (setq arg 1)) 488 (slime-next-presentation (- arg))) 489 490 (defun slime-next-presentation (&optional arg) 491 "Move point to the beginning of the next presentation after point. 492 With ARG, do this that many times. 493 A negative argument means move backward instead." 494 (interactive "p") 495 (unless arg (setq arg 1)) 496 (cond 497 ((plusp arg) 498 (dotimes (i arg) 499 ;; First skip outside the current surrounding presentation (if any) 500 (multiple-value-bind (presentation start end) 501 (slime-presentation-around-point (point)) 502 (when presentation 503 (goto-char end))) 504 (let ((p (next-single-property-change (point) 'slime-repl-presentation))) 505 (unless p 506 (error "No next presentation")) 507 (multiple-value-bind (presentation start end) 508 (slime-presentation-around-or-before-point-or-error p) 509 (goto-char start))))) 510 ((minusp arg) 511 (dotimes (i (- arg)) 512 ;; First skip outside the current surrounding presentation (if any) 513 (multiple-value-bind (presentation start end) 514 (slime-presentation-around-point (point)) 515 (when presentation 516 (goto-char start))) 517 (let ((p (previous-single-property-change (point) 'slime-repl-presentation))) 518 (unless p 519 (error "No previous presentation")) 520 (multiple-value-bind (presentation start end) 521 (slime-presentation-around-or-before-point-or-error p) 522 (goto-char start))))))) 511 523 512 524 (defvar slime-presentation-map (make-sparse-keymap)) trunk/thirdparty/slime/contrib/swank-presentations.lisp
r2200 r2593 105 105 (send-to-emacs `(:write-string ,(string #\Newline) 106 106 :repl-result))))) 107 (fresh-line) 108 (finish-output) 107 109 (if (null values) 108 110 (send-to-emacs `(:write-string "; No value" :repl-result)) trunk/thirdparty/slime/slime.el
r2486 r2593 1433 1433 `(progn 1434 1434 (load ,(expand-file-name loader) :verbose t) 1435 (funcall (read-from-string "swank-loader: load-swank"))1435 (funcall (read-from-string "swank-loader:init")) 1436 1436 (funcall (read-from-string "swank:start-server") 1437 1437 ,port-filename … … 3174 3174 (slime-repl-add-to-input-history 3175 3175 (buffer-substring slime-repl-input-start-mark end)) 3176 (let ((inhibit-read-only t))3177 (add-text-properties slime-repl-input-start-mark3178 (point)3179 `(slime-repl-old-input3180 ,(incf slime-repl-old-input-counter))))3181 3176 (when newline 3182 3177 (insert "\n") 3183 3178 (slime-repl-show-maximum-output)) 3179 (add-text-properties slime-repl-input-start-mark 3180 (point) 3181 `(slime-repl-old-input 3182 ,(incf slime-repl-old-input-counter))) 3184 3183 (let ((overlay (make-overlay slime-repl-input-start-mark end))) 3185 3184 ;; These properties are on an overlay so that they won't be taken … … 3208 3207 (insert " ")))) 3209 3208 (delete-region (point) slime-repl-input-end-mark) 3210 (save-excursion (insert old-input)) 3209 (save-excursion 3210 (insert old-input) 3211 (when (equal (char-before) ?\n) 3212 (delete-char -1))) 3211 3213 (forward-char offset)))) 3212 3214 … … 4106 4108 4107 4109 (defun slime-alistify (list key test) 4108 "Partition the elements of LIST into an alist. 4109 KEY extracts the key from an element and TEST is used to compare keys." 4110 "Partition the elements of LIST into an alist. 4111 KEY extracts the key from an element and TEST is used to compare 4112 keys." 4110 4113 (declare (type function key)) 4111 4114 (let ((alist '())) … … 4117 4120 (push (cons k (list e)) alist)))) 4118 4121 ;; Put them back in order. 4119 (loop for (key . value) in alist4122 (loop for (key . value) in (reverse alist) 4120 4123 collect (cons key (reverse value))))) 4121 4124 … … 5140 5143 (slime-pop-find-definition-stack)))))) 5141 5144 5142 (defstruct (slime-definition (:conc-name slime-definition.) 5143 (:type list)) 5145 (defstruct (slime-xref (:conc-name slime-xref.) (:type list)) 5144 5146 dspec location) 5147 5148 (defstruct (slime-location (:conc-name slime-location.) (:type list) 5149 (:constructor nil) (:copier nil)) 5150 tag buffer position hints) 5151 (defun slime-location-p (o) (and (consp o) (eq (car o) :location))) 5152 5153 (defun slime-xref-has-location-p (xref) 5154 (slime-location-p (slime-xref.location xref))) 5145 5155 5146 5156 (defun slime-edit-definition (name &optional where) … … 5149 5159 function name is prompted." 5150 5160 (interactive (list (slime-read-symbol-name "Name: "))) 5151 (let ((definitions (slime-eval `(swank:find-definitions-for-emacs ,name)))) 5152 (cond 5153 ((null definitions) 5154 (if slime-edit-definition-fallback-function 5155 (funcall slime-edit-definition-fallback-function name) 5156 (error "No known definition for: %s" name))) 5157 ((and (slime-length= definitions 1) 5158 (eql (car (slime-definition.location (car definitions))) :error)) 5159 (if slime-edit-definition-fallback-function 5160 (funcall slime-edit-definition-fallback-function name) 5161 (error "%s" (cadr (slime-definition.location (car definitions)))))) 5162 (t 5163 (slime-goto-definition name definitions where))))) 5161 (slime-find-definitions name 5162 (slime-rcurry 5163 #'slime-edit-definition-cont name where))) 5164 5165 (defun slime-edit-definition-cont (xrefs name where) 5166 (destructuring-bind (1loc file-alist) (slime-analyze-xrefs xrefs) 5167 (cond ((null xrefs) 5168 (error "No known definition for: %s" name)) 5169 (1loc 5170 (slime-push-definition-stack) 5171 (slime-pop-to-location (slime-xref.location (car xrefs)) where)) 5172 ((= (length xrefs) 1) 5173 (error "%s" (cadr (slime-xref.location (car xrefs))))) 5174 (t 5175 (slime-push-definition-stack) 5176 (slime-show-xrefs file-alist 'definition name 5177 (slime-current-package)))))) 5178 5179 (defun slime-analyze-xrefs (xrefs) 5180 "Find common filenames in XREFS. 5181 Return a list (SINGLE-LOCATION FILE-ALIST). 5182 SINGLE-LOCATION is true if all xrefs point to the same location. 5183 FILE-ALIST is an alist of the form ((FILENAME . (XREF ...)) ...)." 5184 (list (and xrefs 5185 (let ((loc (slime-xref.location (car xrefs)))) 5186 (and (slime-location-p loc) 5187 (every (lambda (x) (equal (slime-xref.location x) loc)) 5188 (cdr xrefs))))) 5189 (slime-alistify xrefs 5190 (lambda (x) 5191 (if (slime-xref-has-location-p x) 5192 (slime-location-to-string (slime-xref.location x)) 5193 "Error")) 5194 #'equal))) 5195 5196 (defun slime-location-to-string (location) 5197 (destructure-case (slime-location.buffer location) 5198 ((:file filename) filename) 5199 ((:buffer bufname) 5200 (let ((buffer (get-buffer bufname))) 5201 (if buffer 5202 (format "%S" buffer) ; "#<buffer foo.lisp>" 5203 (format "%s (previously existing buffer)" bufname)))))) 5204 5205 (defun slime-pop-to-location (location &optional where) 5206 (ecase where 5207 ((nil) 5208 (slime-goto-source-location location) 5209 (switch-to-buffer (current-buffer))) 5210 (window 5211 (pop-to-buffer (current-buffer) t) 5212 (slime-goto-source-location location) 5213 (switch-to-buffer (current-buffer))) 5214 (frame 5215 (let ((pop-up-frames t)) 5216 (pop-to-buffer (current-buffer) t) 5217 (slime-goto-source-location location) 5218 (switch-to-buffer (current-buffer)))))) 5219 5220 (defun slime-find-definitions (name cont) 5221 "Find definitions for NAME and pass them to CONT." 5222 ;; FIXME: append SWANK xrefs and etags xrefs 5223 (funcall cont 5224 (or (slime-eval `(swank:find-definitions-for-emacs ,name)) 5225 (funcall slime-edit-definition-fallback-function name)))) 5164 5226 5165 5227 (defun slime-find-tag-if-tags-table-visited (name) … … 5170 5232 (find-tag name) 5171 5233 (error "No known definition for: %s; use M-x visit-tags-table RET" name))) 5172 5173 (defun slime-goto-definition (name definitions &optional where) 5174 (slime-push-definition-stack) 5175 (let ((all-locations-equal 5176 (or (null definitions) 5177 (let ((first-location (slime-definition.location (first definitions)))) 5178 (every (lambda (definition) 5179 (equal (slime-definition.location definition) 5180 first-location)) 5181 (rest definitions)))))) 5182 (if (and (slime-length> definitions 1) 5183 (not all-locations-equal)) 5184 (slime-show-definitions name definitions) 5185 (let ((def (car definitions))) 5186 (destructure-case (slime-definition.location def) 5187 ;; Take care of errors before switching any windows/buffers. 5188 ((:error message) 5189 (error "%s" message)) 5190 (t 5191 (cond ((equal where 'window) 5192 (slime-goto-definition-other-window (car definitions))) 5193 ((equal where 'frame) 5194 (let ((pop-up-frames t)) 5195 (slime-goto-definition-other-window (car definitions)))) 5196 (t 5197 (slime-goto-source-location (slime-definition.location 5198 (car definitions))) 5199 (switch-to-buffer (current-buffer)))))))))) 5200 5201 (defun slime-goto-definition-other-window (definition) 5202 (slime-pop-to-other-window) 5203 (slime-goto-source-location (slime-definition.location definition)) 5204 (switch-to-buffer (current-buffer))) 5205 5206 (defun slime-pop-to-other-window () 5207 "Pop to the other window, but not to any particular buffer." 5208 (pop-to-buffer (current-buffer) t)) 5209 5234 5210 5235 (defun slime-edit-definition-other-window (name) 5211 5236 "Like `slime-edit-definition' but switch to the other window." … … 5220 5245 (defun slime-edit-definition-with-etags (name) 5221 5246 (interactive (list (slime-read-symbol-name "Symbol: "))) 5222 (let (( tagdefs (slime-etags-definitions name)))5223 (cond ( tagdefs5247 (let ((xrefs (slime-etags-definitions name))) 5248 (cond (xrefs 5224 5249 (message "Using tag file...") 5225 (slime- goto-definition name tagdefs))5250 (slime-edit-definition-cont xrefs name nil)) 5226 5251 (t 5227 5252 (error "No known definition for: %s" name))))) … … 5247 5272 (push (list hint loc) defs)))))))) 5248 5273 (reverse defs)))) 5249 5250 (defun slime-show-definitions (name definitions)5251 (slime-show-xrefs5252 `((,name . ,(loop for (dspec location) in definitions5253 collect (cons dspec location))))5254 'definition5255 name5256 (slime-current-package)))5257 5274 5258 5275 ;;;;; first-change-hook … … 6059 6076 (put 'slime-with-xref-buffer 'lisp-indent-function 1) 6060 6077 6061 (defun slime-insert-xrefs (xref s)6062 "Insert XREF Sin the current-buffer.6063 XREF S is a list of the form ((GROUP . ((LABEL . LOCATION) ...)) ...)6064 GROUP and LABEL are for decoration purposes. LOCATION is a source-location."6065 (unless (bobp) (insert "\n")) 6078 (defun slime-insert-xrefs (xref-alist) 6079 "Insert XREF-ALIST in the current-buffer. 6080 XREF-ALIST is of the form ((GROUP . ((LABEL LOCATION) ...)) ...). 6081 GROUP and LABEL are for decoration purposes. LOCATION is a 6082 source-location." 6066 6083 (loop for (group . refs) in xrefs do 6067 (progn 6068 (slime-insert-propertized '(face bold) group "\n") 6069 (loop 6070 for (label . location) in refs 6071 do (slime-insert-propertized 6072 (list 'slime-location location 6073 'face 'font-lock-keyword-face) 6074 " " (slime-one-line-ify label)) 6075 do (insert " - " (slime-insert-xref-location location) "\n")))) 6084 (slime-insert-propertized '(face bold) group "\n") 6085 (loop for (label location) in refs do 6086 (slime-insert-propertized (list 'slime-location location 6087 'face 'font-lock-keyword-face) 6088 " " (slime-one-line-ify label) "\n"))) 6076 6089 ;; Remove the final newline to prevent accidental window-scrolling 6077 (backward-char 1) 6078 (delete-char 1)) 6079 6080 (defun slime-insert-xref-location (location) 6081 (if (eql :location (car location)) 6082 (cond ((assoc :file (cdr location)) 6083 (second (assoc :file (cdr location)))) 6084 ((assoc :buffer (cdr location)) 6085 (let* ((name (second (assoc :buffer (cdr location)))) 6086 (buffer (get-buffer name))) 6087 (if buffer 6088 (format "%S" buffer) 6089 (format "%s (previously existing buffer)" name))))) 6090 "file unknown")) 6090 (backward-delete-char 1)) 6091 6091 6092 6092 (defvar slime-next-location-function nil … … 6164 6164 (snapshot (slime-current-emacs-snapshot))) 6165 6165 (lambda (result) 6166 (slime-show-xrefs result type symbol package snapshot))))) 6166 (let ((file-alist (cadr (slime-analyze-xrefs result)))) 6167 (slime-show-xrefs file-alist type symbol package snapshot)))))) 6167 6168 6168 6169 trunk/thirdparty/slime/swank-loader.lisp
r2486 r2593 1 ;;;; -*- Mode: lisp;indent-tabs-mode: nil -*-1 ;;;; -*- indent-tabs-mode: nil -*- 2 2 ;;; 3 3 ;;; swank-loader.lisp --- Compile and load the Slime backend. … … 19 19 ;; (load ".../swank-loader.lisp") 20 20 21 ;(cl:eval-when (:compile-toplevel :load-toplevel :execute)22 ; (cl:when (cl:find-package :swank)23 ; (cl:delete-package :swank-loader)24 ; (cl:delete-package :swank)25 ; (cl:delete-package :swank-backend)))26 27 21 (cl:defpackage :swank-loader 28 22 (:use :cl) 29 23 (:export :load-swank 24 :init 30 25 :*source-directory* 31 26 :*fasl-directory*)) … … 80 75 #+armedbear (lisp-implementation-version)) 81 76 82 (defun unique-dir ectory-name ()77 (defun unique-dir-name () 83 78 "Return a name that can be used as a directory name that is 84 79 unique to a Lisp implementation, Lisp implementation version, … … 115 110 (and s (symbol-name (read s))))) 116 111 117 (defun default-fasl-dir ectory()112 (defun default-fasl-dir () 118 113 (merge-pathnames 119 114 (make-pathname 120 115 :directory `(:relative ".slime" "fasl" 121 116 ,@(if (slime-version-string) (list (slime-version-string))) 122 ,(unique-dir ectory-name)))117 ,(unique-dir-name))) 123 118 (user-homedir-pathname))) 124 119 125 (defun binary-pathname (s ource-pathname binary-directory)126 "Return the pathname where S OURCE-PATHNAME's binary should be compiled."127 (let ((cfp (compile-file-pathname s ource-pathname)))120 (defun binary-pathname (src-pathname binary-dir) 121 "Return the pathname where SRC-PATHNAME's binary should be compiled." 122 (let ((cfp (compile-file-pathname src-pathname))) 128 123 (merge-pathnames (make-pathname :name (pathname-name cfp) 129 124 :type (pathname-type cfp)) 130 binary-dir ectory)))125 binary-dir))) 131 126 132 127 (defun handle-loadtime-error (condition binary-pathname) … … 136 131 binary-pathname condition)) 137 132 (when (equal (directory-namestring binary-pathname) 138 (directory-namestring (default-fasl-dir ectory)))133 (directory-namestring (default-fasl-dir))) 139 134 (ignore-errors (delete-file binary-pathname))) 140 135 (abort)) 141 136 142 (defun compile-files -if-needed-serially (files fasl-directory &key load force)143 "Compile each file in FILES if the source is newer than 144 its corresponding binary, or the file preceding it was 145 recompiled."137 (defun compile-files (files fasl-dir load) 138 "Compile each file in FILES if the source is newer than its 139 corresponding binary, or the file preceding it was recompiled. 140 If LOAD is true, load the fasl file." 146 141 (let ((needs-recompile nil)) 147 (dolist (source-pathname files) 148 (let ((binary-pathname (binary-pathname source-pathname 149 fasl-directory))) 142 (dolist (src files) 143 (let ((dest (binary-pathname src fasl-dir))) 150 144 (handler-case 151 145 (progn 152 (when (or force 153 needs-recompile 154 (not (probe-file binary-pathname)) 155 (file-newer-p source-pathname binary-pathname)) 156 ;; need a to recompile source-pathname, so we'll 146 (when (or needs-recompile 147 (not (probe-file dest)) 148 (file-newer-p src dest)) 149 ;; need a to recompile src-pathname, so we'll 157 150 ;; need to recompile everything after this too. 158 151 (setq needs-recompile t) 159 (ensure-directories-exist binary-pathname) 160 (compile-file source-pathname :output-file binary-pathname 161 :print nil 162 :verbose t)) 152 (ensure-directories-exist dest) 153 (compile-file src :output-file dest :print nil :verbose t)) 163 154 (when load 164 (load binary-pathname:verbose t)))155 (load dest :verbose t))) 165 156 ;; Fail as early as possible 166 157 (serious-condition (c) 167 (handle-loadtime-error c binary-pathname)))))))158 (handle-loadtime-error c dest))))))) 168 159 169 160 #+(or cormanlisp ecl) 170 (defun compile-files -if-needed-serially (files fasl-directoryload)161 (defun compile-files (files fasl-dir load) 171 162 "Corman Lisp and ECL have trouble with compiled files." 172 (declare (ignore fasl-dir ectory))163 (declare (ignore fasl-dir)) 173 164 (when load 174 165 (dolist (file files) … … 182 173 :if-does-not-exist nil)) 183 174 184 (defun load-site-init-file (dir ectory)175 (defun load-site-init-file (dir) 185 176 (load (make-pathname :name "site-init" :type "lisp" 186 :defaults dir ectory)177 :defaults dir) 187 178 :if-does-not-exist nil)) 188 179 189 (defun s ource-files (names src-dir)180 (defun src-files (names src-dir) 190 181 (mapcar (lambda (name) 191 182 (make-pathname :name (string-downcase name) :type "lisp" … … 193 184 names)) 194 185 195 (defun swank-s ource-files (src-dir)196 (s ource-files `("swank-backend" ,@*sysdep-files* "swank")197 src-dir))198 199 (defvar *fasl-directory* (default-fasl-dir ectory)186 (defun swank-src-files (src-dir) 187 (src-files `("swank-backend" ,@*sysdep-files* "swank") 188 src-dir)) 189 190 (defvar *fasl-directory* (default-fasl-dir) 200 191 "The directory where fasl files should be placed.") 201 192 … … 212 203 absolute)) 213 204 214 (defun contrib-src-dir (src-dir) 215 (append-dir src-dir "contrib")) 216 217 (defun contrib-source-files (src-dir) 218 (source-files *contribs* (contrib-src-dir src-dir))) 219 220 (defun load-swank (&key 221 (source-directory *source-directory*) 222 (fasl-directory *fasl-directory*) 223 (contrib-fasl-directory 224 (append-dir fasl-directory "contrib")) 225 (force nil)) 226 (compile-files-if-needed-serially (swank-source-files source-directory) 227 fasl-directory :load t :force force) 228 (compile-files-if-needed-serially (contrib-source-files source-directory) 229 contrib-fasl-directory :load nil :force force) 230 231 (setf (symbol-value (read-from-string "swank::*swank-wire-protocol-version*")) (slime-version-string)) 232 (push (contrib-src-dir *source-directory*) 233 (symbol-value (read-from-string "swank::*load-path*"))) 234 (funcall (read-from-string "swank-backend::warn-unimplemented-interfaces")) 235 (load-site-init-file *source-directory*) 236 (load-user-init-file) 237 (funcall (read-from-string "swank:run-after-init-hook"))) 205 (defun contrib-dir (base-dir) 206 (append-dir base-dir "contrib")) 207 208 (defun load-swank (&key (src-dir *source-directory*) 209 (fasl-dir *fasl-directory*)) 210 (compile-files (swank-src-files src-dir) fasl-dir t)) 211 212 (defun compile-contribs (&key (src-dir (contrib-dir *source-directory*)) 213 (fasl-dir (contrib-dir *fasl-directory*))) 214 (compile-files (src-files *contribs* src-dir) fasl-dir nil)) 215 216 (defun setup () 217 (flet ((q (s) (read-from-string s))) 218 (load-site-init-file *source-directory*) 219 (load-user-init-file) 220 (eval `(pushnew 'compile-contribs ,(q "swank::*after-init-hook*"))) 221 (funcall (q "swank::setup") 222 (slime-version-string) 223 (list (contrib-dir *fasl-directory*) 224 (contrib-dir *source-directory*))))) 225 226 (defun init (&key delete reload) 227 (when (and delete (find-package :swank)) 228 (mapc #'delete-package '(:swank :swank-io-package :swank-backend))) 229 (cond ((or (not (find-package :swank)) reload) 230 (load-swank)) 231 (t 232 (warn "Not reloading SWANK. Package already exists."))) 233 (setup)) trunk/thirdparty/slime/swank.asd
r2486 r2593 25 25 (in-package :swank-loader) 26 26 27 (defclass swank-loader-file (asdf: source-file) ())27 (defclass swank-loader-file (asdf:cl-source-file) ()) 28 28 29 ;; asdf:compile-op does nothing for swank.29 ;;;; make compile-op a nop 30 30 31 (defmethod asdf:perform ((o asdf:compile-op) (f swank-loader-file)) t) 31 (defmethod asdf:operation-done-p ((o asdf:compile-op) (f swank-loader-file)) 32 t) 32 33 33 (defmethod asdf:operation-done-p ((o asdf:compile-op) (f swank-loader-file)) t) 34 35 (defmethod asdf:output-files ((o asdf:compile-op) (f swank-loader-file)) '()) 36 37 ;; asdf:load-op acutally loads it 34 ;;;; after loading run init 38 35 39 36 (defmethod asdf:perform ((o asdf:load-op) (f swank-loader-file)) 40 (if (find-package :swank) 41 (warn "Attempting to load re-load swank into this image. Ignoring request.") 42 (progn 43 (load (merge-pathnames (asdf:component-pathname f))) 44 (funcall (read-from-string "swank-loader:load-swank") 45 :source-directory (asdf:component-pathname (asdf:find-system :swank)))))) 46 47 (defmethod asdf:operation-done-p ((o asdf:load-op) (f swank-loader-file)) 48 (find-package :swank)) 49 50 (defmethod asdf:source-file-type ((c swank-loader-file) (s asdf:module)) 51 "lisp") 37 (load (asdf::component-pathname f)) 38 (funcall (read-from-string "swank-loader::init") 39 :reload (asdf::operation-forced o) 40 :delete (asdf::operation-forced o))) 52 41 53 42 (asdf:defsystem :swank 54 :default-component-class swank-loader-file55 :components ((:file "swank-loader")))43 :default-component-class swank-loader-file 44 :components ((:file "swank-loader"))) trunk/thirdparty/slime/swank.lisp
r2491 r2593 28 28 #:print-indentation-lossage 29 29 #:swank-debugger-hook 30 #:run-after-init-hook31 30 #:emacs-inspect 32 31 ;;#:inspect-slot-for-emacs … … 189 188 (defvar *after-init-hook* '() 190 189 "Hook run after user init files are loaded.") 191 192 (defun run-after-init-hook ()193 (run-hook *after-init-hook*))194 190 195 191 … … 2299 2295 defaults))) 2300 2296 2301 (defvar *load-path* 2302 (list (make-pathname :directory (merged-directory "contrib" *load-truename*) 2303 :name nil :type nil :version nil 2304 :defaults *load-truename*)) 2297 (defvar *load-path* '() 2305 2298 "A list of directories to search for modules.") 2306 2299 … … 2602 2595 "Return a list ((DSPEC LOCATION) ...) of definitions for NAME. 2603 2596 DSPEC is a string and LOCATION a source location. NAME is a string." 2604 (multiple-value-bind (sexp error) 2605 (ignore-errors (values (from-string name))) 2597 (multiple-value-bind (sexp error) (ignore-errors (values (from-string name))) 2606 2598 (unless error 2607 (loop for (dspec loc) in (find-definitions sexp) 2608 collect (list (to-string dspec) loc))))) 2609 2610 (defun alistify (list key test) 2611 "Partition the elements of LIST into an alist. KEY extracts the key 2612 from an element and TEST is used to compare keys." 2613 (declare (type function key)) 2614 (let ((alist '())) 2615 (dolist (e list) 2616 (let* ((k (funcall key e)) 2617 (probe (assoc k alist :test test))) 2618 (if probe 2619 (push e (cdr probe)) 2620 (push (cons k (list e)) alist)))) 2621 alist)) 2622 2623 (defun location-position< (pos1 pos2) 2624 (cond ((and (position-p pos1) (position-p pos2)) 2625 (< (position-pos pos1) 2626 (position-pos pos2))) 2627 (t nil))) 2628 2629 (defun partition (list test key) 2630 (declare (type function test key)) 2631 (loop for e in list 2632 if (funcall test (funcall key e)) collect e into yes 2633 else collect e into no 2634 finally (return (values yes no)))) 2635 2636 (defstruct (xref (:conc-name xref.) 2637 (:type list)) 2638 dspec location) 2639 2640 (defun location-valid-p (location) 2641 (eq (car location) :location)) 2642 2643 (defun xref-buffer (xref) 2644 (location-buffer (xref.location xref))) 2645 2646 (defun xref-position (xref) 2647 (location-buffer (xref.location xref))) 2648 2649 (defun group-xrefs (xrefs) 2650 "Group XREFS, a list of the form ((DSPEC LOCATION) ...) by location. 2651 The result is a list of the form ((LOCATION . ((DSPEC . LOCATION) ...)) ...)." 2652 (multiple-value-bind (resolved errors) 2653 (partition xrefs #'location-valid-p #'xref.location) 2654 (let ((alist (alistify resolved #'xref-buffer #'equal))) 2655 (append 2656 (loop for (buffer . list) in alist 2657 collect (cons (second buffer) 2658 (mapcar (lambda (xref) 2659 (cons (to-string (xref.dspec xref)) 2660 (xref.location xref))) 2661 (sort list #'location-position< 2662 :key #'xref-position)))) 2663 (if errors 2664 (list (cons "Unresolved" 2665 (mapcar (lambda (xref) 2666 (cons (to-string (xref.dspec xref)) 2667 (xref.location xref))) 2668
