From mbaringer at common-lisp.net Wed Nov 1 14:16:21 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Wed, 1 Nov 2006 09:16:21 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061101141621.997C84D000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv23192 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/30 16:25:09 1.993 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/01 14:16:21 1.994 @@ -1,3 +1,9 @@ +2006-11-01 Marco Baringer + + * swank.lisp (*swank-wire-protocol-version*): Use a defvar to + declare the existence of tihs variable to the lisp (Reported by: + Jonathon McKitrick ). + 2006-10-30 Marco Baringer * swank.lisp (*dont-close*): New variable. From mbaringer at common-lisp.net Wed Nov 1 14:16:40 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Wed, 1 Nov 2006 09:16:40 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061101141640.5E37F5B005@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv23303 Modified Files: swank.lisp Log Message: (*swank-wire-protocol-version*): Use a defvar to declare the existence of tihs variable to the lisp (Reported by: Jonathon McKitrick ). --- /project/slime/cvsroot/slime/swank.lisp 2006/10/30 16:25:28 1.413 +++ /project/slime/cvsroot/slime/swank.lisp 2006/11/01 14:16:36 1.414 @@ -1217,6 +1217,11 @@ ((:ok value) value) ((:abort) (abort))))))) +(defvar *swank-wire-protocol-version* nil + "The version of the swank/slime communication protocol. + +Set in swank-version.el.") + (defslimefun connection-info () "Return a key-value list of the form: \(&key PID STYLE LISP-IMPLEMENTATION MACHINE FEATURES PACKAGE WIRE-PROTOCOL-VERSION) From mbaringer at common-lisp.net Thu Nov 2 09:34:09 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 2 Nov 2006 04:34:09 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061102093409.CCC2C52002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12290 Modified Files: slime.el Log Message: (sldb-sexp-highlight-mode): New custom. (slime-handle-repl-shortcut): Trigger slime-lookup-shortcut when the point is anywhere before slime-repl-input-start-mark. IOW, you can press "," anywhere before the prompt. (slime-edit-definition): Handle the case when there are only such entries returned from swank that have errors. (slime-read-from-minibuffer): Allow overriding of the keymap. (slime-repl-previous-matching-input): Similar behaviour like isearch-forward. (slime-repl-next-matching-input): Ditto. In more details: You can freely navigate with slime-repl-previous/next-input with M-p and M-n at any time among the history entries. When M-r is pressed, which invokes slime-repl-previous-matching-input, the the minibuffer is activated to read the regexp to search for and the contents will default to the current repl input. Pressing M-r again will start searching with the last pattern used no matter what the content of the minibuffer is. Subsequent invocations of M-r get the next match, and of course the same applies for M-s, which is slime-repl-previous-matching-input. --- /project/slime/cvsroot/slime/slime.el 2006/10/30 16:24:49 1.683 +++ /project/slime/cvsroot/slime/slime.el 2006/11/02 09:34:09 1.684 @@ -386,6 +386,14 @@ (const :tag "Don't show" nil)) :group 'slime-debugger) +(defcustom sldb-sexp-highlight-mode :auto + "Defines how sexps are highlighted in sldb. Auto means Entire when paren-mode is 'sexp-surround." + :type '(choice + (const :tag "Auto" :value :auto) + (const :tag "Entire" :value :entire) + (const :tag "Sides" :value :sides)) + :group 'slime-debugger) + (defmacro def-sldb-faces (&rest faces) "Define the set of SLDB faces. Each face specifiation is (NAME DESCRIPTION &optional PROPERTIES). @@ -3603,7 +3611,8 @@ (when (and (plusp (length string)) (eq ?\n (aref string (1- (length string))))) (setq string (substring string 0 -1))) - (unless (equal string (car slime-repl-input-history)) + (unless (or (= (length string) 0) + (equal string (car slime-repl-input-history))) (push string slime-repl-input-history)) (setq slime-repl-input-history-position -1)) @@ -3938,14 +3947,31 @@ (defvar slime-repl-history-pattern nil "The regexp most recently used for finding input history.") -(defun slime-repl-history-replace (direction regexp &optional delete-at-end-p) +;; initialized later when slime-repl-mode-map is available +(defvar slime-repl-history-map (make-sparse-keymap) + "Map active while in the minibuffer reading repl search regexp.") + +(defun* slime-repl-history-replace (direction &optional regexp delete-at-end-p) "Replace the current input with the next line in DIRECTION matching REGEXP. DIRECTION is 'forward' or 'backward' (in the history list). If DELETE-AT-END-P is non-nil then remove the string if the end of the -history is reached." - (setq slime-repl-history-pattern regexp) - (let ((pos (slime-repl-position-in-history direction regexp)) - (forward (eq direction 'forward))) +history is reached. Returns t if there were any matches." + (when regexp + (setq slime-repl-history-pattern regexp)) + (let* ((forward (eq direction 'forward)) + (history-length (length slime-repl-input-history)) + (pos (if regexp + (slime-repl-position-in-history direction regexp) + (if (>= slime-repl-input-history-position 0) + (+ slime-repl-input-history-position + (if forward -1 1)) + (unless forward + 0))))) + (when (and pos + (or (< pos 0) + (>= pos history-length))) + + (setf pos nil)) (cond (pos (slime-repl-replace-input (nth pos slime-repl-input-history)) (setq slime-repl-input-history-position pos) @@ -3955,13 +3981,15 @@ (message "End of history")) (t (message "Beginning of history"))) (setq slime-repl-input-history-position - (if forward -1 (length slime-repl-input-history)))) + (if forward -1 history-length))) ((and delete-at-end-p slime-repl-wrap-history) (slime-repl-replace-input "") (setq slime-repl-input-history-position - (if forward (length slime-repl-input-history) -1))) + (if forward history-length -1))) (t - (message "End of history; no matching item"))))) + (message "End of history; no matching item") + (return-from slime-repl-history-replace nil)))) + t) (defun slime-repl-position-in-history (direction regexp) "Return the position of the history item matching regexp. @@ -3970,40 +3998,52 @@ (let* ((step (ecase direction (forward -1) (backward 1))) - (history-pos0 slime-repl-input-history-position)) + (history-pos0 slime-repl-input-history-position) + (history-length (length slime-repl-input-history))) (loop for pos = (+ history-pos0 step) then (+ pos step) while (and (<= 0 pos) - (< pos (length slime-repl-input-history))) + (< pos history-length)) do (let ((string (nth pos slime-repl-input-history))) (when (and (string-match regexp string) (not (string= string (slime-repl-current-input)))) (return pos)))))) -(defun slime-repl-matching-input-regexp () - (if (memq last-command - '(slime-repl-previous-input slime-repl-next-input)) - slime-repl-history-pattern - (concat "^" (regexp-quote (slime-buffer-substring-with-reified-output - slime-repl-input-start-mark - (if (> (point) slime-repl-input-start-mark) - (point) - slime-repl-input-end-mark)))))) - (defun slime-repl-previous-input () (interactive) - (slime-repl-history-replace 'backward (slime-repl-matching-input-regexp) t)) + (slime-repl-history-replace 'backward nil t)) (defun slime-repl-next-input () (interactive) - (slime-repl-history-replace 'forward (slime-repl-matching-input-regexp) t)) + (slime-repl-history-replace 'forward nil t)) + +(defun slime-repl-continue-search-with-last-pattern () + (interactive) + (when slime-repl-history-pattern + (throw 'continue slime-repl-history-pattern))) -(defun slime-repl-previous-matching-input (regexp) - (interactive "sPrevious element matching (regexp): ") - (slime-repl-history-replace 'backward regexp)) - -(defun slime-repl-next-matching-input (regexp) - (interactive "sNext element matching (regexp): ") - (slime-repl-history-replace 'forward regexp)) +(defun slime-repl-previous-or-next-matching-input (regexp direction prompt) + (let ((command this-command)) + (unless regexp + (setf regexp (if (and slime-repl-history-pattern + (memq last-command + '(slime-repl-previous-matching-input slime-repl-next-matching-input))) + slime-repl-history-pattern + (catch 'continue + (slime-read-from-minibuffer + prompt (slime-symbol-name-at-point) slime-repl-history-map))))) + (when (and regexp (> (length regexp) 0)) + (when (slime-repl-history-replace direction regexp) + (setf this-command command))))) + +(defun slime-repl-previous-matching-input () + (interactive) + (slime-repl-previous-or-next-matching-input + nil 'backward "Previous element matching (regexp): ")) + +(defun slime-repl-next-matching-input () + (interactive) + (slime-repl-previous-or-next-matching-input + nil 'forward "Next element matching (regexp): ")) ;;;;; Persistent History @@ -4160,6 +4200,14 @@ ("\C-c\C-k" 'slime-compile-and-load-file) ("\C-c\C-z" 'slime-nop)) +;; set up slime-repl-history-map +(flet ((remap (keys to) + (mimic-key-bindings slime-repl-mode-map slime-repl-history-map keys to))) + (remap (list 'slime-repl-previous-matching-input (kbd "M-r")) + 'slime-repl-continue-search-with-last-pattern) + (remap (list 'slime-repl-next-matching-input (kbd "M-n")) + 'slime-repl-continue-search-with-last-pattern)) + ;;;;;; REPL Read Mode (define-key slime-repl-mode-map @@ -4224,15 +4272,15 @@ (defun slime-handle-repl-shortcut () (interactive) - (if (= (point) slime-repl-input-start-mark) + (if (> (point) slime-repl-input-start-mark) + (insert (string slime-repl-shortcut-dispatch-char)) (let ((shortcut (slime-lookup-shortcut (completing-read "Command: " (slime-bogus-completion-alist (slime-list-all-repl-shortcuts)) nil t nil 'slime-repl-shortcut-history)))) - (call-interactively (slime-repl-shortcut.handler shortcut))) - (insert (string slime-repl-shortcut-dispatch-char)))) + (call-interactively (slime-repl-shortcut.handler shortcut))))) (defun slime-list-all-repl-shortcuts () (loop for shortcut in slime-repl-shortcut-table @@ -6099,6 +6147,7 @@ "Minibuffer keymap used for reading CL expressions.") (set-keymap-parent slime-read-expression-map minibuffer-local-map) +(set-keymap-parent slime-repl-history-map slime-read-expression-map) (define-key slime-read-expression-map "\t" 'slime-complete-symbol) (define-key slime-read-expression-map "\M-\t" 'slime-complete-symbol) @@ -6106,7 +6155,7 @@ (defvar slime-read-expression-history '() "History list of expressions read from the minibuffer.") -(defun slime-read-from-minibuffer (prompt &optional initial-value) +(defun slime-read-from-minibuffer (prompt &optional initial-value keymap) "Read a string from the minibuffer, prompting with PROMPT. If INITIAL-VALUE is non-nil, it is inserted into the minibuffer before reading input. The result is a string (\"\" if no input was given)." @@ -6118,7 +6167,8 @@ (setq slime-buffer-connection connection) (set-syntax-table lisp-mode-syntax-table))) minibuffer-setup-hook))) - (read-from-minibuffer prompt initial-value slime-read-expression-map + (read-from-minibuffer prompt initial-value + (or keymap slime-read-expression-map) nil 'slime-read-expression-history))) (defun slime-bogus-completion-alist (list) @@ -6418,8 +6468,8 @@ (setq buffer-read-only t)) (setq slime-fuzzy-current-completion (caar completions)) - (goto-char slime-fuzzy-first) - (slime-fuzzy-highlight-current-completion))) + (goto-char 0) + (slime-fuzzy-next))) (defun slime-fuzzy-enable-target-buffer-completions-mode () "Store the target buffer's local map, so that we can restore it." @@ -6485,7 +6535,8 @@ (defun slime-fuzzy-dehighlight-current-completion () "Restores the original face for the current completion." - (overlay-put slime-fuzzy-current-completion-overlay 'face 'nil)) + (when slime-fuzzy-current-completion-overlay + (overlay-put slime-fuzzy-current-completion-overlay 'face 'nil))) (defun slime-fuzzy-highlight-current-completion () "Highlights the current completion, so that the user can see it on the screen." @@ -6647,8 +6698,11 @@ function name is prompted." (interactive (list (slime-read-symbol-name "Name: "))) (let ((definitions (slime-eval `(swank:find-definitions-for-emacs ,name)))) - (cond - ((null definitions) + (cond + ((or (null definitions) + (every (lambda (definition) + (eq :error (caadr definition))) + definitions)) (if slime-edit-definition-fallback-function (funcall slime-edit-definition-fallback-function name) (error "No known definition for: %s" name))) @@ -8388,8 +8442,13 @@ (sldb-delete-overlays) (let ((start (or start (point))) (end (or end (save-excursion (ignore-errors (forward-sexp)) (point))))) - (push (make-overlay start (1+ start)) sldb-overlays) - (push (make-overlay (1- end) end) sldb-overlays) + (cond ((or (eq sldb-sexp-highlight-mode :entire) + (and (eq sldb-sexp-highlight-mode :auto) + (eq paren-mode 'sexp-surround))) + (push (make-overlay start end) sldb-overlays)) + (t + (push (make-overlay start (1+ start)) sldb-overlays) + (push (make-overlay (1- end) end) sldb-overlays))) (dolist (overlay sldb-overlays) (overlay-put overlay 'face 'secondary-selection)))) From mbaringer at common-lisp.net Thu Nov 2 09:34:31 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 2 Nov 2006 04:34:31 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061102093431.E6B5354011@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12331 Modified Files: swank.lisp Log Message: (fuzzy-completion-set): Fix on clisp. (convert-fuzzy-completion-result): Fix symbol fbound and other annotations. (slot-value-using-class-for-inspector): New. (slot-boundp-using-class-for-inspector): New. (inspect-for-emacs): Use the special slot access methods so that it's possible to customize the inspecting of complex slots (e.g. computed-class at http://common-lisp.net/project/computed-class/). (all-slots-for-inspector): Converted to generic method. --- /project/slime/cvsroot/slime/swank.lisp 2006/11/01 14:16:36 1.414 +++ /project/slime/cvsroot/slime/swank.lisp 2006/11/02 09:34:31 1.415 @@ -3421,7 +3421,7 @@ symbol-or-name)) symbol-or-name) internal-p package-name) - (list name score + (list name score (mapcar #'(lambda (chunk) ;; fix up chunk positions to account for possible @@ -3460,23 +3460,24 @@ (declare (type (or null (integer 0 #.(1- most-positive-fixnum))) limit time-limit-in-msec)) (multiple-value-bind (name package-name package internal-p) (parse-completion-arguments string default-package-name) - (flet ((convert (vector) - (loop for idx :upfrom 0 - while (< idx (length vector)) - for el = (aref vector idx) - do (setf (aref vector idx) (convert-fuzzy-completion-result - el nil internal-p package-name))))) + (flet ((convert (vector &optional converter) + (when vector + (loop for idx :upfrom 0 + while (< idx (length vector)) + for el = (aref vector idx) + do (setf (aref vector idx) (convert-fuzzy-completion-result + el converter internal-p package-name)))))) (let* ((symbols (and package (fuzzy-find-matching-symbols name package (and (not internal-p) package-name) :time-limit-in-msec time-limit-in-msec - :return-converted-p t))) + :return-converted-p nil))) (packs (and (not package-name) (fuzzy-find-matching-packages name))) (results)) - (convert symbols) + (convert symbols (completion-output-symbol-converter string)) (convert packs) (setf results (sort (concatenate 'vector symbols packs) #'> :key #'second)) (when (and limit @@ -4369,8 +4370,8 @@ for name = (swank-mop:slot-definition-name slotd) collect `(:value ,slotd ,(string name)) collect " = " - collect (if (swank-mop:slot-boundp-using-class c o slotd) - `(:value ,(swank-mop:slot-value-using-class + collect (if (slot-boundp-using-class-for-inspector c o slotd) + `(:value ,(slot-value-using-class-for-inspector c o slotd)) "#") collect '(:newline)))))) @@ -4410,31 +4411,41 @@ maxlen (length doc)))) -(defun all-slots-for-inspector (object) - (append (list "------------------------------" '(:newline) - "All Slots:" '(:newline)) - (loop - with direct-slots = (swank-mop:class-direct-slots (class-of object)) - for slot in (swank-mop:class-slots (class-of object)) - for slot-def = (or (find-if (lambda (a) - ;; find the direct slot - ;; with the same name - ;; as SLOT (an - ;; effective slot). - (eql (swank-mop:slot-definition-name a) - (swank-mop:slot-definition-name slot))) - direct-slots) - slot) - collect `(:value ,slot-def ,(inspector-princ (swank-mop:slot-definition-name slot-def))) - collect " = " - if (slot-boundp object (swank-mop:slot-definition-name slot-def)) - collect `(:value ,(slot-value object (swank-mop:slot-definition-name slot-def))) - else - collect "#" - collect '(:newline)))) +(defgeneric slot-value-using-class-for-inspector (class object slot) + (:method (class object slot) + (swank-mop:slot-value-using-class class object slot))) + +(defgeneric slot-boundp-using-class-for-inspector (class object slot) + (:method (class object slot) + (swank-mop:slot-boundp-using-class class object slot))) + +(defgeneric all-slots-for-inspector (object inspector) + (:method ((object standard-object) inspector) + (append '("------------------------------" (:newline) + "All Slots:" (:newline)) + (loop + with class = (class-of object) + with direct-slots = (swank-mop:class-direct-slots (class-of object)) + for slot in (swank-mop:class-slots (class-of object)) + for slot-def = (or (find-if (lambda (a) + ;; find the direct slot + ;; with the same name + ;; as SLOT (an + ;; effective slot). + (eql (swank-mop:slot-definition-name a) + (swank-mop:slot-definition-name slot))) + direct-slots) + slot) + collect `(:value ,slot-def ,(inspector-princ (swank-mop:slot-definition-name slot-def))) + collect " = " + if (slot-boundp-using-class-for-inspector class object slot) + collect `(:value ,(slot-value-using-class-for-inspector + (class-of object) object slot)) + else + collect "#" + collect '(:newline))))) (defmethod inspect-for-emacs ((gf standard-generic-function) inspector) - (declare (ignore inspector)) (flet ((lv (label value) (label-value-line label value))) (values "A generic function." @@ -4457,10 +4468,9 @@ (remove-method gf m)))) (:newline))) `((:newline)) - (all-slots-for-inspector gf))))) + (all-slots-for-inspector gf inspector))))) (defmethod inspect-for-emacs ((method standard-method) inspector) - (declare (ignore inspector)) (values "A method." `("Method defined on the generic function " (:value ,(swank-mop:method-generic-function method) @@ -4478,10 +4488,9 @@ (:newline) "Method function: " (:value ,(swank-mop:method-function method)) (:newline) - ,@(all-slots-for-inspector method)))) + ,@(all-slots-for-inspector method inspector)))) (defmethod inspect-for-emacs ((class standard-class) inspector) - (declare (ignore inspector)) (values "A class." `("Name: " (:value ,(class-name class)) (:newline) @@ -4538,11 +4547,10 @@ `(:value ,(swank-mop:class-prototype class)) '"#") (:newline) - ,@(all-slots-for-inspector class)))) + ,@(all-slots-for-inspector class inspector)))) (defmethod inspect-for-emacs ((slot swank-mop:standard-slot-definition) inspector) - (declare (ignore inspector)) - (values "A slot." + (values "A slot." `("Name: " (:value ,(swank-mop:slot-definition-name slot)) (:newline) ,@(when (swank-mop:slot-definition-documentation slot) @@ -4555,7 +4563,7 @@ "#") (:newline) "Init function: " (:value ,(swank-mop:slot-definition-initfunction slot)) (:newline) - ,@(all-slots-for-inspector slot)))) + ,@(all-slots-for-inspector slot inspector)))) (defmethod inspect-for-emacs ((package package) inspector) (declare (ignore inspector)) From mbaringer at common-lisp.net Thu Nov 2 11:13:25 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 2 Nov 2006 06:13:25 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061102111325.E72091F007@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv25331 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/11/01 14:16:21 1.994 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/02 11:13:24 1.995 @@ -1,3 +1,36 @@ +2006-11-01 Attila Lendvai + + * slime.el (sldb-sexp-highlight-mode): New custom. + (slime-handle-repl-shortcut): Trigger slime-lookup-shortcut when + the point is anywhere before slime-repl-input-start-mark. IOW, + you can press "," anywhere before the prompt. + (slime-edit-definition): Handle the case when there are only such + entries returned from swank that have errors. + (slime-read-from-minibuffer): Allow overriding of the keymap. + (slime-repl-previous-matching-input): Similar behaviour like + isearch-forward. + (slime-repl-next-matching-input): Ditto. In more details: You can + freely navigate with slime-repl-previous/next-input with M-p and + M-n at any time among the history entries. When M-r is pressed, + which invokes slime-repl-previous-matching-input, the the + minibuffer is activated to read the regexp to search for and the + contents will default to the current repl input. Pressing M-r + again will start searching with the last pattern used no matter + what the content of the minibuffer is. Subsequent invocations of + M-r get the next match, and of course the same applies for M-s, + which is slime-repl-previous-matching-input. + + * swank.lisp (fuzzy-completion-set): Fix on clisp. + (convert-fuzzy-completion-result): Fix symbol fbound and other + annotations. + (slot-value-using-class-for-inspector): New. + (slot-boundp-using-class-for-inspector): New. + (inspect-for-emacs): Use the special slot access methods so that + it's possible to customize the inspecting of complex + slots (e.g. computed-class at + http://common-lisp.net/project/computed-class/). + (all-slots-for-inspector): Converted to generic method. + 2006-11-01 Marco Baringer * swank.lisp (*swank-wire-protocol-version*): Use a defvar to From mbaringer at common-lisp.net Fri Nov 3 17:34:51 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 3 Nov 2006 12:34:51 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061103173451.11DE97802C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv10518 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/11/02 11:13:24 1.995 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/03 17:34:50 1.996 @@ -1,3 +1,8 @@ +2006-11-03 Marco Baringer + + * swank.lisp (all-slots-for-inspector): Added declare ignore for + unused argument inspector (openmcl warns about this). Reindented. + 2006-11-01 Attila Lendvai * slime.el (sldb-sexp-highlight-mode): New custom. From mbaringer at common-lisp.net Fri Nov 3 17:35:00 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 3 Nov 2006 12:35:00 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061103173500.5AA93A0F0@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv10567 Modified Files: swank.lisp Log Message: (all-slots-for-inspector): Added declare ignore for unused argument inspector (openmcl warns about this). Reindented. --- /project/slime/cvsroot/slime/swank.lisp 2006/11/02 09:34:31 1.415 +++ /project/slime/cvsroot/slime/swank.lisp 2006/11/03 17:35:00 1.416 @@ -4421,29 +4421,30 @@ (defgeneric all-slots-for-inspector (object inspector) (:method ((object standard-object) inspector) - (append '("------------------------------" (:newline) - "All Slots:" (:newline)) - (loop - with class = (class-of object) - with direct-slots = (swank-mop:class-direct-slots (class-of object)) - for slot in (swank-mop:class-slots (class-of object)) - for slot-def = (or (find-if (lambda (a) - ;; find the direct slot - ;; with the same name - ;; as SLOT (an - ;; effective slot). - (eql (swank-mop:slot-definition-name a) - (swank-mop:slot-definition-name slot))) - direct-slots) - slot) - collect `(:value ,slot-def ,(inspector-princ (swank-mop:slot-definition-name slot-def))) - collect " = " - if (slot-boundp-using-class-for-inspector class object slot) - collect `(:value ,(slot-value-using-class-for-inspector - (class-of object) object slot)) - else - collect "#" - collect '(:newline))))) + (declare (ignore inspector)) + (append '("------------------------------" (:newline) + "All Slots:" (:newline)) + (loop + with class = (class-of object) + with direct-slots = (swank-mop:class-direct-slots (class-of object)) + for slot in (swank-mop:class-slots (class-of object)) + for slot-def = (or (find-if (lambda (a) + ;; find the direct slot + ;; with the same name + ;; as SLOT (an + ;; effective slot). + (eql (swank-mop:slot-definition-name a) + (swank-mop:slot-definition-name slot))) + direct-slots) + slot) + collect `(:value ,slot-def ,(inspector-princ (swank-mop:slot-definition-name slot-def))) + collect " = " + if (slot-boundp-using-class-for-inspector class object slot) + collect `(:value ,(slot-value-using-class-for-inspector + (class-of object) object slot)) + else + collect "#" + collect '(:newline))))) (defmethod inspect-for-emacs ((gf standard-generic-function) inspector) (flet ((lv (label value) (label-value-line label value))) From mkoeppe at common-lisp.net Sat Nov 4 12:02:09 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 4 Nov 2006 07:02:09 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061104120209.E22E072080@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30703 Modified Files: present.lisp Log Message: Support nested presentations in REPL results, when present.lisp is loaded. * present.lisp (make-presentations-result): Override it here. --- /project/slime/cvsroot/slime/present.lisp 2006/02/17 01:33:20 1.18 +++ /project/slime/cvsroot/slime/present.lisp 2006/11/04 12:02:09 1.19 @@ -168,6 +168,21 @@ (write-annotation stream #'presentation-end record))) (funcall continue))) +(defun make-presentations-result (values) + ;; Override a function in swank.lisp, so that + ;; nested presentations work in the REPL result. + (cond + ((null values) + '(:values ())) + (t + ;; Do the output ourselves. + (fresh-line) + (dolist (o values) + (presenting-object o *standard-output* + (prin1 o)) + (terpri)) + '(:suppress-output)))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Example: Tell openmcl and cmucl to always present unreadable objects. try (describe 'class) From mkoeppe at common-lisp.net Sat Nov 4 12:02:29 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 4 Nov 2006 07:02:29 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061104120229.7BAE178001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30769 Modified Files: swank.lisp Log Message: (make-presentations-result): New, factored out from listener-eval. (listener-eval): Use it here. --- /project/slime/cvsroot/slime/swank.lisp 2006/11/03 17:35:00 1.416 +++ /project/slime/cvsroot/slime/swank.lisp 2006/11/04 12:02:29 1.417 @@ -2623,6 +2623,12 @@ (let ((p (setq *package* (guess-package-from-string package)))) (list (package-name p) (package-string-for-prompt p)))) +(defun make-presentations-result (values) + ;; overridden in present.lisp + `(:present ,(loop for x in values + collect (cons (prin1-to-string x) + (save-presented-object x))))) + (defslimefun listener-eval (string) (clear-user-input) (with-buffer-syntax () @@ -2636,9 +2642,7 @@ (setq +++ ++ ++ + + last-form) (cond ((eq *slime-repl-suppress-output* t) '(:suppress-output)) (*record-repl-results* - `(:present ,(loop for x in values - collect (cons (prin1-to-string x) - (save-presented-object x))))) + (make-presentations-result values)) (t `(:values ,(mapcar #'prin1-to-string values)))))))) From mkoeppe at common-lisp.net Sat Nov 4 12:02:47 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 4 Nov 2006 07:02:47 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061104120247.246941603C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30815 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/03 17:34:50 1.996 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/04 12:02:46 1.997 @@ -1,3 +1,14 @@ +2006-11-04 Matthias Koeppe + + Support nested presentations in REPL results, when present.lisp is + loaded. + + * swank.lisp (make-presentations-result): New, factored out from + listener-eval. + (listener-eval): Use it here. + + * present.lisp (make-presentations-result): Override it here. + 2006-11-03 Marco Baringer * swank.lisp (all-slots-for-inspector): Added declare ignore for @@ -5,16 +16,16 @@ 2006-11-01 Attila Lendvai - * slime.el (sldb-sexp-highlight-mode): New custom. - (slime-handle-repl-shortcut): Trigger slime-lookup-shortcut when + * slime.el (sldb-sexp-highlight-mode): New custom. + (slime-handle-repl-shortcut): Trigger slime-lookup-shortcut when the point is anywhere before slime-repl-input-start-mark. IOW, you can press "," anywhere before the prompt. - (slime-edit-definition): Handle the case when there are only such + (slime-edit-definition): Handle the case when there are only such entries returned from swank that have errors. - (slime-read-from-minibuffer): Allow overriding of the keymap. - (slime-repl-previous-matching-input): Similar behaviour like + (slime-read-from-minibuffer): Allow overriding of the keymap. + (slime-repl-previous-matching-input): Similar behaviour like isearch-forward. - (slime-repl-next-matching-input): Ditto. In more details: You can + (slime-repl-next-matching-input): Ditto. In more details: You can freely navigate with slime-repl-previous/next-input with M-p and M-n at any time among the history entries. When M-r is pressed, which invokes slime-repl-previous-matching-input, the the @@ -25,16 +36,16 @@ M-r get the next match, and of course the same applies for M-s, which is slime-repl-previous-matching-input. - * swank.lisp (fuzzy-completion-set): Fix on clisp. - (convert-fuzzy-completion-result): Fix symbol fbound and other + * swank.lisp (fuzzy-completion-set): Fix on clisp. + (convert-fuzzy-completion-result): Fix symbol fbound and other annotations. - (slot-value-using-class-for-inspector): New. - (slot-boundp-using-class-for-inspector): New. - (inspect-for-emacs): Use the special slot access methods so that + (slot-value-using-class-for-inspector): New. + (slot-boundp-using-class-for-inspector): New. + (inspect-for-emacs): Use the special slot access methods so that it's possible to customize the inspecting of complex slots (e.g. computed-class at http://common-lisp.net/project/computed-class/). - (all-slots-for-inspector): Converted to generic method. + (all-slots-for-inspector): Converted to generic method. 2006-11-01 Marco Baringer From heller at common-lisp.net Sun Nov 5 09:13:05 2006 From: heller at common-lisp.net (heller) Date: Sun, 5 Nov 2006 04:13:05 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061105091305.F03A9671BC@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv2662 Modified Files: slime.el Log Message: (sldb-sexp-highlight-mode): Remove bloat. --- /project/slime/cvsroot/slime/slime.el 2006/11/02 09:34:09 1.684 +++ /project/slime/cvsroot/slime/slime.el 2006/11/05 09:13:05 1.685 @@ -386,14 +386,6 @@ (const :tag "Don't show" nil)) :group 'slime-debugger) -(defcustom sldb-sexp-highlight-mode :auto - "Defines how sexps are highlighted in sldb. Auto means Entire when paren-mode is 'sexp-surround." - :type '(choice - (const :tag "Auto" :value :auto) - (const :tag "Entire" :value :entire) - (const :tag "Sides" :value :sides)) - :group 'slime-debugger) - (defmacro def-sldb-faces (&rest faces) "Define the set of SLDB faces. Each face specifiation is (NAME DESCRIPTION &optional PROPERTIES). @@ -4587,7 +4579,8 @@ `(swank:compile-file-for-emacs ,lisp-filename ,(if load t nil) ,@(if (local-variable-p 'slime-coding (current-buffer)) - (list (slime-coding-system-cl-name slime-coding)))) + (list (or (slime-coding-system-cl-name slime-coding) + (error "Encoding not supported: %s" slime-coding))))) (slime-compilation-finished-continuation)) (message "Compiling %s.." lisp-filename))) @@ -8442,15 +8435,10 @@ (sldb-delete-overlays) (let ((start (or start (point))) (end (or end (save-excursion (ignore-errors (forward-sexp)) (point))))) - (cond ((or (eq sldb-sexp-highlight-mode :entire) - (and (eq sldb-sexp-highlight-mode :auto) - (eq paren-mode 'sexp-surround))) - (push (make-overlay start end) sldb-overlays)) - (t - (push (make-overlay start (1+ start)) sldb-overlays) - (push (make-overlay (1- end) end) sldb-overlays))) - (dolist (overlay sldb-overlays) - (overlay-put overlay 'face 'secondary-selection)))) + (push (make-overlay start (1+ start)) sldb-overlays) + (push (make-overlay (1- end) end) sldb-overlays)) + (dolist (overlay sldb-overlays) + (overlay-put overlay 'face 'secondary-selection))) (defun sldb-toggle-details (&optional on) From heller at common-lisp.net Sun Nov 5 09:13:15 2006 From: heller at common-lisp.net (heller) Date: Sun, 5 Nov 2006 04:13:15 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061105091315.9A0FD69139@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv2695 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/04 12:02:46 1.997 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/05 09:13:13 1.998 @@ -1,3 +1,7 @@ +2006-11-05 Helmut Eller + + * slime.el (sldb-sexp-highlight-mode): Remove bloat. + 2006-11-04 Matthias Koeppe Support nested presentations in REPL results, when present.lisp is From mkoeppe at common-lisp.net Sun Nov 5 11:35:02 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 5 Nov 2006 06:35:02 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061105113502.280E42E17D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27390 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/05 09:13:13 1.998 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/05 11:35:01 1.999 @@ -1,3 +1,8 @@ +2006-11-05 Matthias Koeppe + + * slime.el (slime-complete-keywords-contextually): Unused + variable, removed. + 2006-11-05 Helmut Eller * slime.el (sldb-sexp-highlight-mode): Remove bloat. From mkoeppe at common-lisp.net Sun Nov 5 11:35:19 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 5 Nov 2006 06:35:19 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061105113519.E7AEB36009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27515 Modified Files: slime.el Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/slime.el 2006/11/05 09:13:05 1.685 +++ /project/slime/cvsroot/slime/slime.el 2006/11/05 11:35:19 1.686 @@ -263,12 +263,6 @@ :group 'slime-mode :type 'boolean) -(defcustom slime-complete-keywords-contextually t - "Use information from the arglist of the surrounding function call -to complete keywords." - :group 'slime-mode - :type 'boolean) - (defcustom slime-fuzzy-completion-in-place nil "When non-NIL the fuzzy symbol completion is done in place as opposed to moving the point to the completion buffer." From eweitz at common-lisp.net Tue Nov 7 07:42:52 2006 From: eweitz at common-lisp.net (eweitz) Date: Tue, 7 Nov 2006 02:42:52 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061107074252.2366CB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28328 Modified Files: ChangeLog slime.el Log Message: cosmetic change - escaped right parenthesis --- /project/slime/cvsroot/slime/ChangeLog 2006/11/05 11:35:01 1.999 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/07 07:42:51 1.1000 @@ -1,3 +1,8 @@ +2006-11-07 Edi Weitz + + * slime.el (slime-fuzzy-completion-time-limit-in-msec): Escaped + left parenthesis in doc string. + 2006-11-05 Matthias Koeppe * slime.el (slime-complete-keywords-contextually): Unused --- /project/slime/cvsroot/slime/slime.el 2006/11/05 11:35:19 1.686 +++ /project/slime/cvsroot/slime/slime.el 2006/11/07 07:42:51 1.687 @@ -276,7 +276,7 @@ (defcustom slime-fuzzy-completion-time-limit-in-msec 1500 "Limit the time spent (given in msec) in swank while gathering comletitions. -(NOTE: currently it's rounded up the nearest second)" +\(NOTE: currently it's rounded up the nearest second)" :group 'slime-mode :type 'integer) From mbaringer at common-lisp.net Sun Nov 12 11:18:48 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Sun, 12 Nov 2006 06:18:48 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061112111848.651BA63091@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv1298 Modified Files: slime.el Log Message: (slime-make-tramp-file-name): Added (require 'tramp) since tramp-make-tramp-file-name is not an autoloaded function. --- /project/slime/cvsroot/slime/slime.el 2006/11/07 07:42:51 1.687 +++ /project/slime/cvsroot/slime/slime.el 2006/11/12 11:18:48 1.688 @@ -1399,6 +1399,7 @@ (defun slime-make-tramp-file-name (username remote-host lisp-filename) "Old (with multi-hops) tramp compatability function" + (require 'tramp) (if (boundp 'tramp-multi-methods) (tramp-make-tramp-file-name nil nil username From mbaringer at common-lisp.net Sun Nov 12 11:18:58 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Sun, 12 Nov 2006 06:18:58 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061112111858.0DC9A76282@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv1320 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/11/07 07:42:51 1.1000 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/12 11:18:57 1.1001 @@ -1,3 +1,8 @@ +2006-11-12 Marco Baringer + + * slime.el (slime-make-tramp-file-name): Added (require 'tramp) + since tramp-make-tramp-file-name is not an autoloaded function. + 2006-11-07 Edi Weitz * slime.el (slime-fuzzy-completion-time-limit-in-msec): Escaped From heller at common-lisp.net Sun Nov 19 21:25:15 2006 From: heller at common-lisp.net (heller) Date: Sun, 19 Nov 2006 16:25:15 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061119212515.E6D4C6A02F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26643 Modified Files: ChangeLog Log Message: (slime-compile-file): Let the Lisp side choose the coding system. (slime-coding): Deleted. (slime-set-connection-info): On protocol version mismatch, ask the user how to proceed. (slime-protocol-version): New variable. Initialize it at compile time to detect stale elc files. --- /project/slime/cvsroot/slime/ChangeLog 2006/11/12 11:18:57 1.1001 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/19 21:25:15 1.1002 @@ -1,3 +1,35 @@ +2006-11-19 Helmut Eller + + * slime.el (slime-compile-file): Let the Lisp side choose the + coding system. + (slime-coding): Deleted. + + * swank.lisp (compile-file-for-emacs): Use guess-external-format. + + * swank-backend.lisp (find-external-format) + (guess-external-format): New. + (swank-compile-file): The external-format argument is now a + backend specific value returned by find-external-format. + + * swank-cmucl.lisp, swank-sbcl.lisp, swank-clisp, + swank-lispworks.lisp, swank-allegro.lisp, swank-corman.lisp, + swank-ecl.lisp, swank-scl.lisp, swank-abcl.lisp, swank-openmcl: + Update implementations accordingly. + + * swank-source-file-cache.lisp (read-file): Use guess-external-format. + + * swank.lisp (*swank-wire-protocol-version*): Is now initialized + by the loader. + (wire-protocol-version): Removed, because it contained a reference + to swank-loader::*source-directory*. + + * slime.el (slime-set-connection-info): On protocol version + mismatch, ask the user how to proceed. + (slime-protocol-version): New variable. Initialize it at compile + time to detect stale elc files. + + * swank-loader.lisp (load-swank): Set the protocol version. + 2006-11-12 Marco Baringer * slime.el (slime-make-tramp-file-name): Added (require 'tramp) @@ -10695,3 +10727,5 @@ ;; Local Variables: ;; coding: latin-1 ;; End: + +This file has been placed in the public domain. From heller at common-lisp.net Sun Nov 19 21:26:36 2006 From: heller at common-lisp.net (heller) Date: Sun, 19 Nov 2006 16:26:36 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061119212636.B44726A02F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26882 Modified Files: slime.el Log Message: (slime-compile-file): Let the Lisp side choose the coding system. (slime-coding): Deleted. (slime-set-connection-info): On protocol version mismatch, ask the user how to proceed. (slime-protocol-version): New variable. Initialize it at compile time to detect stale elc files. --- /project/slime/cvsroot/slime/slime.el 2006/11/12 11:18:48 1.688 +++ /project/slime/cvsroot/slime/slime.el 2006/11/19 21:26:36 1.689 @@ -64,8 +64,6 @@ (require 'overlay)) (require 'easymenu) -(load "swank-version") - (defvar slime-use-autodoc-mode nil "When non-nil always enable slime-autodoc-mode in slime-mode.") @@ -110,6 +108,22 @@ The default value is automatically computed from the location of the Emacs Lisp package.")) +(eval-and-compile + (defun slime-changelog-date () + "Return the datestring of the latest entry in the ChangeLog file. +Return nil if the ChangeLog file cannot be found." + (let ((changelog (concat slime-path "ChangeLog"))) + (if (file-exists-p changelog) + (with-temp-buffer + (insert-file-contents changelog nil 0 100) + (goto-char (point-min)) + (symbol-name (read (current-buffer)))) + nil)))) + +(defvar slime-protocol-version nil) +(setq slime-protocol-version + (eval-when-compile (slime-changelog-date))) + ;;;; Customize groups ;; @@ -1705,7 +1719,7 @@ (load ,loader :verbose t) (funcall (read-from-string "swank:start-server") ,port-filename - :external-format ,encoding))))) + :coding-system ,encoding))))) (defun slime-swank-port-file () "Filename where the SWANK server writes its TCP port number." @@ -1867,12 +1881,12 @@ ;;;;; Coding system madness (defvar slime-net-valid-coding-systems - '((iso-latin-1-unix nil :iso-latin-1-unix) - (iso-8859-1-unix nil :iso-latin-1-unix) - (binary nil :iso-latin-1-unix) - (utf-8-unix t :utf-8-unix) - (emacs-mule-unix t :emacs-mule-unix) - (euc-jp-unix t :euc-jp-unix)) + '((iso-latin-1-unix nil "iso-latin-1-unix") + (iso-8859-1-unix nil "iso-latin-1-unix") + (binary nil "iso-latin-1-unix") + (utf-8-unix t "utf-8-unix") + (emacs-mule-unix t "emacs-mule-unix") + (euc-jp-unix t "euc-jp-unix")) "A list of valid coding systems. Each element is of the form: (NAME MULTIBYTEP CL-NAME)") @@ -2251,12 +2265,11 @@ "Initialize CONNECTION with INFO received from Lisp." (let ((slime-dispatching-connection connection)) (destructuring-bind (&key pid style lisp-implementation machine - features package wire-protocol-version) - info - (assert (eql wire-protocol-version *swank-wire-protocol-version*) - nil - "Version mismatch. slime.el expects %S but swank.lisp uses %S, please reload." - *swank-wire-protocol-version* wire-protocol-version) + features package version &allow-other-keys) info + (or (equal version slime-protocol-version) + (yes-or-no-p "Protocol version mismatch. Continue anyway? ") + (slime-net-close connection) + (top-level)) (setf (slime-pid) pid (slime-communication-style) style (slime-lisp-features) features) @@ -2798,17 +2811,6 @@ (slime-repl-insert-prompt (cond (use-header-p `(:suppress-output)) (t `(:values (,(concat "; " banner)))))))) -(defun slime-changelog-date () - "Return the datestring of the latest entry in the ChangeLog file. -Return nil if the ChangeLog file cannot be found." - (let ((changelog (concat slime-path "ChangeLog"))) - (if (file-exists-p changelog) - (with-temp-buffer - (insert-file-contents changelog nil 0 100) - (goto-char (point-min)) - (symbol-name (read (current-buffer)))) - nil))) - (defun slime-init-output-buffer (connection) (with-current-buffer (slime-output-buffer t) (setq slime-buffer-connection connection @@ -4548,9 +4550,6 @@ (defvar slime-lisp-modes '(lisp-mode)) -(defvar slime-coding nil - "*The coding to use for `slime-compile-file'. Only used if buffer local.") - (defun slime-compile-file (&optional load) "Compile current buffer's file and highlight resulting compiler notes. @@ -4572,10 +4571,7 @@ (slime-display-output-buffer)) (slime-eval-async `(swank:compile-file-for-emacs - ,lisp-filename ,(if load t nil) - ,@(if (local-variable-p 'slime-coding (current-buffer)) - (list (or (slime-coding-system-cl-name slime-coding) - (error "Encoding not supported: %s" slime-coding))))) + ,lisp-filename ,(if load t nil)) (slime-compilation-finished-continuation)) (message "Compiling %s.." lisp-filename))) From heller at common-lisp.net Sun Nov 19 21:27:35 2006 From: heller at common-lisp.net (heller) Date: Sun, 19 Nov 2006 16:27:35 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061119212735.BDB416A02F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27026 Modified Files: swank.lisp Log Message: (compile-file-for-emacs): Use guess-external-format. (*swank-wire-protocol-version*): Is now initialized by the loader. (wire-protocol-version): Removed, because it contained a reference to swank-loader::*source-directory*. --- /project/slime/cvsroot/slime/swank.lisp 2006/11/04 12:02:29 1.417 +++ /project/slime/cvsroot/slime/swank.lisp 2006/11/19 21:27:35 1.418 @@ -1,4 +1,4 @@ -;;; -*- outline-regexp: ";;;;;*"; indent-tabs-mode: nil -*- +;;; -*- outline-regexp:";;;;;*" indent-tabs-mode:nil coding:latin-1-unix -*- ;;; ;;; This code has been placed in the Public Domain. All warranties ;;; are disclaimed. @@ -228,10 +228,7 @@ ;; The communication style used. (communication-style nil :type (member nil :spawn :sigio :fd-handler)) ;; The coding system for network streams. - (external-format *coding-system* :type (member :iso-latin-1-unix - :emacs-mule-unix - :utf-8-unix - :euc-jp-unix))) + (coding-system )) (defun print-connection (conn stream depth) (declare (ignore depth)) @@ -417,25 +414,31 @@ (defun start-server (port-file &key (style *communication-style*) (dont-close *dont-close*) - (external-format *coding-system*)) + (coding-system *coding-system*)) "Start the server and write the listen port number to PORT-FILE. This is the entry point for Emacs." (flet ((start-server-aux () (setup-server 0 (lambda (port) (announce-server-port port-file port)) - style dont-close external-format))) + style dont-close + (find-external-format-or-lose coding-system)))) (if (eq style :spawn) (initialize-multiprocessing #'start-server-aux) (start-server-aux)))) (defun create-server (&key (port default-server-port) (style *communication-style*) - (dont-close *dont-close*) (external-format *coding-system*)) + (dont-close *dont-close*) + (coding-system *coding-system*)) "Start a SWANK server on PORT running in STYLE. If DONT-CLOSE is true then the listen socket will accept multiple connections, otherwise it will be closed after the first." (setup-server port #'simple-announce-function style dont-close - external-format)) + (find-external-format-or-lose coding-system))) + +(defun find-external-format-or-lose (coding-system) + (or (find-external-format coding-system) + (error "Unsupported coding system: ~s" coding-system))) (defun create-swank-server (&optional (port default-server-port) (style *communication-style*) @@ -469,7 +472,7 @@ (unless dont-close (close-socket socket) (setf closed-socket-p t)) - (let ((connection (create-connection client style external-format))) + (let ((connection (create-connection client style))) (run-hook *new-connection-hook* connection) (push connection *connections*) (serve-requests connection))) @@ -541,8 +544,7 @@ stream (or NIL if none was created)." (if *use-dedicated-output-stream* (let ((stream (open-dedicated-output-stream - (connection.socket-io connection) - (connection.external-format connection)))) + (connection.socket-io connection)))) (values (lambda (string) (write-string string stream) (force-output stream)) @@ -554,7 +556,7 @@ (send-to-emacs `(:write-string ,string))))) nil))) -(defun open-dedicated-output-stream (socket-io external-format) +(defun open-dedicated-output-stream (socket-io) "Open a dedicated output connection to the Emacs on SOCKET-IO. Return an output stream suitable for writing program output. @@ -564,8 +566,12 @@ (unwind-protect (let ((port (local-port socket))) (encode-message `(:open-dedicated-output-stream ,port) socket-io) - (let ((dedicated (accept-authenticated-connection - socket :external-format external-format + (let ((dedicated (accept-authenticated-connection + socket + :external-format + (or (ignore-errors + (stream-external-format socket-io)) + :default) :buffering *dedicated-output-stream-buffering* :timeout 30))) (close-socket socket) @@ -605,11 +611,11 @@ ;; Connection to Emacs lost. [~%~ ;; condition: ~A~%~ ;; type: ~S~%~ - ;; encoding: ~S style: ~S dedicated: ~S]~%" + ;; encoding: ~A style: ~S dedicated: ~S]~%" backtrace (escape-non-ascii (safe-condition-message condition) ) (type-of condition) - (connection.external-format c) + (ignore-errors (stream-external-format (connection.socket-io c))) (connection.communication-style c) *use-dedicated-output-stream*) (finish-output *debug-io*))) @@ -884,7 +890,7 @@ (connection.user-input connection) in) connection)) -(defun create-connection (socket-io style external-format) +(defun create-connection (socket-io style) (let ((success nil)) (unwind-protect (let ((c (ecase style @@ -912,7 +918,6 @@ :send #'send-to-socket-io :serve-requests #'simple-serve-requests))))) (setf (connection.communication-style c) style) - (setf (connection.external-format c) external-format) (initialize-streams-for-connection c) (setf success t) c) @@ -1218,19 +1223,17 @@ ((:abort) (abort))))))) (defvar *swank-wire-protocol-version* nil - "The version of the swank/slime communication protocol. - -Set in swank-version.el.") + "The version of the swank/slime communication protocol.") (defslimefun connection-info () "Return a key-value list of the form: -\(&key PID STYLE LISP-IMPLEMENTATION MACHINE FEATURES PACKAGE WIRE-PROTOCOL-VERSION) +\(&key PID STYLE LISP-IMPLEMENTATION MACHINE FEATURES PACKAGE VERSION) PID: is the process-id of Lisp process (or nil, depending on the STYLE) STYLE: the communication style LISP-IMPLEMENTATION: a list (&key TYPE NAME VERSION) FEATURES: a list of keywords PACKAGE: a list (&key NAME PROMPT) -WIRE-PROTOCOL-VERSION: a number" +VERSION: the protocol version" (setq *slime-features* *features*) `(:pid ,(getpid) :style ,(connection.communication-style *emacs-connection*) :lisp-implementation (:type ,(lisp-implementation-type) @@ -1242,7 +1245,7 @@ :features ,(features-for-emacs) :package (:name ,(package-name *package*) :prompt ,(package-string-for-prompt *package*)) - :wire-protocol-version ,(wire-protocol-version))) + :version ,*swank-wire-protocol-version*)) (defslimefun io-speed-test (&optional (n 5000) (m 1)) (let* ((s *standard-output*) @@ -1259,11 +1262,6 @@ (finish-output *trace-output*) nil)) -(defun wire-protocol-version () - (let ((*package* (find-package :swank))) - (load (merge-pathnames "swank-version.el" swank-loader::*source-directory*)) - (symbol-value '*swank-wire-protocol-version*))) - ;;;; Reading and printing @@ -2993,13 +2991,16 @@ (list (to-string result) (format nil "~,2F" (/ usecs 1000000.0)))))) -(defslimefun compile-file-for-emacs (filename load-p &optional external-format) +(defslimefun compile-file-for-emacs (filename load-p) "Compile FILENAME and, when LOAD-P, load the result. Record compiler notes signalled as `compiler-condition's." (with-buffer-syntax () (let ((*compile-print* nil)) - (swank-compiler (lambda () (swank-compile-file filename load-p - external-format)))))) + (swank-compiler + (lambda () + (swank-compile-file filename load-p + (or (guess-external-format filename) + :default))))))) (defslimefun compile-string-for-emacs (string buffer position directory) "Compile STRING (exerpted from BUFFER at POSITION). From heller at common-lisp.net Sun Nov 19 21:28:17 2006 From: heller at common-lisp.net (heller) Date: Sun, 19 Nov 2006 16:28:17 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061119212817.0EFC96A02F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27142 Modified Files: swank-loader.lisp Log Message: (load-swank): Set the protocol version. --- /project/slime/cvsroot/slime/swank-loader.lisp 2006/10/16 19:59:33 1.62 +++ /project/slime/cvsroot/slime/swank-loader.lisp 2006/11/19 21:28:16 1.63 @@ -108,18 +108,12 @@ "Returns true if NEW-FILE is newer than OLD-FILE." (> (file-write-date new-file) (file-write-date old-file))) -;; Currently just use the modification time of the ChangeLog. We -;; could also try to use one of those CVS keywords. (defun slime-version-string () "Return a string identifying the SLIME version. Return nil if nothing appropriate is available." - (let* ((changelog (merge-pathnames "ChangeLog" *source-directory*)) - (date (file-write-date changelog))) - (cond (date (multiple-value-bind (_s _m _h date month year) - (decode-universal-time date) - (declare (ignore _s _m _h)) - (format nil "~D-~2,'0D-~2,'0D" year month date))) - (t nil)))) + (with-open-file (s (merge-pathnames "ChangeLog" *source-directory*) + :if-does-not-exist nil) + (and s (symbol-name (read s))))) (defun default-fasl-directory () (merge-pathnames @@ -205,6 +199,8 @@ (fasl-directory *fasl-directory*)) (compile-files-if-needed-serially (swank-source-files source-directory) fasl-directory) + (set (read-from-string "swank::*swank-wire-protocol-version*") + (slime-version-string)) (funcall (intern (string :warn-unimplemented-interfaces) :swank-backend)) (load-site-init-file source-directory) (load-user-init-file) From heller at common-lisp.net Sun Nov 19 21:28:41 2006 From: heller at common-lisp.net (heller) Date: Sun, 19 Nov 2006 16:28:41 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061119212841.597606A004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27201 Modified Files: swank-source-file-cache.lisp Log Message: (read-file): Use guess-external-format. --- /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2005/08/29 20:02:58 1.4 +++ /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/11/19 21:28:41 1.5 @@ -75,7 +75,10 @@ (defun read-file (filename) "Return the entire contents of FILENAME as a string." - (with-open-file (s filename :direction :input) + (with-open-file (s filename :direction :input + :external-format (or (guess-external-format filename) + (find-external-format "latin-1") + :default)) (let ((string (make-string (file-length s)))) (read-sequence string s) string))) From heller at common-lisp.net Sun Nov 19 21:33:04 2006 From: heller at common-lisp.net (heller) Date: Sun, 19 Nov 2006 16:33:04 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061119213304.440596B0EB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27672 Modified Files: swank-backend.lisp swank-cmucl.lisp swank-sbcl.lisp swank-clisp.lisp swank-lispworks.lisp swank-allegro.lisp swank-corman.lisp swank-ecl.lisp swank-scl.lisp swank-abcl.lisp swank-openmcl.lisp Log Message: (find-external-format, guess-external-format): New. (swank-compile-file): The external-format argument is now a backend specific value returned by find-external-format. Update implementations accordingly. --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/28 17:41:41 1.108 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/11/19 21:33:03 1.109 @@ -370,9 +370,11 @@ (abort-request "Couldn't find ASDF operation ~S" operation-name)) (apply operate operation system-name keyword-args)))) -(definterface swank-compile-file (filename load-p &optional external-format) +(definterface swank-compile-file (filename load-p external-format) "Compile FILENAME signalling COMPILE-CONDITIONs. -If LOAD-P is true, load the file after compilation.") +If LOAD-P is true, load the file after compilation. +EXTERNAL-FORMAT is a value returned by find-external-format or +:default.") (deftype severity () '(member :error :read-error :warning :style-warning :note)) @@ -404,6 +406,48 @@ (location :initarg :location :accessor location))) +(definterface find-external-format (coding-system) + "Return a \"external file format designator\" for CODING-SYSTEM. +CODING-SYSTEM is Emacs-style coding system name (a string), +e.g. \"latin-1-unix\"." + (if (equal coding-system "iso-latin-1-unix") + :default + nil)) + +(definterface guess-external-format (filename) + "Detect the external format for the file with name FILENAME. +Return nil if the file contains no special markers." + ;; Look for a Emacs-style -*- coding: ... -*- or Local Variable: section. + (with-open-file (s filename :if-does-not-exist nil + :external-format (or (find-external-format "latin-1-unix") + :default)) + (or (let* ((line (read-line s nil)) + (p (search "-*-" line))) + (when p + (let* ((start (+ p (length "-*-"))) + (end (search "-*-" line :start2 start))) + (when end + (%search-coding line start end))))) + (let* ((len (file-length s)) + (buf (make-string (min len 3000)))) + (file-position s (- len (length buf))) + (read-sequence buf s) + (let ((start (search "Local Variables:" buf :from-end t)) + (end (search "End:" buf :from-end t))) + (and start end (< start end) + (%search-coding buf start end))))))) + +(defun %search-coding (str start end) + (let ((p (search "coding:" str :start2 start :end2 end))) + (when p + (incf p (length "coding:")) + (loop while (and (< p end) + (member (aref str p) '(#\space #\tab))) + do (incf p)) + (let ((end (position-if (lambda (c) (find c '(#\space #\tab #\newline))) + str :start p))) + (find-external-format (subseq str p end)))))) + ;;;; Streams --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/10/20 17:07:55 1.166 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/11/19 21:33:03 1.167 @@ -100,13 +100,8 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore timeout)) - (let ((ef (or external-format :iso-latin-1-unix)) - (buffering (or buffering :full))) - (unless (eq ef ':iso-latin-1-unix) - (remove-fd-handlers socket) - (remove-sigio-handlers socket) - (error "External format ~S not supported" ef)) + (declare (ignore timeout external-format)) + (let ((buffering (or buffering :full))) (make-socket-io-stream (ext:accept-tcp-connection socket) buffering))) ;;;;; Sockets @@ -338,8 +333,7 @@ (c::warning #'handle-notification-condition)) (funcall function)))) -(defimplementation swank-compile-file (filename load-p - &optional external-format) +(defimplementation swank-compile-file (filename load-p external-format) (declare (ignore external-format)) (clear-xref-info filename) (with-compilation-hooks () --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/27 06:24:26 1.170 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/11/19 21:33:03 1.171 @@ -129,22 +129,27 @@ (sb-bsd-sockets:socket (sb-bsd-sockets:socket-file-descriptor socket)) (file-stream (sb-sys:fd-stream-fd socket)))) -(defun find-external-format (coding-system) - (ecase coding-system - (:iso-latin-1-unix :iso-8859-1) - (:utf-8-unix :utf-8) - (:euc-jp-unix :euc-jp))) +(defvar *external-format-to-coding-system* + '((:iso-8859-1 + "latin-1" "latin-1-unix" "iso-latin-1-unix" + "iso-8859-1" "iso-8859-1-unix") + (:utf-8 "utf-8" "utf-8-unix") + (:euc-jp "euc-jp" "euc-jp-unix") + (:us-ascii "us-ascii" "us-ascii-unix"))) + +(defimplementation find-external-format (coding-system) + (car (rassoc-if (lambda (x) (member coding-system x :test #'equal)) + *external-format-to-coding-system*))) (defun make-socket-io-stream (socket external-format buffering) - (let ((ef (find-external-format external-format))) - (sb-bsd-sockets:socket-make-stream socket - :output t - :input t - :element-type 'character - :buffering buffering - #+sb-unicode :external-format - #+sb-unicode ef - ))) + (sb-bsd-sockets:socket-make-stream socket + :output t + :input t + :element-type 'character + :buffering buffering + #+sb-unicode :external-format + #+sb-unicode external-format + )) (defun accept (socket) "Like socket-accept, but retry on EAGAIN." @@ -373,20 +378,17 @@ (defvar *trap-load-time-warnings* nil) -(defimplementation swank-compile-file (filename load-p - &optional external-format) - (let ((ef (if external-format - (find-external-format external-format) - :default))) - (handler-case - (let ((output-file (with-compilation-hooks () - (compile-file filename :external-format ef)))) - (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-file (filename load-p external-format) + (handler-case + (let ((output-file (with-compilation-hooks () + (compile-file filename + :external-format external-format)))) + (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))) ;;;; compile-string --- /project/slime/cvsroot/slime/swank-clisp.lisp 2006/08/10 11:53:35 1.59 +++ /project/slime/cvsroot/slime/swank-clisp.lisp 2006/11/19 21:33:03 1.60 @@ -116,22 +116,35 @@ (defimplementation close-socket (socket) (socket:socket-server-close socket)) - -(defun find-encoding (external-format) - (let ((charset (ecase external-format - (:iso-latin-1-unix "iso-8859-1") - (:utf-8-unix "utf-8") - (:euc-jp-unix "euc-jp")))) - (ext:make-encoding :charset charset :line-terminator :unix))) (defimplementation accept-connection (socket &key external-format buffering timeout) (declare (ignore buffering timeout)) - (setq external-format (or external-format :iso-latin-1-unix)) (socket:socket-accept socket :buffered nil ;; XXX should be t :element-type 'character - :external-format (find-encoding external-format))) + :external-format external-format)) + +;;; Coding systems + +(defvar *external-format-to-coding-system* + '(((:charset "iso-8859-1" :line-terminator :unix) + "latin-1-unix" "iso-latin-1-unix" "iso-8859-1-unix") + ((:charset "iso-8859-1":latin-1) + "latin-1" "iso-latin-1" "iso-8859-1") + ((:charset "utf-8") "utf-8") + ((:charset "utf-8" :line-terminator :unix) "utf-8-unix") + ((:charset "euc-jp") "euc-jp") + ((:charset "euc-jp" :line-terminator :unix) "euc-jp-unix") + ((:charset "us-ascii") "us-ascii") + ((:charset "us-ascii" :line-terminator :unix) "us-ascii-unix"))) + +(defimplementation find-external-format (coding-system) + (let ((args (car (rassoc-if (lambda (x) + (member coding-system x :test #'equal)) + *external-format-to-coding-system*)))) + (and args (apply #'ext:make-encoding args)))) + ;;; Swank functions @@ -467,17 +480,14 @@ :message (princ-to-string condition) :location (compiler-note-location)))) -(defimplementation swank-compile-file (filename load-p - &optional external-format) - (let ((ef (if external-format - (find-encoding external-format) - :default))) - (with-compilation-hooks () - (with-compilation-unit () - (let ((fasl-file (compile-file filename :external-format ef))) - (when (and load-p fasl-file) - (load fasl-file)) - nil))))) +(defimplementation swank-compile-file (filename load-p external-format) + (with-compilation-hooks () + (with-compilation-unit () + (let ((fasl-file (compile-file filename + :external-format external-format))) + (when (and load-p fasl-file) + (load fasl-file)) + nil)))) (defimplementation swank-compile-string (string &key buffer position directory) (declare (ignore directory)) --- /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/10/21 09:28:57 1.87 +++ /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/11/19 21:33:03 1.88 @@ -67,25 +67,36 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore buffering timeout)) - (assert (member external-format '(nil :iso-latin-1-unix))) + (declare (ignore buffering timeout external-format)) (let* ((fd (comm::get-fd-from-socket socket))) (assert (/= fd -1)) (make-instance 'comm:socket-stream :socket fd :direction :io :element-type 'base-char))) -(defun find-external-format (coding-system &optional default) - (case coding-system - (:iso-latin-1-unix '(:latin-1 :eol-style :lf)) - (:utf-8-unix '(:utf-8 :eol-style :lf)) - (t default))) - (defun set-sigint-handler () ;; Set SIGINT handler on Swank request handler thread. #-win32 (sys::set-signal-handler +sigint+ (make-sigint-handler mp:*current-process*))) +;;; Coding Systems + +(defvar *external-format-to-coding-system* + '(((:latin-1 :eol-style :lf) + "latin-1-unix" "iso-latin-1-unix" "iso-8859-1-unix") + ((:latin-1) + "latin-1" "iso-latin-1" "iso-8859-1") + ((:utf-8) "utf-8") + ((:utf-8 :eol-style :lf) "utf-8-unix") + ((:euc-jp) "euc-jp") + ((:euc-jp :eol-style :lf) "euc-jp-unix") + ((:ascii) "us-ascii") + ((:ascii :eol-style :lf) "us-ascii-unix"))) + +(defimplementation find-external-format (coding-system) + (car (rassoc-if (lambda (x) (member coding-system x :test #'equal)) + *external-format-to-coding-system*))) + ;;; Unix signals (defun sigint-handler () @@ -362,13 +373,9 @@ (signal-error-data-base compiler::*error-database* ,location) (signal-undefined-functions compiler::*unknown-functions* ,location))))) -(defimplementation swank-compile-file (filename load-p - &optional external-format) +(defimplementation swank-compile-file (filename load-p external-format) (with-swank-compilation-unit (filename) - (let ((ef (if external-format - (find-external-format external-format) - :default))) - (compile-file filename :load load-p :external-format ef)))) + (compile-file filename :load load-p :external-format external-format))) (defvar *within-call-with-compilation-hooks* nil "Whether COMPILE-FILE was called from within CALL-WITH-COMPILATION-HOOKS.") --- /project/slime/cvsroot/slime/swank-allegro.lisp 2006/10/28 17:41:57 1.93 +++ /project/slime/cvsroot/slime/swank-allegro.lisp 2006/11/19 21:33:03 1.94 @@ -18,8 +18,6 @@ ;;; swank-mop -;; maybe better change MOP to ACLMOP ? -;; CLOS also works in ACL5. --he (import-swank-mop-symbols :clos '(:slot-definition-documentation)) (defun swank-mop:slot-definition-documentation (slot) @@ -44,25 +42,26 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) (declare (ignore buffering timeout)) - (let ((ef (or external-format :iso-latin-1-unix)) - (s (socket:accept-connection socket :wait t))) - (set-external-format s ef) + (let ((s (socket:accept-connection socket :wait t))) + (when external-format + (setf (stream-external-format s) external-format)) s)) -(defun find-external-format (coding-system) - #+(version>= 6) - (let* ((name (ecase coding-system - (:iso-latin-1-unix :latin1) - (:utf-8-unix :utf8) - (:emacs-mule-unix :emacs-mule)))) - (excl:crlf-base-ef (excl:find-external-format name :try-variant t))) - #-(version>= 6) - (ecase coding-system - (:iso-latin-1-unix :default))) - -(defun set-external-format (stream external-format) - (setf (stream-external-format stream) - (find-external-format external-format))) +(defvar *external-format-to-coding-system* + '((:iso-8859-1 + "latin-1" "latin-1-unix" "iso-latin-1-unix" + "iso-8859-1" "iso-8859-1-unix") + (:utf-8 "utf-8" "utf-8-unix") + (:euc-jp "euc-jp" "euc-jp-unix") + (:us-ascii "us-ascii" "us-ascii-unix") + (:emacs-mule "emacs-mule" "emacs-mule-unix"))) + +(defimplementation find-external-format (coding-system) + (let ((e (rassoc-if (lambda (x) (member coding-system x :test #'equal)) + *external-format-to-coding-system*))) + (and e (excl:crlf-base-ef + (excl:find-external-format (car e) + :try-variant t))))) (defimplementation format-sldb-condition (c) (princ-to-string c)) @@ -237,7 +236,6 @@ (member (type-of object) '(excl::compiler-note compiler::compiler-note))) (defun compiler-undefined-functions-called-warning-p (object) - #+(version>= 6) (typep object 'excl:compiler-undefined-functions-called-warning)) (deftype compiler-note () @@ -292,16 +290,12 @@ ) (funcall function))) -(defimplementation swank-compile-file (filename load-p - &optional external-format) +(defimplementation swank-compile-file (filename load-p external-format) (with-compilation-hooks () (let ((*buffer-name* nil) - (*compile-filename* filename) - (ef (if external-format - (find-external-format external-format) - :default))) + (*compile-filename* filename)) (compile-file *compile-filename* :load-after-compile load-p - :external-format ef)))) + :external-format external-format)))) (defun call-with-temp-file (fn) (let ((tmpname (system:make-temp-file-name))) --- /project/slime/cvsroot/slime/swank-corman.lisp 2006/08/10 11:53:35 1.9 +++ /project/slime/cvsroot/slime/swank-corman.lisp 2006/11/19 21:33:03 1.10 @@ -239,10 +239,8 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore buffering timeout)) - (ecase (or external-format :iso-latin-1-unix) - (:iso-latin-1-unix - (sockets:make-socket-stream (sockets:accept-socket socket))))) + (declare (ignore buffering timeout external-format)) + (sockets:make-socket-stream (sockets:accept-socket socket))) ;;; Misc @@ -367,7 +365,7 @@ (funcall fn))) (defimplementation swank-compile-file (*compile-filename* load-p - &optional external-format) + external-format) (declare (ignore external-format)) (with-compilation-hooks () (let ((*buffer-name* nil)) --- /project/slime/cvsroot/slime/swank-ecl.lisp 2006/08/10 11:53:35 1.6 +++ /project/slime/cvsroot/slime/swank-ecl.lisp 2006/11/19 21:33:03 1.7 @@ -1,6 +1,10 @@ -;;;; -*- Mode: lisp; indent-tabs-mode: nil -*- +;;;; -*- indent-tabs-mode: nil -*- ;;; ;;; swank-ecl.lisp --- SLIME backend for ECL. +;;; +;;; This code has been placed in the Public Domain. All warranties +;;; are disclaimed. +;;; ;;; Administrivia @@ -42,11 +46,10 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore buffering timeout)) - (assert (eq external-format :iso-latin-1-unix)) - (make-socket-io-stream (accept socket) external-format)) + (declare (ignore buffering timeout external-format)) + (make-socket-io-stream (accept socket))) -(defun make-socket-io-stream (socket external-format) +(defun make-socket-io-stream (socket) (sb-bsd-sockets:socket-make-stream socket :output t :input t @@ -118,7 +121,7 @@ (funcall function))) (defimplementation swank-compile-file (*compile-filename* load-p - &optional external-format) + external-format) (declare (ignore external-format)) (with-compilation-hooks () (let ((*buffer-name* nil)) --- /project/slime/cvsroot/slime/swank-scl.lisp 2006/09/13 22:56:14 1.11 +++ /project/slime/cvsroot/slime/swank-scl.lisp 2006/11/19 21:33:03 1.12 @@ -38,7 +38,7 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (let ((external-format (or external-format :iso-latin-1-unix)) + (let ((external-format (or external-format :default)) (buffering (or buffering :full)) (fd (socket-fd socket))) (loop @@ -68,17 +68,20 @@ (let ((hostent (ext:lookup-host-entry hostname))) (car (ext:host-entry-addr-list hostent)))) -(defun find-external-format (coding-system) - (case coding-system - (:iso-latin-1-unix :iso-8859-1) - (:utf-8-unix :utf-8) - (:euc-jp-unix :euc-jp) - (t coding-system))) +(defvar *external-format-to-coding-system* + '((:iso-8859-1 + "latin-1" "latin-1-unix" "iso-latin-1-unix" + "iso-8859-1" "iso-8859-1-unix") + (:utf-8 "utf-8" "utf-8-unix") + (:euc-jp "euc-jp" "euc-jp-unix"))) + +(defimplementation find-external-format (coding-system) + (car (rassoc-if (lambda (x) (member coding-system x :test #'equal)) + *external-format-to-coding-system*))) (defun make-socket-io-stream (fd external-format buffering) "Create a new input/output fd-stream for 'fd." - (let* ((external-format (find-external-format external-format)) - (stream (sys:make-fd-stream fd :input t :output t + (let* ((stream (sys:make-fd-stream fd :input t :output t :element-type 'base-char :buffering buffering :external-format external-format))) @@ -374,21 +377,17 @@ (c::warning #'handle-notification-condition)) (funcall function)))) -(defimplementation swank-compile-file (filename load-p - &optional external-format) - (let ((external-format (if external-format - (find-external-format external-format) - :default))) - (with-compilation-hooks () - (let ((*buffer-name* nil) - (ext:*ignore-extra-close-parentheses* nil)) - (multiple-value-bind (output-file warnings-p failure-p) - (compile-file filename :external-format external-format) - (unless failure-p - ;; Cache the latest source file for definition-finding. - (source-cache-get filename (file-write-date filename)) - (when load-p (load output-file))) - (values output-file warnings-p failure-p)))))) +(defimplementation swank-compile-file (filename load-p external-format) + (with-compilation-hooks () + (let ((*buffer-name* nil) + (ext:*ignore-extra-close-parentheses* nil)) + (multiple-value-bind (output-file warnings-p failure-p) + (compile-file filename :external-format external-format) + (unless failure-p + ;; Cache the latest source file for definition-finding. + (source-cache-get filename (file-write-date filename)) + (when load-p (load output-file))) + (values output-file warnings-p failure-p))))) (defimplementation swank-compile-string (string &key buffer position directory) (declare (ignore directory)) --- /project/slime/cvsroot/slime/swank-abcl.lisp 2006/08/10 11:53:35 1.40 +++ /project/slime/cvsroot/slime/swank-abcl.lisp 2006/11/19 21:33:03 1.41 @@ -1,4 +1,4 @@ -;;;; -*- Mode: lisp; indent-tabs-mode: nil; outline-regexp: ";;;;;*"; -*- +;;;; -*- indent-tabs-mode: nil; outline-regexp: ";;;;;*"; -*- ;;; ;;; swank-abcl.lisp --- Armedbear CL specific code for SLIME. ;;; @@ -135,8 +135,7 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore buffering timeout)) - (assert (member external-format '(nil :iso-latin-1-unix))) + (declare (ignore buffering timeout external-format)) (ext:get-socket-stream (ext:socket-accept socket))) ;;;; Unix signals @@ -303,8 +302,7 @@ (defvar *abcl-signaled-conditions*) -(defimplementation swank-compile-file (filename load-p - &optional external-format) +(defimplementation swank-compile-file (filename load-p external-format) (declare (ignore external-format)) (let ((jvm::*resignal-compiler-warnings* t) (*abcl-signaled-conditions* nil)) --- /project/slime/cvsroot/slime/swank-openmcl.lisp 2006/08/14 20:44:20 1.112 +++ /project/slime/cvsroot/slime/swank-openmcl.lisp 2006/11/19 21:33:03 1.113 @@ -168,9 +168,7 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore buffering timeout)) - (let ((ef (or external-format :iso-latin-1-unix))) - (assert (eq ef :iso-latin-1-unix))) + (declare (ignore buffering timeout external-format)) (ccl:accept-connection socket :wait t)) (defimplementation emacs-connected () @@ -298,8 +296,7 @@ (handler-bind ((ccl::compiler-warning 'handle-compiler-warning)) (funcall function))) -(defimplementation swank-compile-file (filename load-p - &optional external-format) +(defimplementation swank-compile-file (filename load-p external-format) (declare (ignore external-format)) (with-compilation-hooks () (let ((*buffer-name* nil) From heller at common-lisp.net Tue Nov 21 20:35:44 2006 From: heller at common-lisp.net (heller) Date: Tue, 21 Nov 2006 15:35:44 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061121203544.C8EED1E001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9898 Modified Files: swank.lisp Log Message: (*coding-system*): "Coding systems" are now strings instead of keywords. Set it to "iso-latin-1-unix". --- /project/slime/cvsroot/slime/swank.lisp 2006/11/19 21:27:35 1.418 +++ /project/slime/cvsroot/slime/swank.lisp 2006/11/21 20:35:44 1.419 @@ -182,8 +182,6 @@ ;;; used solely to pipe user-output to Emacs (an optimization). ;;; -(defvar *coding-system* ':iso-latin-1-unix) - (defstruct (connection (:conc-name connection.) (:print-function print-connection)) @@ -412,6 +410,8 @@ "The buffering scheme that should be used for the output stream. Valid values are :none, :line, and :full.") +(defvar *coding-system* "iso-latin-1-unix") + (defun start-server (port-file &key (style *communication-style*) (dont-close *dont-close*) (coding-system *coding-system*)) From heller at common-lisp.net Tue Nov 21 20:36:57 2006 From: heller at common-lisp.net (heller) Date: Tue, 21 Nov 2006 15:36:57 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061121203657.4E317210B6@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9951 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/19 21:25:15 1.1002 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/21 20:36:56 1.1003 @@ -1,3 +1,8 @@ +2006-11-21 Helmut Eller + + * swank.lisp (*coding-system*): "Coding systems" are now strings + instead of keywords. + 2006-11-19 Helmut Eller * slime.el (slime-compile-file): Let the Lisp side choose the From heller at common-lisp.net Tue Nov 21 21:58:47 2006 From: heller at common-lisp.net (heller) Date: Tue, 21 Nov 2006 16:58:47 -0500 (EST) Subject: [slime-cvs] CVS slime/doc Message-ID: <20061121215847.D026B4C3E1@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory clnet:/tmp/cvs-serv28702 Modified Files: slime.texi Log Message: Documentation patch for swank:create-server from Ury Marshak . --- /project/slime/cvsroot/slime/doc/slime.texi 2006/09/20 18:37:47 1.48 +++ /project/slime/cvsroot/slime/doc/slime.texi 2006/11/21 21:58:47 1.49 @@ -34,7 +34,7 @@ @end macro @set EDITION 2.0 - at set UPDATED @code{$Date: 2006/09/20 18:37:47 $} + at set UPDATED @code{$Date: 2006/11/21 21:58:47 $} @titlepage @title SLIME User Manual @@ -1460,10 +1460,8 @@ inside a running lisp image at footnote{@SLIME{} also provides an @acronym{ASDF} system definiton which does the same thing}. Now all we -need to do is startup our swank server. This example assumes we're -using the default settings, if you need to do anything particular -(like be able to reconnect to swank after you're done, look into - at code{swank:create-server}'s other arguments). +need to do is startup our swank server. The first example assumes we're +using the default settings. @example (swank:create-server) @@ -1480,6 +1478,38 @@ (setf swank:*use-dedicated-output-stream* nil) @end example +If you need to do anything particular +(like be able to reconnect to swank after you're done), look into + at code{swank:create-server}'s other arguments. Some of these arguments +are + at table @code + + at item :PORT +Port number for the server to listen on (default: 4005). + at item :STYLE +See @xref{Communication style}. + at item :DONT-CLOSE +Boolean indicating if the server will continue to accept connections +after the first one (default: @code{NIL}). For ``long-running'' lisp processes +to which you want to be able to connect from time to time, +specify @code{:dont-close t} + at item :CODING-SYSTEM +String designating the encoding to be used to communicate between the +Emacs and Lisp. + at end table + +So the more complete example will be + at example +(swank:create-server :port 4005 :dont-close t :coding-system "utf-8-unix") + at end example +On the emacs side you will use something like + at example +(setq slime-net-coding-system 'utf-8-unix) +(slime-connect "127.0.0.1" 4005)) + at end example +to connect to this lisp image from the same machine. + + @node Setting up Emacs @subsection Setting up Emacs From heller at common-lisp.net Tue Nov 21 21:59:25 2006 From: heller at common-lisp.net (heller) Date: Tue, 21 Nov 2006 16:59:25 -0500 (EST) Subject: [slime-cvs] CVS slime/doc Message-ID: <20061121215925.DFB634C3E1@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory clnet:/tmp/cvs-serv28798 Modified Files: Makefile Log Message: Add copyright note. --- /project/slime/cvsroot/slime/doc/Makefile 2006/04/19 16:00:25 1.7 +++ /project/slime/cvsroot/slime/doc/Makefile 2006/11/21 21:59:25 1.8 @@ -1,3 +1,5 @@ +# This file has been placed in the public domain. +# # Where to put the info file(s). NB: the GNU Coding Standards (GCS) # and the Filesystem Hierarchy Standard (FHS) differ on where info # files belong. The GCS says /usr/local/info; the FHS says From heller at common-lisp.net Tue Nov 21 22:00:22 2006 From: heller at common-lisp.net (heller) Date: Tue, 21 Nov 2006 17:00:22 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061121220022.B64CE5412D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28834 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/21 20:36:56 1.1003 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/21 22:00:22 1.1004 @@ -10,6 +10,8 @@ (slime-coding): Deleted. * swank.lisp (compile-file-for-emacs): Use guess-external-format. + (swank:create-server): no more accepts an :external-format 'enc , + use :coding-system "enc" instead. * swank-backend.lisp (find-external-format) (guess-external-format): New. From jcunningham at common-lisp.net Wed Nov 22 06:27:38 2006 From: jcunningham at common-lisp.net (jcunningham) Date: Wed, 22 Nov 2006 01:27:38 -0500 (EST) Subject: [slime-cvs] CVS slime/doc Message-ID: <20061122062738.894842B213@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory clnet:/tmp/cvs-serv23049 Modified Files: Makefile slime.texi Added Files: slime-small.eps slime-small.pdf Log Message: Capturing first third of document changes. Added slime logo to front page. --- /project/slime/cvsroot/slime/doc/Makefile 2006/11/21 21:59:25 1.8 +++ /project/slime/cvsroot/slime/doc/Makefile 2006/11/22 06:27:38 1.9 @@ -14,23 +14,28 @@ # Info files generated here. infofiles=slime.info -all: slime.ps slime.info slime.pdf +TEXI = slime.texi contributors.texi -install: install-info +all: slime.ps slime.info slime.html slime.pdf -uninstall: uninstall-info +slime.dvi: $(TEXI) + texi2dvi slime.texi slime.ps: slime.dvi dvips -o $@ $< -slime.dvi: slime.texi contributors.texi - texi2dvi slime.texi +slime.info: $(TEXI) + makeinfo $< -slime.pdf: slime.texi contributors.texi +slime.html: $(TEXI) + texi2html $< + +slime.pdf: $(TEXI) texi2pdf $< -slime.info: slime.texi contributors.texi - makeinfo $< +install: install-info + +uninstall: uninstall-info # Create contributors.texi, a texinfo table listing all known # contributors of code. @@ -100,3 +105,4 @@ rm -f slime.info rm -f slime.pdf rm -f slime.ps + rm -f slime.html --- /project/slime/cvsroot/slime/doc/slime.texi 2006/11/21 21:58:47 1.49 +++ /project/slime/cvsroot/slime/doc/slime.texi 2006/11/22 06:27:38 1.50 @@ -8,9 +8,26 @@ @end direntry @c %**end of header + at set EDITION 2.0 + at c @set UPDATED @today{} + at set UPDATED @code{$Date: 2006/11/22 06:27:38 $} + at set TITLE SLIME User Manual + at settitle @value{TITLE}, version @value{EDITION} + + at titlepage + at title @value{TITLE} + at titlefont{version @value{EDITION}} + at sp 2 + at image{slime-small} + at sp 4 + at subtitle Compiled: @value{UPDATED} + at end titlepage + @c Written by Luke Gorrie. - at c + at c @c This file has been placed in the public domain. + at c + at c Modified by Jeff Cunningham. @macro SLIME @acronym{SLIME} @@ -33,20 +50,32 @@ @code{\command\}@* @end macro - at set EDITION 2.0 - at set UPDATED @code{$Date: 2006/11/21 21:58:47 $} + at macro kbdanchor{key, command} + at anchor{\command\} + at item \key\ + at code{\command\}@* + at end macro - at titlepage - at title SLIME User Manual - at subtitle The Superior Lisp Interaction Mode for Emacs - at subtitle @value{EDITION}, @value{UPDATED} - at author - at end titlepage + at macro kbdindex{key, command} + at item \key\ + at xref{\command\}. + at end macro - at c @setchapternewpage off + at macro fcnanchor{name} + at anchor{\name\} + at item M-x + at code{\name\}@* + at end macro + + at macro fcnindex{name} + at item \name\ + at xref{\name\}. + at end macro + at c @setchapternewpage off @contents + at c ----------------------- @node Top, Introduction, (dir), (dir) @ifinfo @@ -57,17 +86,20 @@ @end ifinfo @menu -* Introduction:: +* Introduction:: * Getting started:: -* slime-mode:: +* slime-mode:: * REPL:: * Debugger:: * Extras:: * Customization:: * Tips and Tricks:: * Credits:: +* Index to Key Bindings:: +* Index to Functions:: @end menu + at c ----------------------- @node Introduction, Getting started, Top, Top @chapter Introduction @@ -95,6 +127,7 @@ well-defined interface and implemented separately for each Lisp implementation. This makes @SLIME{} readily portable. + at c ----------------------- @node Getting started, slime-mode, Introduction, Top @chapter Getting started @@ -107,6 +140,7 @@ * Running:: @end menu + at c ----------------------- @node Platforms, Downloading, Getting started, Getting started @section Supported Platforms @@ -144,6 +178,7 @@ compiler-note annotations, @acronym{XREF} support, and fancy debugger commands (like ``restart frame''). + at c ----------------------- @node Downloading, Installation, Platforms, Getting started @section Downloading SLIME @@ -161,6 +196,7 @@ * CVS Incantations:: @end menu + at c ----------------------- @node CVS, CVS Incantations, Downloading, Downloading @subsection Downloading from CVS @@ -186,6 +222,7 @@ * CVS Incantations:: @end menu + at c ----------------------- @node CVS Incantations, , CVS, Downloading @subsection CVS incantations @@ -217,6 +254,7 @@ cvs diff -rHEAD ChangeLog # or: -rFAIRLY-STABLE @end example + at c ----------------------- @node Installation, Running, Downloading, Getting started @section Installation @@ -241,6 +279,7 @@ the keymap for Lisp source files that may be confusing and may not work correctly for a Lisp process started by @SLIME{}. + at c ----------------------- @node Running, , Installation, Getting started @section Running SLIME @@ -252,6 +291,13 @@ At this point @SLIME{} is up and running and you can start exploring. +You can restart the @code{inferior-lisp} process using the function: + at table @kbd + at fcnanchor{slime-restart-inferior-lisp} + at end table + + + at c ----------------------- @node slime-mode, REPL, Getting started, Top @chapter @code{slime-mode} @@ -266,6 +312,7 @@ * Reader conditionals:: @end menu + at c ----------------------- @node User-interface conventions, Commands, slime-mode, slime-mode @section User-interface conventions @@ -275,12 +322,13 @@ @menu * Temporary buffers:: -* Key bindings:: +* About key bindings:: * inferior-lisp:: * Multithreading:: @end menu - at node Temporary buffers, Key bindings, User-interface conventions, User-interface conventions + at c ----------------------- + at node Temporary buffers, About key bindings, User-interface conventions, User-interface conventions @subsection Temporary buffers Some @SLIME{} commands create temporary buffers to display their @@ -305,8 +353,9 @@ @SLIME{} commands available for describing symbols, looking up function definitions, and so on. - at node Key bindings, inferior-lisp, Temporary buffers, User-interface conventions - at subsection Key bindings + at c ----------------------- + at node About key bindings, inferior-lisp, Temporary buffers, User-interface conventions + at subsection About key bindings In general we try to make our key bindings fit with the overall Emacs style. We also have the following somewhat unusual convention of our @@ -326,7 +375,16 @@ 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 +You can assign or change default key bindings using the @code{global-set-key} +function in your @file{~/.emacs} file like this: + at example +(global-set-key "\C-cs" 'slime-selector) + at end example + at noindent +which binds @kbd{C-c s} to the function @code{global-set-key}. + + at c ----------------------- + at node inferior-lisp, Multithreading, About key bindings, User-interface conventions @subsection @code{*inferior-lisp*} buffer @SLIME{} internally uses the @code{inferior-lisp} package to start @@ -353,6 +411,7 @@ doesn't belong to @SLIME{}, and you should probably lookup our equivalent. + at c ----------------------- @node Multithreading, , inferior-lisp, User-interface conventions @subsection Multithreading @@ -379,316 +438,465 @@ swank:*default-worker-thread-bindings*). @end example + at c ----------------------- @node Commands, Semantic indentation, User-interface conventions, slime-mode @section Commands + at acronym{SLIME} commands are divided into the following general +categories: @strong{Programming, Compilation, Evaluation, Recovery, +Inspector, and Profiling}, discussed in separate sections below. There +are also comprehensive indices to commands by function (@pxref{Index +to Functions}) and by function (@pxref{Index to Key Bindings}). + @menu +* Programming:: * Compilation:: -* Finding definitions:: -* Lisp Evaluation:: -* Documentation:: -* Programming Helpers:: +* Evaluation:: * Recovery:: -* Cross-reference:: * Inspector:: * Profiling:: +* Other:: @end menu - at node Compilation, Finding definitions, Commands, Commands - at subsection Compilation commands + at c ----------------------- + at node Programming, Compilation, , Commands + at subsection Programming commands + +Programming commands are divided into the following categories: + at strong{Completion, Documentation, Coss-reference, Finding +definitions, Macro-expansion, and Disassembly}, discussed in +separate sections below. - at SLIME{} has fancy commands for compiling functions, files, and -packages. The fancy part is that notes and warnings offered by the -Lisp compiler are intercepted and annotated directly onto the -corresponding expressions in the Lisp source buffer. (Give it a try to -see what this means.) + at menu +* Completion:: +* Closure:: +* Indentation:: +* Documentation:: +* Cross-reference:: +* Finding definitions:: +* Macro-expansion:: +* Disassembly:: + at end menu + + at c ----------------------- + at node Completion, Closure, , Programming + at subsubsection Completion commands + +Completion commands are used to complete a symbol or form based on +what is already present at point. Classical completion assumes an +exact prefix and gives choices only where branches may occur. Fuzzy +completion tries harder. @table @kbd + at anchor{slime-complete-symbol} + at itemx M-TAB + at item C-c C-i + at item C-M-i + at code{slime-complete-symbol}@* +Complete the symbol at point. Note that three styles of completion are +available in @SLIME{}, and the default differs from normal Emacs +completion (@pxref{slime-complete-symbol-function}). + at xref{Emacs-side customization}. - at kbditem{C-c C-k, slime-compile-and-load-file} -Compile and load the current buffer's source file. + at kbdanchor{C-c C-s, slime-complete-form} +Looks up and inserts into the current buffer the argument list for the +function at point, if there is one. More generally, the command +completes an incomplete form with a template for the missing arguments. +There is special code for discovering extra keywords of generic +functions and for handling @code{make-instance} and + at code{defmethod}. Examples: - at kbditem{C-c M-k, slime-compile-file} -Compile (but don't load) the current buffer's source file. + at example +(subseq "abc" + --inserts--> start [end]) +(find 17 + --inserts--> sequence :from-end from-end :test test + :test-not test-not :start start :end end + :key key) +(find 17 '(17 18 19) :test #'= + --inserts--> :from-end from-end + :test-not test-not :start start :end end + :key key) +(defclass foo () ((bar :initarg :bar))) +(defmethod print-object + --inserts--> (object stream) + body...) +(defmethod initialize-instance :after ((object foo) &key blub)) +(make-instance 'foo + --inserts--> :bar bar :blub blub initargs...) + at end example - at kbditem{C-c C-c, slime-compile-defun} -Compile the top-level form at point. + at kbdanchor{C-c M-i, slime-fuzzy-complete-symbol} +Presents a list of likely completions to choose from for an +abbreviation at point. This is a third completion method and it is +very different from the more traditional completion to which + at command{slime-complete-symbol} defaults. It attempts to complete a +symbol all at once, instead of in pieces. For example, ``mvb'' will +find ``@code{multiple-value-bind}'' and ``norm-df'' will find +``@code{least-positive-normalized-double-float}''. This can also be +selected as the method of completion used for + at code{slime-complete-symbol}. + at fcnanchor{slime-fuzzy-completions-mode} + at fcnanchor{slime-fuzzy-abort} @end table -The annotations are indicated as underlining on source forms. The -compiler message associated with an annotation can be read either by -placing the mouse over the text or with the selection commands below. - at table @kbd - - at item M-n - at itemx M-p - at code{slime-next-note, slime-previous-note}@* -These commands move the point between compiler notes and display the new note. + at c ----------------------- + at node Closure, Indentation, Completion, Programming + at subsubsection Closure commands - at kbditem{C-c M-c, slime-remove-notes} -Remove all annotations from the buffer. - - at end table - - at node Finding definitions, Lisp Evaluation, Compilation, Commands - at subsection Finding definitions (``Meta-Point''). - -The familiar @kbd{M-.} command is provided. For generic functions this -command finds all methods, and with some systems it does other fancy -things (like tracing structure accessors to their @code{DEFSTRUCT} -definition). +Closure commands are used to fill in missing parenthesis. @table @kbd + at kbdanchor{C-c C-q, slime-close-parens-at-point} +Closes parentheses at point to complete the top-level-form by inserting ')' +characters at until @code{beginning-of-defun} and @code{end-of-defun} +execute without errors, or @code{slime-close-parens-limit} is exceeded. - at kbditem{M-., slime-edit-definition} -Go to the definition of the symbol at point. - - at item M-, - at code{slime-pop-find-definition-stack} -Go back from a definition found with @kbd{M-.}. This gives multi-level -backtracking when @kbd{M-.} has been used several times. + at kbdanchor{C-], slime-close-all-sexp} +Balance parentheses of open s-expressions at point. +Insert enough right-parentheses to balance unmatched left-parentheses. +Delete extra left-parentheses. Reformat trailing parentheses +Lisp-stylishly. +If @code{REGION} is true, operate on the region. Otherwise operate on [1894 lines skipped] --- /project/slime/cvsroot/slime/doc/slime-small.eps 2006/11/22 06:27:38 NONE +++ /project/slime/cvsroot/slime/doc/slime-small.eps 2006/11/22 06:27:38 1.1 [2889 lines skipped] --- /project/slime/cvsroot/slime/doc/slime-small.pdf 2006/11/22 06:27:38 NONE +++ /project/slime/cvsroot/slime/doc/slime-small.pdf 2006/11/22 06:27:38 1.1 [2988 lines skipped] From heller at common-lisp.net Wed Nov 22 15:29:23 2006 From: heller at common-lisp.net (heller) Date: Wed, 22 Nov 2006 10:29:23 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061122152923.67D031C008@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv7830 Modified Files: ChangeLog Log Message: (slime-edit-definition): Don't hide error messages. --- /project/slime/cvsroot/slime/ChangeLog 2006/11/21 22:00:22 1.1004 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/22 15:29:23 1.1005 @@ -1,3 +1,7 @@ +2006-11-22 Helmut Eller + + * slime.el (slime-edit-definition): Don't hide error messages. + 2006-11-21 Helmut Eller * swank.lisp (*coding-system*): "Coding systems" are now strings From heller at common-lisp.net Wed Nov 22 15:29:39 2006 From: heller at common-lisp.net (heller) Date: Wed, 22 Nov 2006 10:29:39 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061122152939.7C3C41C0B5@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv7874 Modified Files: slime.el Log Message: (slime-edit-definition): Don't hide error messages. --- /project/slime/cvsroot/slime/slime.el 2006/11/19 21:26:36 1.689 +++ /project/slime/cvsroot/slime/slime.el 2006/11/22 15:29:37 1.690 @@ -6683,10 +6683,7 @@ (interactive (list (slime-read-symbol-name "Name: "))) (let ((definitions (slime-eval `(swank:find-definitions-for-emacs ,name)))) (cond - ((or (null definitions) - (every (lambda (definition) - (eq :error (caadr definition))) - definitions)) + ((null definitions) (if slime-edit-definition-fallback-function (funcall slime-edit-definition-fallback-function name) (error "No known definition for: %s" name))) From heller at common-lisp.net Thu Nov 23 23:10:40 2006 From: heller at common-lisp.net (heller) Date: Thu, 23 Nov 2006 18:10:40 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061123231040.8CE972E183@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12897 Modified Files: slime.el Log Message: Suggestions from Antonio Menezes Leitao: (slime-search-buffer-package): Prettify the package name if it is written as string or keyword. (slime-in-expression-p): Use `read' and `eq' to test the first element of the list. Previuosly, the pattern (foo) wrongly matched (foobar) because we used (looking-at ). --- /project/slime/cvsroot/slime/slime.el 2006/11/22 15:29:37 1.690 +++ /project/slime/cvsroot/slime/slime.el 2006/11/23 23:10:40 1.691 @@ -2488,24 +2488,31 @@ (defvar slime-find-buffer-package-function 'slime-search-buffer-package "*Function to use for `slime-find-buffer-package'. -The result should be a string. The string will be READ at the Lisp -side.") +The result should be the package-name (a string) +or nil if nothing suitable can be found.") (defun slime-find-buffer-package () "Figure out which Lisp package the current buffer is associated with." (funcall slime-find-buffer-package-function)) +;; When modifing this code consider cases like: +;; (in-package #.*foo*) +;; (in-package #:cl) +;; (in-package :cl) +;; (in-package "CL") +;; (in-package |CL|) +;; (in-package #+ansi-cl :cl #-ansi-cl 'lisp) (defun slime-search-buffer-package () - (save-excursion - (when (let ((case-fold-search t) - (regexp "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \n\t\r']*")) - (or (re-search-backward regexp nil t) - (re-search-forward regexp nil t))) - (goto-char (match-end 0)) - (let ((start (point))) - (ignore-errors - (up-list 1) - (buffer-substring-no-properties start (1- (point)))))))) + (let ((case-fold-search t) + (regexp (concat "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \n\t\r']*" + "\\([^)]+\\)[ \n\t]*)"))) + (save-excursion + (when (or (re-search-backward regexp nil t) + (re-search-forward regexp nil t)) + (let ((string (match-string-no-properties 2))) + (cond ((string-match "^\"" string) (ignore-errors (read string))) + ((string-match "^#?:" string) (substring string (match-end 0))) + (t string))))))) ;;; Synchronous requests are implemented in terms of asynchronous ;;; ones. We make an asynchronous request with a continuation function @@ -7190,18 +7197,18 @@ "A helper function to determine the current context. The pattern can have the form: pattern ::= () ;matches always - | (*) ;matches insde a list + | (*) ;matches inside a list | ( ) ;matches if the first element in - ; current the list is and + ; the current list is and ; if matches. - | (()) ;matches if are in a nested list." + | (()) ;matches if we are in a nested list." (save-excursion (let ((path (reverse (slime-pattern-path pattern)))) (loop for p in path always (ignore-errors (etypecase p (symbol (slime-beginning-of-list) - (looking-at (symbol-name p))) + (eq (read (current-buffer)) p)) (number (backward-up-list p) t))))))) From heller at common-lisp.net Thu Nov 23 23:13:28 2006 From: heller at common-lisp.net (heller) Date: Thu, 23 Nov 2006 18:13:28 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061123231328.990AD6F23D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13860 Modified Files: swank-cmucl.lisp Log Message: (setf-definitions): Also include defs which were created with (defun (setf NAME) ...). Previously we only found definitions created with defsetf of define-setf-expander. --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/11/19 21:33:03 1.167 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/11/23 23:13:27 1.168 @@ -1137,7 +1137,10 @@ (defun setf-definitions (name) (let ((function (or (ext:info :setf :inverse name) - (ext:info :setf :expander name)))) + (ext:info :setf :expander name) + (and (symbolp name) + (fboundp `(setf ,name)) + (fdefinition `(setf ,name)))))) (if function (list (list `(setf ,name) (function-location (coerce function 'function))))))) From heller at common-lisp.net Thu Nov 23 23:14:41 2006 From: heller at common-lisp.net (heller) Date: Thu, 23 Nov 2006 18:14:41 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061123231441.C1C8A3301F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14181 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/22 15:29:23 1.1005 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/23 23:14:37 1.1006 @@ -1,3 +1,18 @@ +2006-11-24 Helmut Eller + + * slime.el (slime-search-buffer-package): Prettify the package + name if it is written as string or keyword. + +2006-11-23 Helmut Eller + + * slime.el (slime-in-expression-p): Use `read' and `eq' to test + the first element of the list. Previuosly, the pattern (foo) + wrongly matched (foobar) because we used (looking-at ). + + * swank-cmucl.lisp (setf-definitions): Also include defs which + were created with (defun (setf NAME) ...). Previously we only + found definitions created with defsetf or define-setf-expander. + 2006-11-22 Helmut Eller * slime.el (slime-edit-definition): Don't hide error messages. From heller at common-lisp.net Fri Nov 24 23:33:52 2006 From: heller at common-lisp.net (heller) Date: Fri, 24 Nov 2006 18:33:52 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061124233352.B813F3301E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv22426 Modified Files: slime.el Log Message: (slime-repl-read-break): Use a :emacs-interrupt message instead of a RPC to swank:simple-break. Suggested by Taylor R Campbell. (slime-dispatch-event, slime-interrupt): Decide whether to use SIGINT or a :emacs-interrupt message in slime-interrupt. --- /project/slime/cvsroot/slime/slime.el 2006/11/23 23:10:40 1.691 +++ /project/slime/cvsroot/slime/slime.el 2006/11/24 23:33:52 1.692 @@ -2648,8 +2648,7 @@ (assert thread) (sldb-exit thread level stepping)) ((:emacs-interrupt thread) - (cond ((slime-use-sigint-for-interrupt) (slime-send-sigint)) - (t (slime-send `(:emacs-interrupt ,thread))))) + (slime-send `(:emacs-interrupt ,thread))) ((:read-string thread tag) (assert thread) (slime-repl-read-string thread tag)) @@ -4245,7 +4244,7 @@ (defun slime-repl-read-break () (interactive) - (slime-eval-async `(swank:simple-break))) + (slime-dispatch-event `(:emacs-interrupt ,(car slime-read-string-threads)))) (defun slime-repl-abort-read (thread tag) (with-current-buffer (slime-output-buffer) @@ -7835,7 +7834,8 @@ (defun slime-interrupt () "Interrupt Lisp." (interactive) - (slime-dispatch-event `(:emacs-interrupt ,slime-current-thread))) + (cond ((slime-use-sigint-for-interrupt) (slime-send-sigint)) + (t (slime-dispatch-event `(:emacs-interrupt ,slime-current-thread))))) (defun slime-quit () (error "Not implemented properly. Use `slime-interrupt' instead.")) From heller at common-lisp.net Fri Nov 24 23:34:58 2006 From: heller at common-lisp.net (heller) Date: Fri, 24 Nov 2006 18:34:58 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061124233458.A03F936009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv22477 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/11/23 23:14:37 1.1006 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/24 23:34:58 1.1007 @@ -1,3 +1,9 @@ +2006-11-25 Helmut Eller + + * slime.el (slime-repl-read-break): Use a :emacs-interrupt message + instead of a RPC to swank:simple-break. Suggested by Taylor R + Campbell. + 2006-11-24 Helmut Eller * slime.el (slime-search-buffer-package): Prettify the package From jsnellman at common-lisp.net Sun Nov 26 18:03:12 2006 From: jsnellman at common-lisp.net (jsnellman) Date: Sun, 26 Nov 2006 13:03:12 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061126180312.193FA37014@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5900 Modified Files: ChangeLog slime.el Log Message: Restore the way M-n and M-p used to work in the REPL. (cherry-picked from a patch with other changes, sent by Attila Lendvai). * slime.el (slime-repl-previous-input-starting-with-current-input) (slime-repl-next-input-starting-with-current-input): New functions, work like the old slime-repl-previous-input / next-input. (slime-repl-matching-input-regexp): Restore old version. (slime-repl-mode-map): Bind s-r-p-i-s-w-c-i and s-r-n-i-s-w-c-i to M-p and M-n respectively. slime-repl-previous-input and slime-repl-next-input are still accessible with C-up / C-down. --- /project/slime/cvsroot/slime/ChangeLog 2006/11/24 23:34:58 1.1007 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/26 18:03:11 1.1008 @@ -1,3 +1,16 @@ +2006-11-26 Juho Snellman + + Restore the way M-n and M-p used to work in the REPL. (cherry-picked + from a patch with other changes, sent by Attila Lendvai). + + * slime.el (slime-repl-previous-input-starting-with-current-input) + (slime-repl-next-input-starting-with-current-input): New functions, + work like the old slime-repl-previous-input / next-input. + (slime-repl-matching-input-regexp): Restore old version. + (slime-repl-mode-map): Bind s-r-p-i-s-w-c-i and s-r-n-i-s-w-c-i + to M-p and M-n respectively. slime-repl-previous-input and + slime-repl-next-input are still accessible with C-up / C-down. + 2006-11-25 Helmut Eller * slime.el (slime-repl-read-break): Use a :emacs-interrupt message --- /project/slime/cvsroot/slime/slime.el 2006/11/24 23:33:52 1.692 +++ /project/slime/cvsroot/slime/slime.el 2006/11/26 18:03:11 1.693 @@ -4011,6 +4011,20 @@ (interactive) (slime-repl-history-replace 'forward nil t)) +(defun slime-repl-matching-input-regexp () + (if (memq last-command + '(slime-repl-previous-input-starting-with-current-input slime-repl-next-input-starting-with-current-input)) + slime-repl-history-pattern + (concat "^" (regexp-quote (slime-repl-current-input))))) + +(defun slime-repl-previous-input-starting-with-current-input () + (interactive) + (slime-repl-history-replace 'backward (slime-repl-matching-input-regexp) t)) + +(defun slime-repl-next-input-starting-with-current-input () + (interactive) + (slime-repl-history-replace 'forward (slime-repl-matching-input-regexp) t)) + (defun slime-repl-continue-search-with-last-pattern () (interactive) (when slime-repl-history-pattern @@ -4167,9 +4181,9 @@ ("\C-a" 'slime-repl-bol) ([home] 'slime-repl-bol) ("\C-e" 'slime-repl-eol) - ("\M-p" 'slime-repl-previous-input) + ("\M-p" 'slime-repl-previous-input-starting-with-current-input) ((kbd "C-") 'slime-repl-previous-input) - ("\M-n" 'slime-repl-next-input) + ("\M-n" 'slime-repl-next-input-starting-with-current-input) ((kbd "C-") 'slime-repl-next-input) ("\M-r" 'slime-repl-previous-matching-input) ("\M-s" 'slime-repl-next-matching-input) @@ -6797,8 +6811,8 @@ (save-match-data (when (and (buffer-file-name) (slime-background-activities-enabled-p)) - (let ((filename (slime-to-lisp-filename (buffer-file-name)))) - (slime-eval-async `(swank:buffer-first-change ,filename))))))) + (let ((filename (slime-to-lisp-filename (buffer-file-name)))) + (slime-eval-async `(swank:buffer-first-change ,filename))))))) (defun slime-setup-first-change-hook () (add-hook (make-local-variable 'first-change-hook) From jsnellman at common-lisp.net Sun Nov 26 18:08:30 2006 From: jsnellman at common-lisp.net (jsnellman) Date: Sun, 26 Nov 2006 13:08:30 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061126180830.8FFF1710D2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6289 Modified Files: ChangeLog swank-source-file-cache.lisp Log Message: * swank-source-file-cache.lisp (buffer-first-change): Check whether a file exists before trying load it into the source cache. --- /project/slime/cvsroot/slime/ChangeLog 2006/11/26 18:03:11 1.1008 +++ /project/slime/cvsroot/slime/ChangeLog 2006/11/26 18:08:30 1.1009 @@ -1,5 +1,10 @@ 2006-11-26 Juho Snellman + * swank-source-file-cache.lisp (buffer-first-change): Check + whether a file exists before trying load it into the source cache. + +2006-11-26 Juho Snellman + Restore the way M-n and M-p used to work in the REPL. (cherry-picked from a patch with other changes, sent by Attila Lendvai). --- /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/11/19 21:28:41 1.5 +++ /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/11/26 18:08:30 1.6 @@ -41,8 +41,10 @@ (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))))) + (unless (or (source-cached-p filename) + (not (ignore-errors (probe-file filename)))) + (ignore-errors + (source-cache-get filename (file-write-date filename))))) (defun get-source-code (filename code-date) "Return the source code for FILENAME as written on DATE in a string.