From heller at common-lisp.net Mon Jun 2 18:11:16 2008 From: heller at common-lisp.net (heller) Date: Mon, 2 Jun 2008 14:11:16 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20080602181116.62D7747005@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv10105 Modified Files: ChangeLog swank-cmucl.lisp Log Message: Unicode support for CMUCL (by Raymond Toy) * swank-cmucl.lisp (accept-connection, make-socket-io-stream): Handle external-format argument. (find-external-format): Implemented. (*external-format-to-coding-system*): New variable. --- /project/slime/cvsroot/slime/ChangeLog 2008/05/19 13:12:52 1.1356 +++ /project/slime/cvsroot/slime/ChangeLog 2008/06/02 18:11:15 1.1357 @@ -1,3 +1,12 @@ +2008-06-02 Raymond Toy + + Unicode support for CMUCL. + + * swank-cmucl.lisp (accept-connection, make-socket-io-stream): + Handle external-format argument. + (find-external-format): Implemented. + (*external-format-to-coding-system*): New variable. + 2008-05-19 Helmut Eller * swank-sbcl.lisp: Don't require asdf. --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2008/04/17 14:56:43 1.179 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2008/06/02 18:11:16 1.180 @@ -100,9 +100,10 @@ (defimplementation accept-connection (socket &key external-format buffering timeout) - (declare (ignore timeout external-format)) - (let ((buffering (or buffering :full))) - (make-socket-io-stream (ext:accept-tcp-connection socket) buffering))) + (declare (ignore timeout)) + (make-socket-io-stream (ext:accept-tcp-connection socket) + (or buffering :full) + (or external-format :iso-latin-1-unix))) ;;;;; Sockets @@ -117,10 +118,24 @@ (let ((hostent (ext:lookup-host-entry hostname))) (car (ext:host-entry-addr-list hostent)))) -(defun make-socket-io-stream (fd buffering) +(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") + #+unicode + (:utf-8 "utf-8" "utf-8-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 buffering external-format) "Create a new input/output fd-stream for FD." + #-unicode(declare (ignore external-format)) (sys:make-fd-stream fd :input t :output t :element-type 'base-char - :buffering buffering)) + :buffering buffering + #+unicode :external-format + #+unicode external-format)) ;;;;; Signal-driven I/O From heller at common-lisp.net Mon Jun 2 18:24:41 2008 From: heller at common-lisp.net (heller) Date: Mon, 2 Jun 2008 14:24:41 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20080602182441.8D2BA5909F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14434 Modified Files: swank-cmucl.lisp Log Message: (accept-connection): Fix the typo that I introduced. --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2008/06/02 18:11:16 1.180 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2008/06/02 18:24:41 1.181 @@ -103,7 +103,7 @@ (declare (ignore timeout)) (make-socket-io-stream (ext:accept-tcp-connection socket) (or buffering :full) - (or external-format :iso-latin-1-unix))) + (or external-format :iso-8859-1))) ;;;;; Sockets From trittweiler at common-lisp.net Sat Jun 7 11:44:22 2008 From: trittweiler at common-lisp.net (trittweiler) Date: Sat, 7 Jun 2008 07:44:22 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20080607114422.CC04D531A3@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28594 Modified Files: slime.el Log Message: * slime.el (slime-extract-context, slime-parse-context): Recognize more toplevel forms, e.g. DEFINE-COMPILER-MACRO &c. Such that `slime-parse-toplevel-form' will also recognize these. (slime-trace-query): Adapted to above changes. Errors if spec is untraceable. (slime-call-defun): Adapted to also support the new toplevel forms. (slime-cl-symbol-name), (slime-cl-symbol-package), (slime-qualify-cl-symbol-name): Resurrected from the `slime-parse' contrib, as they've been used by `slime-call-defun'. --- /project/slime/cvsroot/slime/slime.el 2008/05/17 11:03:19 1.939 +++ /project/slime/cvsroot/slime/slime.el 2008/06/07 11:44:21 1.940 @@ -4499,7 +4499,8 @@ (if (eql (aref el 0) ?\() (let ((spec (read el))) (if (eq (car spec) 'EQL) - (concat ".*?\\n\\{0,1\\}.*?(EQL.*?'\\{0,1\\}" (format "%s" (second spec)) ")") + (concat ".*?\\n\\{0,1\\}.*?(EQL.*?'\\{0,1\\}" + (format "%s" (second spec)) ")") (error "don't understand specializer: %s,%s" el (car spec)))) (concat ".+?\n\\{0,1\\}.+?\\<" el "\\>"))) (remove "T" specializers) "")) @@ -4565,73 +4566,6 @@ (slime-search-call-site fname))) (point))) -(defmacro slime-point-moves-p (&rest body) - "Execute BODY and return true if the current buffer's point moved." - (let ((pointvar (gensym "point-"))) - `(let ((,pointvar (point))) - (save-current-buffer , at body) - (/= ,pointvar (point))))) - -(put 'slime-point-moves-p 'lisp-indent-function 0) - -(defun slime-forward-sexp (&optional count) - "Like `forward-sexp', but understands reader-conditionals (#- and #+)." - (dotimes (i (or count 1)) - (while (slime-point-moves-p (slime-forward-blanks) - (slime-forward-reader-comment) - (slime-forward-reader-conditional))) - (forward-sexp))) - -(defun slime-forward-blanks () - "Move forward over all whitespace and newlines at point." - (ignore-errors - (while (slime-point-moves-p - (skip-syntax-forward " ") - ;; newlines aren't in lisp-mode's whitespace syntax class - (when (eolp) (forward-char)))))) - -;; Emacs 21's forward-sexp understands #| |# comments in lisp-mode -;; buffers, but (at least) Emacs 20's doesn't, so here it is. -(defun slime-forward-reader-comment () - "Move forward over #|...|# reader comments. The comments may be nested." - (when (looking-at "#|") - (goto-char (match-end 0)) - (while (not (looking-at "|#")) - (re-search-forward (regexp-opt '("|#" "#|"))) - (goto-char (match-beginning 0)) - (when (looking-at "#|") ; nested comment - (slime-forward-reader-comment))) - (goto-char (match-end 0)))) - -(defun slime-forward-reader-conditional () - "Move past any reader conditional (#+ or #-) at point." - (when (or (looking-at "#\\+") - (looking-at "#-")) - (goto-char (match-end 0)) - (let* ((plus-conditional-p (eq (char-before) ?+)) - (result (slime-eval-feature-conditional (read (current-buffer))))) - (unless (if plus-conditional-p result (not result)) - ;; skip this sexp - (slime-forward-sexp))))) - -(defun slime-keywordify (symbol) - "Make a keyword out of the symbol SYMBOL." - (let ((name (downcase (symbol-name symbol)))) - (intern (if (eq ?: (aref name 0)) - name - (concat ":" name))))) - -(defun slime-eval-feature-conditional (e) - "Interpret a reader conditional expression." - (if (symbolp e) - (memq (slime-keywordify e) (slime-lisp-features)) - (funcall (ecase (slime-keywordify (car e)) - (:and #'every) - (:or #'some) - (:not (lambda (f l) (not (apply f l))))) - #'slime-eval-feature-conditional - (cdr e)))) - ;;;;; Incremental search ;; @@ -5390,20 +5324,19 @@ (slime-eval-print string)) (defun slime-call-defun () - "Insert a call to the function defined around point into the REPL." + "Insert a call to the toplevel form defined around point into the REPL." (interactive) (let ((toplevel (slime-parse-toplevel-form))) - (unless (and (consp toplevel) - (member (car toplevel) '(:defun :defmethod :defgeneric)) - (symbolp (cadr toplevel))) - (error "Not in a function definition")) - (let* ((symbol (cadr toplevel)) - (function-call - (format "(%s " (slime-qualify-cl-symbol-name symbol)))) - (slime-switch-to-output-buffer) - (goto-char slime-repl-input-start-mark) - (insert function-call) - (save-excursion (insert ")"))))) + (destructure-case toplevel + (((:defun :defmethod :defgeneric :defmacro :define-compiler-macro) symbol) + (let ((function-call + (format "(%s " (slime-qualify-cl-symbol-name symbol)))) + (slime-switch-to-output-buffer) + (goto-char slime-repl-input-start-mark) + (insert function-call) + (save-excursion (insert ")")))) + (t + (error "Not in a function definition"))))) ;;;; Edit Lisp value ;;; @@ -5502,7 +5435,7 @@ (destructure-case spec ((setf n) (slime-read-from-minibuffer "(Un)trace: " (prin1-to-string spec))) - (((:defun :defmacro) n) + ((:defun n) (slime-read-from-minibuffer "(Un)trace: " (prin1-to-string n))) ((:defgeneric n) (let* ((name (prin1-to-string n)) @@ -5529,7 +5462,8 @@ answer)))) (((:labels :flet) &rest _) (slime-read-from-minibuffer "(Un)trace local function: " - (prin1-to-string spec))))))) + (prin1-to-string spec))) + (t (error "Don't know how to trace the spec ~S" spec)))))) (defun slime-extract-context () "Parse the context for the symbol at point. @@ -5544,6 +5478,12 @@ (defun ... (...) ... (n.ame ...) ...) -> (:call (:defun ...) name) (defun ... (...) ... (setf (n.ame ...) -> (:call (:defun ...) (setf name)) + (defmacro n.ame (...) ...) -> (:defmacro name) + (defsetf n.ame (...) ...) -> (:defsetf name) + (define-setf-expander n.ame (...) ...) -> (:define-setf-expander name) + (define-modify-macro n.ame (...) ...) -> (:define-modify-macro name) + (define-compiler-macro n.ame (...) ...) -> (:define-compiler-macro name) + For other contexts we return the symbol at point." (let ((name (slime-symbol-name-at-point))) (if name @@ -5586,6 +5526,14 @@ `(:flet ,toplevel ,name)) (t `(:call ,toplevel ,name))))) + ((slime-in-expression-p '(define-compiler-macro *)) + `(:define-compiler-macro ,name)) + ((slime-in-expression-p '(define-modify-macro *)) + `(:define-modify-macro ,name)) + ((slime-in-expression-p '(define-setf-expander *)) + `(:define-setf-expander ,name)) + ((slime-in-expression-p '(defsetf *)) + `(:defsetf ,name)) (t name)))) @@ -9128,7 +9076,109 @@ (total (buffer-size))) (or (/= beg 1) (/= end (1+ total)))))) - +;;;;; CL symbols vs. Elisp symbols. + +(defun slime-cl-symbol-name (symbol) + (let ((n (if (stringp symbol) symbol (symbol-name symbol)))) + (if (string-match ":\\([^:]*\\)$" n) + (let ((symbol-part (match-string 1 n))) + (if (string-match "^|\\(.*\\)|$" symbol-part) + (match-string 1 symbol-part) + symbol-part)) + n))) + +(defun slime-cl-symbol-package (symbol &optional default) + (let ((n (if (stringp symbol) symbol (symbol-name symbol)))) + (if (string-match "^\\([^:]*\\):" n) + (match-string 1 n) + default))) + +(defun slime-qualify-cl-symbol-name (symbol-or-name) + "Return a package-qualified symbol-name that indicates the CL symbol +SYMBOL. If SYMBOL doesn't already have a package prefix the current +package is used." + (let ((s (if (stringp symbol-or-name) + symbol-or-name + (symbol-name symbol-or-name)))) + (if (slime-cl-symbol-package s) + s + (format "%s::%s" + (let* ((package (slime-current-package))) + ;; package is a string like ":cl-user" or "CL-USER". + (if (and package (string-match "^:" package)) + (substring package 1) + package)) + (slime-cl-symbol-name s))))) + +;;;;; Moving, CL idiosyncracies aware (reader conditionals &c.) + +(defmacro slime-point-moves-p (&rest body) + "Execute BODY and return true if the current buffer's point moved." + (let ((pointvar (gensym "point-"))) + `(let ((,pointvar (point))) + (save-current-buffer , at body) + (/= ,pointvar (point))))) + +(put 'slime-point-moves-p 'lisp-indent-function 0) + +(defun slime-forward-sexp (&optional count) + "Like `forward-sexp', but understands reader-conditionals (#- and #+)." + (dotimes (i (or count 1)) + (while (slime-point-moves-p (slime-forward-blanks) + (slime-forward-reader-comment) + (slime-forward-reader-conditional))) + (forward-sexp))) + +(defun slime-forward-blanks () + "Move forward over all whitespace and newlines at point." + (ignore-errors + (while (slime-point-moves-p + (skip-syntax-forward " ") + ;; newlines aren't in lisp-mode's whitespace syntax class + (when (eolp) (forward-char)))))) + +;; Emacs 21's forward-sexp understands #| |# comments in lisp-mode +;; buffers, but (at least) Emacs 20's doesn't, so here it is. +(defun slime-forward-reader-comment () + "Move forward over #|...|# reader comments. The comments may be nested." + (when (looking-at "#|") + (goto-char (match-end 0)) + (while (not (looking-at "|#")) + (re-search-forward (regexp-opt '("|#" "#|"))) + (goto-char (match-beginning 0)) + (when (looking-at "#|") ; nested comment + (slime-forward-reader-comment))) + (goto-char (match-end 0)))) + +(defun slime-forward-reader-conditional () + "Move past any reader conditional (#+ or #-) at point." + (when (or (looking-at "#\\+") + (looking-at "#-")) + (goto-char (match-end 0)) + (let* ((plus-conditional-p (eq (char-before) ?+)) + (result (slime-eval-feature-conditional (read (current-buffer))))) + (unless (if plus-conditional-p result (not result)) + ;; skip this sexp + (slime-forward-sexp))))) + +(defun slime-keywordify (symbol) + "Make a keyword out of the symbol SYMBOL." + (let ((name (downcase (symbol-name symbol)))) + (intern (if (eq ?: (aref name 0)) + name + (concat ":" name))))) + +(defun slime-eval-feature-conditional (e) + "Interpret a reader conditional expression." + (if (symbolp e) + (memq (slime-keywordify e) (slime-lisp-features)) + (funcall (ecase (slime-keywordify (car e)) + (:and #'every) + (:or #'some) + (:not (lambda (f l) (not (apply f l))))) + #'slime-eval-feature-conditional + (cdr e)))) + ;;;;; Extracting Lisp forms from the buffer or user (defun slime-defun-at-point () @@ -9202,6 +9252,7 @@ (or (slime-sexp-at-point) (error "No expression at point."))) + ;;;; Portability library (when (featurep 'xemacs) From trittweiler at common-lisp.net Sat Jun 7 11:44:33 2008 From: trittweiler at common-lisp.net (trittweiler) Date: Sat, 7 Jun 2008 07:44:33 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20080607114433.DB5D9671A4@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28637 Modified Files: ChangeLog Log Message: * slime.el (slime-extract-context, slime-parse-context): Recognize more toplevel forms, e.g. DEFINE-COMPILER-MACRO &c. Such that `slime-parse-toplevel-form' will also recognize these. (slime-trace-query): Adapted to above changes. Errors if spec is untraceable. (slime-call-defun): Adapted to also support the new toplevel forms. (slime-cl-symbol-name), (slime-cl-symbol-package), (slime-qualify-cl-symbol-name): Resurrected from the `slime-parse' contrib, as they've been used by `slime-call-defun'. --- /project/slime/cvsroot/slime/ChangeLog 2008/06/02 18:11:15 1.1357 +++ /project/slime/cvsroot/slime/ChangeLog 2008/06/07 11:44:33 1.1358 @@ -1,3 +1,17 @@ +2008-06-07 Tobias C. Rittweiler + + * slime.el (slime-extract-context, slime-parse-context): Recognize + more toplevel forms, e.g. DEFINE-COMPILER-MACRO &c. Such that + `slime-parse-toplevel-form' will also recognize these. + (slime-trace-query): Adapted to above changes. Errors if spec is + untraceable. + (slime-call-defun): Adapted to also support the new toplevel forms. + + (slime-cl-symbol-name), + (slime-cl-symbol-package), + (slime-qualify-cl-symbol-name): Resurrected from the `slime-parse' + contrib, as they've been used by `slime-call-defun'. + 2008-06-02 Raymond Toy Unicode support for CMUCL. From trittweiler at common-lisp.net Sat Jun 7 11:46:08 2008 From: trittweiler at common-lisp.net (trittweiler) Date: Sat, 7 Jun 2008 07:46:08 -0400 (EDT) Subject: [slime-cvs] CVS slime/contrib Message-ID: <20080607114608.15EC16F312@common-lisp.net> Update of /project/slime/cvsroot/slime/contrib In directory clnet:/tmp/cvs-serv28925/contrib Modified Files: slime-parse.el Log Message: * slime-parse.el (slime-cl-symbol-name), (slime-cl-symbol-package), (slime-qualify-cl-symbol-name): Moved back to `slime.el' as they're still used there. --- /project/slime/cvsroot/slime/contrib/slime-parse.el 2008/01/10 20:00:04 1.10 +++ /project/slime/cvsroot/slime/contrib/slime-parse.el 2008/06/07 11:46:06 1.11 @@ -26,53 +26,6 @@ (slime-make-form-spec-from-string (concat (slime-incomplete-sexp-at-point) ")")))))))) -;; XXX: unused function -(defun slime-cl-symbol-external-ref-p (symbol) - "Does SYMBOL refer to an external symbol? -FOO:BAR is an external reference. -FOO::BAR is not, and nor is BAR." - (let ((name (if (stringp symbol) symbol (symbol-name symbol)))) - (and (string-match ":" name) - (not (string-match "::" name))))) - -(defun slime-cl-symbol-name (symbol) - (let ((n (if (stringp symbol) symbol (symbol-name symbol)))) - (if (string-match ":\\([^:]*\\)$" n) - (let ((symbol-part (match-string 1 n))) - (if (string-match "^|\\(.*\\)|$" symbol-part) - (match-string 1 symbol-part) - symbol-part)) - n))) - -(defun slime-cl-symbol-package (symbol &optional default) - (let ((n (if (stringp symbol) symbol (symbol-name symbol)))) - (if (string-match "^\\([^:]*\\):" n) - (match-string 1 n) - default))) - -;; XXX: unused function -(defun slime-qualify-cl-symbol (symbol-or-name) - "Like `slime-qualify-cl-symbol-name', but interns the result." - (intern (slime-qualify-cl-symbol-name symbol-or-name))) - -(defun slime-qualify-cl-symbol-name (symbol-or-name) - "Return a package-qualified symbol-name that indicates the CL symbol -SYMBOL. If SYMBOL doesn't already have a package prefix the current -package is used." - (let ((s (if (stringp symbol-or-name) - symbol-or-name - (symbol-name symbol-or-name)))) - (if (slime-cl-symbol-package s) - s - (format "%s::%s" - (let* ((package (slime-current-package))) - ;; package is a string like ":cl-user" or "CL-USER". - (if (and package (string-match "^:" package)) - (substring package 1) - package)) - (slime-cl-symbol-name s))))) - - (defun slime-parse-sexp-at-point (&optional n skip-blanks-p) "Return the sexp at point as a string, otherwise nil. If N is given and greater than 1, a list of all such sexps From trittweiler at common-lisp.net Sat Jun 7 11:46:15 2008 From: trittweiler at common-lisp.net (trittweiler) Date: Sat, 7 Jun 2008 07:46:15 -0400 (EDT) Subject: [slime-cvs] CVS slime/contrib Message-ID: <20080607114615.927E275150@common-lisp.net> Update of /project/slime/cvsroot/slime/contrib In directory clnet:/tmp/cvs-serv28949/contrib Modified Files: ChangeLog Log Message: * slime-parse.el (slime-cl-symbol-name), (slime-cl-symbol-package), (slime-qualify-cl-symbol-name): Moved back to `slime.el' as they're still used there. --- /project/slime/cvsroot/slime/contrib/ChangeLog 2008/04/17 15:21:51 1.106 +++ /project/slime/cvsroot/slime/contrib/ChangeLog 2008/06/07 11:46:15 1.107 @@ -1,3 +1,10 @@ +2008-06-07 Tobias C. Rittweiler + + * slime-parse.el (slime-cl-symbol-name), + (slime-cl-symbol-package), + (slime-qualify-cl-symbol-name): Moved back to `slime.el' as + they're still used there. + 2008-04-17 G?bor Melis * swank-fancy-inspector.lisp (inspect-slot-for-emacs): From trittweiler at common-lisp.net Sat Jun 7 11:49:58 2008 From: trittweiler at common-lisp.net (trittweiler) Date: Sat, 7 Jun 2008 07:49:58 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20080607114958.8E3E83A028@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30188 Modified Files: slime.el Log Message: * slime.el (def-slime-test find-definition.2, arglist): SWANK:COMPILE-STRING-FOR-EMACS since recently takes 5 instead of 4 parameters. Fix that. --- /project/slime/cvsroot/slime/slime.el 2008/06/07 11:44:21 1.940 +++ /project/slime/cvsroot/slime/slime.el 2008/06/07 11:49:58 1.941 @@ -8471,6 +8471,7 @@ ,buffer-content ,(buffer-name) ,0 + ,nil ,nil)) (let ((bufname (buffer-name))) (slime-edit-definition ".foo.") @@ -8509,7 +8510,7 @@ ("swank::create-socket" "(swank::create-socket host port)") ("swank::emacs-connected" "(swank::emacs-connected )") ("swank::compile-string-for-emacs" - "(swank::compile-string-for-emacs string buffer position directory)") + "(swank::compile-string-for-emacs string buffer position directory debug)") ("swank::connection.socket-io" "(swank::connection.socket-io \\(struct\\(ure\\)?\\|object\\|instance\\))") ("cl:lisp-implementation-type" "(cl:lisp-implementation-type )") From trittweiler at common-lisp.net Sat Jun 7 11:50:24 2008 From: trittweiler at common-lisp.net (trittweiler) Date: Sat, 7 Jun 2008 07:50:24 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20080607115024.8C5C03C0EE@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30297 Modified Files: ChangeLog Log Message: * slime.el (def-slime-test find-definition.2, arglist): SWANK:COMPILE-STRING-FOR-EMACS since recently takes 5 instead of 4 parameters. Fix that. --- /project/slime/cvsroot/slime/ChangeLog 2008/06/07 11:44:33 1.1358 +++ /project/slime/cvsroot/slime/ChangeLog 2008/06/07 11:50:24 1.1359 @@ -1,5 +1,11 @@ 2008-06-07 Tobias C. Rittweiler + * slime.el (def-slime-test find-definition.2, arglist): + SWANK:COMPILE-STRING-FOR-EMACS since recently takes 5 instead of 4 + parameters. Fix that. + +2008-06-07 Tobias C. Rittweiler + * slime.el (slime-extract-context, slime-parse-context): Recognize more toplevel forms, e.g. DEFINE-COMPILER-MACRO &c. Such that `slime-parse-toplevel-form' will also recognize these.