From bknr at bknr.net Sun Dec 2 18:46:45 2007 From: bknr at bknr.net (bknr at bknr.net) Date: Sun, 2 Dec 2007 13:46:45 -0500 (EST) Subject: [bknr-cvs] r2295 - in branches/trunk-reorg/thirdparty/slime: . CVS contrib contrib/CVS doc doc/CVS Message-ID: <20071202184645.E537B2B02B@common-lisp.net> Author: hhubner Date: 2007-12-02 13:46:42 -0500 (Sun, 02 Dec 2007) New Revision: 2295 Modified: branches/trunk-reorg/thirdparty/slime/CVS/Entries branches/trunk-reorg/thirdparty/slime/ChangeLog branches/trunk-reorg/thirdparty/slime/NEWS branches/trunk-reorg/thirdparty/slime/contrib/CVS/Entries branches/trunk-reorg/thirdparty/slime/contrib/ChangeLog branches/trunk-reorg/thirdparty/slime/contrib/slime-fuzzy.el branches/trunk-reorg/thirdparty/slime/contrib/swank-arglists.lisp branches/trunk-reorg/thirdparty/slime/contrib/swank-fancy-inspector.lisp branches/trunk-reorg/thirdparty/slime/doc/CVS/Entries branches/trunk-reorg/thirdparty/slime/doc/slime.texi branches/trunk-reorg/thirdparty/slime/slime.el branches/trunk-reorg/thirdparty/slime/swank-cmucl.lisp branches/trunk-reorg/thirdparty/slime/swank-lispworks.lisp branches/trunk-reorg/thirdparty/slime/swank-loader.lisp branches/trunk-reorg/thirdparty/slime/swank.lisp Log: update slime from cvs Modified: branches/trunk-reorg/thirdparty/slime/CVS/Entries =================================================================== --- branches/trunk-reorg/thirdparty/slime/CVS/Entries 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/CVS/Entries 2007-12-02 18:46:42 UTC (rev 2295) @@ -1,9 +1,5 @@ -D/contrib//// -D/doc//// /.cvsignore/1.5/Thu Oct 11 14:10:25 2007// -/ChangeLog/1.1241/Wed Nov 14 21:30:35 2007// /HACKING/1.8/Thu Oct 11 14:10:25 2007// -/NEWS/1.8/Thu Oct 11 14:10:25 2007// /PROBLEMS/1.8/Thu Oct 11 14:10:25 2007// /README/1.14/Thu Oct 11 14:10:25 2007// /hyperspec.el/1.11/Thu Oct 11 14:10:25 2007// @@ -12,24 +8,28 @@ /nregex.lisp/1.4/Thu Oct 11 14:10:25 2007// /sbcl-pprint-patch.lisp/1.1/Thu Oct 11 14:10:25 2007// /slime-autoloads.el/1.3/Thu Oct 11 14:10:25 2007// -/slime.el/1.877/Wed Nov 14 21:30:35 2007// /swank-abcl.lisp/1.44/Wed Nov 14 21:30:35 2007// /swank-allegro.lisp/1.98/Thu Oct 11 14:10:25 2007// /swank-backend.lisp/1.126/Thu Oct 11 14:10:25 2007// /swank-clisp.lisp/1.64/Thu Oct 11 14:10:25 2007// -/swank-cmucl.lisp/1.174/Thu Oct 11 14:10:25 2007// /swank-corman.lisp/1.11/Thu Oct 11 14:10:25 2007// /swank-ecl.lisp/1.8/Thu Oct 11 14:10:25 2007// /swank-gray.lisp/1.10/Thu Oct 11 14:10:25 2007// -/swank-lispworks.lisp/1.92/Thu Oct 11 14:10:25 2007// -/swank-loader.lisp/1.74/Wed Nov 14 21:30:35 2007// /swank-openmcl.lisp/1.120/Wed Nov 14 21:30:35 2007// /swank-sbcl.lisp/1.185/Thu Oct 11 14:10:25 2007// /swank-scl.lisp/1.13/Thu Oct 11 14:10:25 2007// /swank-source-file-cache.lisp/1.8/Thu Oct 11 14:10:25 2007// /swank-source-path-parser.lisp/1.17/Thu Oct 11 14:10:25 2007// /swank.asd/1.5/Thu Oct 11 14:10:25 2007// -/swank.lisp/1.513/Wed Nov 14 21:30:35 2007// /test-all.sh/1.2/Thu Oct 11 14:10:25 2007// /test.sh/1.9/Thu Oct 11 14:10:25 2007// /xref.lisp/1.2/Thu Oct 11 14:10:25 2007// +D/contrib//// +D/doc//// +/ChangeLog/1.1254/Sun Dec 2 04:22:09 2007// +/NEWS/1.9/Sun Dec 2 04:22:09 2007// +/slime.el/1.882/Sun Dec 2 04:22:09 2007// +/swank-cmucl.lisp/1.175/Sun Dec 2 04:22:09 2007// +/swank-lispworks.lisp/1.93/Sun Dec 2 04:22:09 2007// +/swank-loader.lisp/1.75/Sun Dec 2 04:22:09 2007// +/swank.lisp/1.521/Sun Dec 2 04:22:09 2007// Modified: branches/trunk-reorg/thirdparty/slime/ChangeLog =================================================================== --- branches/trunk-reorg/thirdparty/slime/ChangeLog 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/ChangeLog 2007-12-02 18:46:42 UTC (rev 2295) @@ -1,3 +1,118 @@ +2007-12-02 Alan Caulkins + + Make it possible to close listening sockets. + + * swank.lisp (stop-server, restart-server): New functions. + (*listener-sockets*): New variable. + (setup-server): Store open sockets in *listener-sockets*. + +2007-12-02 Helmut Eller + + Add hook to customize the region used by C-c C-c. + Useful to recognize block declarations in CMUCL sources. + + * slime.el (slime-region-for-defun-function): New variable. + (slime-region-for-defun-at-point): Use it. + +2007-11-30 Helmut Eller + + Handle byte-functions without debug-info. + + * swank-cmucl.lisp (byte-function-location): Return an error + if the component has no debug-info. + +2007-11-30 Helmut Eller + + Disable the pretty-printer for backtraces. + Would be nice if we could print newlines in strings as \n. + + * swank.lisp (*backtrace-printer-bindings*): New varaible. + (backtrace, frame-locals-for-emacs): Use it. + +2007-11-29 Tobias C. Rittweiler + + * swank.lisp (valid-function-name-p): Fixed wrt. setf functions. + +2007-11-29 Helmut Eller + + Prettify package names for slime-repl-set-package. + + * slime.el (slime-repl-set-package): slime-current-package may + have leading colons. Use slime-pretty-package-name to remove + them. Reported by Constantine Vetoshev. + (slime-pretty-current-package): New function. + (slime-set-package): Use it. + +2007-11-24 Helmut Eller + + Drop remaining dependencies on nregex. + + * swank-lispworks.lisp (unmangle-unfun): Use sys::setf-symbol-p + instead of regexp matching. + + * swank-loader.lisp (*sysdep-files*): Don't include nregex. + +2007-11-24 Helmut Eller + + Mirror *modules* in Emacs. + + * slime.el (slime-lisp-modules): New connction variable. + (slime-set-connection-info): Load requested modules. + (slime-required-modules): New variable. + (slime-require, slime-load-contribs): New functions. + + * swank.lisp (connection-info): Include *modules*. + (swank-require): Accept a list of modules as argument. + +2007-11-24 Helmut Eller + + * swank.lisp (parse-package): The old version didn't pass the + test-suite. Now use the reader directly instead of emulating it + half-heartedly. + + * slime.el (slime-search-buffer-package): Don't remove double + quotes or "#:", swank:parse-package takes care of that. + +2007-11-24 Helmut Eller + + * swank.lisp (apropos-symbols): Use simple search instead of + regexps. + (make-apropos-matcher): Used to be make-regexp-matcher. + + (*sldb-printer-bindings*): Set *print-right-margin* to + most-positive-fixnum. This prints each frame in the backtrace in a + single long line. But is suboptimal for other purposes, like + eval-in-frame. + + (setup-server): Initialize multiprocessing here, so that is also + done for create-server. + +2007-11-23 Tobias C. Rittweiler + + * swank.lisp (swank-require): Fix typo (:key was used instead of + :test.) Reported by Stelian Ionescu. + +2007-11-22 Helmut Eller + + * swank.lisp (swank-require): Don't search the file if the + module-name is present in *modules*. That should avoid problems if + swank is included in a core file and moved to a different + location. Reported by John Wiegley. + +2007-11-19 Tobias C. Rittweiler + + * slime.el (slime-repl-mode-map, slime-repl-read-mode), + (slime-compiler-notes-mode-map, slime-xref-mode-map), + (sldb-mode-map, slime-connection-list-mode-map), + (slime-inspector-mode-map): Added bindings for [return] in + addition to (kbd "RET"). The reason is that pressing enter in X is + translated to (kbd "RET") only if no binding for [return] is + active; if [return] is bound to something, pressing enter is + translated to this key binding henceforth, as was explained to me + by Pierre Gaston, thanks! This can cause quite confusing behaviour + as Andreas Davour faced in his post + to comp.lang.lisp. + 2007-11-06 Helmut Eller * slime.el (slime-events-buffer, slime-inspector-buffer): Disable Modified: branches/trunk-reorg/thirdparty/slime/NEWS =================================================================== --- branches/trunk-reorg/thirdparty/slime/NEWS 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/NEWS 2007-12-02 18:46:42 UTC (rev 2295) @@ -1,5 +1,54 @@ -* SLIME News -*- outline -*- +* SLIME News -*- outline -*- +* 3.0 (not released yet) + +** Removed Features +Some of the more esoteric features, like presentations or fuzzy +completion, are no longer enabled by default. A new directory +"contrib/" contains the code for these packages. To use them, you +must make some changes to your ~/.emacs. For details see, section +"Contributed Packages" in the manual. + +** Stepper +Juho Snellman implemented stepping commands for SBCL. + +** Completions +SLIME can now complete keywords and character names (like #\newline). + +* 2.0 (April 2006) + +** In-place macro expansion +Marco Baringer wrote a new minor mode to incrementally expand macros. + +** Improved arglist display +SLIME now recognizes `make-instance' calls and displays the correct +arglist if the classname is present. Similarly, for `defmethod' forms +SLIME displays the arguments of the generic function. + +** Persistent REPL history +SLIME now saves the command history from REPL buffers in a file and +reloads it for newly created REPL buffers. + +** Scieneer Common Lisp +Douglas Crosher added support for Scieneer Common Lisp. + +** SBCL +Various improvements to make SLIME work well with current SBCL versions. + +** Corman Common Lisp +Espen Wiborg added support for Corman Common Lisp. + +** Presentations +A new feature which associates objects in Lisp with their textual +represetation in Emacs. The text is clickable and operations on the +associated object can be invoked from a pop-up menu. + +** Security +SLIME has now a simple authentication mechanism: if the file +~/.slime-secret exists we verify that Emacs and Lisp can access it. +Since both parties have access to the same file system, we assume that +we can trust each other. + * 1.2 (March 2005) ** New inspector Modified: branches/trunk-reorg/thirdparty/slime/contrib/CVS/Entries =================================================================== --- branches/trunk-reorg/thirdparty/slime/contrib/CVS/Entries 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/contrib/CVS/Entries 2007-12-02 18:46:42 UTC (rev 2295) @@ -1,4 +1,3 @@ -/ChangeLog/1.64/Wed Nov 14 21:30:35 2007// /README/1.3/Thu Oct 11 14:10:25 2007// /bridge.el/1.1/Thu Oct 11 14:10:25 2007// /inferior-slime.el/1.2/Thu Oct 11 14:10:25 2007// @@ -9,7 +8,6 @@ /slime-editing-commands.el/1.5/Thu Oct 11 14:10:25 2007// /slime-fancy-inspector.el/1.2/Thu Oct 11 14:10:25 2007// /slime-fancy.el/1.4/Thu Oct 11 14:10:25 2007// -/slime-fuzzy.el/1.4/Thu Oct 11 14:10:25 2007// /slime-highlight-edits.el/1.3/Thu Oct 11 14:10:25 2007// /slime-parse.el/1.7/Thu Oct 11 14:10:25 2007// /slime-presentation-streams.el/1.2/Thu Oct 11 14:10:25 2007// @@ -19,12 +17,14 @@ /slime-tramp.el/1.2/Thu Oct 11 14:10:25 2007// /slime-typeout-frame.el/1.5/Thu Oct 11 14:10:25 2007// /slime-xref-browser.el/1.1/Thu Oct 11 14:10:25 2007// -/swank-arglists.lisp/1.12/Wed Nov 14 21:30:35 2007// /swank-asdf.lisp/1.1/Thu Oct 11 14:10:25 2007// /swank-c-p-c.lisp/1.2/Thu Oct 11 14:10:25 2007// -/swank-fancy-inspector.lisp/1.4/Thu Oct 11 14:10:25 2007// /swank-fuzzy.lisp/1.6/Thu Oct 11 14:10:25 2007// /swank-listener-hooks.lisp/1.1/Thu Oct 11 14:10:25 2007// /swank-presentation-streams.lisp/1.4/Thu Oct 11 14:10:25 2007// /swank-presentations.lisp/1.4/Thu Oct 11 14:10:25 2007// +/swank-fancy-inspector.lisp/1.5/Wed Nov 21 20:47:43 2007// +/ChangeLog/1.68/Sun Dec 2 04:22:09 2007// +/slime-fuzzy.el/1.5/Sun Dec 2 04:22:09 2007// +/swank-arglists.lisp/1.15/Sun Dec 2 04:22:10 2007// D Modified: branches/trunk-reorg/thirdparty/slime/contrib/ChangeLog =================================================================== --- branches/trunk-reorg/thirdparty/slime/contrib/ChangeLog 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/contrib/ChangeLog 2007-12-02 18:46:42 UTC (rev 2295) @@ -1,3 +1,25 @@ +2007-11-27 Tobias C. Rittweiler + + * swank-arglists.lisp (arglist-dispatch 'defmethod): Use + VALID-FUNCTION-NAME-P. Fixes error on certain `(defmethod (setf ...))' + forms. + +2007-11-27 Tobias C. Rittweiler + + * swank-arglists.lisp (print-arglist): Print initforms in &optional and + &key lambda list specifiers as if by PRIN1 instead of PRINC. + Reported by Michael Weber. + +2007-11-24 Helmut Eller + + * slime-fuzzy.el: Use slime-require instead of a connected-hook. + +2007-11-20 Helmut Eller + + * swank-fancy-inspector.lisp (inspect-for-emacs function t): Don't + specialize the second argument, so that backend methods take + precedence. Reported by Maciej Katafiasz. + 2007-10-24 Tobias C. Rittweiler * swank-arglist.lisp (decode-arglist): Fix incompatibility with Modified: branches/trunk-reorg/thirdparty/slime/contrib/slime-fuzzy.el =================================================================== --- branches/trunk-reorg/thirdparty/slime/contrib/slime-fuzzy.el 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/contrib/slime-fuzzy.el 2007-12-02 18:46:42 UTC (rev 2295) @@ -585,14 +585,12 @@ ;;; Initialization (defun slime-fuzzy-init () - (add-hook 'slime-connected-hook 'slime-fuzzy-on-connect) (slime-fuzzy-bind-keys)) (defun slime-fuzzy-bind-keys () (define-key slime-mode-map "\C-c\M-i" 'slime-fuzzy-complete-symbol) (define-key slime-repl-mode-map "\C-c\M-i" 'slime-fuzzy-complete-symbol)) -(defun slime-fuzzy-on-connect () - (slime-eval-async '(swank:swank-require :swank-fuzzy))) +(slime-require :swank-fuzzy) (provide 'slime-fuzzy) Modified: branches/trunk-reorg/thirdparty/slime/contrib/swank-arglists.lisp =================================================================== --- branches/trunk-reorg/thirdparty/slime/contrib/swank-arglists.lisp 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/contrib/swank-arglists.lisp 2007-12-02 18:46:42 UTC (rev 2295) @@ -283,6 +283,7 @@ ;;; (DECLARE (OPTIMIZE &ANY (compilation-speed 1) (safety 1) ...)) ;;; +;; FIXME: This really ought to be rewritten. (defun print-arglist (arglist &key operator highlight) (let ((index 0) (need-space nil)) @@ -290,26 +291,29 @@ (typecase arg (arglist ; destructuring pattern (print-arglist arg)) - (optional-arg - (princ (encode-optional-arg arg))) + (optional-arg + (let ((enc-arg (encode-optional-arg arg))) + (if (symbolp enc-arg) + (princ enc-arg) + (destructuring-bind (var &optional (initform nil initform-p)) enc-arg + (pprint-logical-block (nil nil :prefix "(" :suffix ")") + (format t "~A~:[~; ~S~]" var initform-p initform)))))) (keyword-arg (let ((enc-arg (encode-keyword-arg arg))) (etypecase enc-arg (symbol (princ enc-arg)) - ((cons symbol) - (pprint-logical-block (nil nil :prefix "(" :suffix ")") - (princ (car enc-arg)) - (write-char #\space) - (pprint-fill *standard-output* (cdr enc-arg) nil))) + ((cons symbol) + (destructuring-bind (keyarg initform) enc-arg + (pprint-logical-block (nil nil :prefix "(" :suffix ")") + (format t "~A ~S" keyarg initform)))) ((cons cons) - (pprint-logical-block (nil nil :prefix "(" :suffix ")") - (pprint-logical-block (nil nil :prefix "(" :suffix ")") - (prin1 (caar enc-arg)) - (write-char #\space) - (print-arg (keyword-arg.arg-name arg))) - (unless (null (cdr enc-arg)) - (write-char #\space)) - (pprint-fill *standard-output* (cdr enc-arg) nil)))))) + (destructuring-bind ((keyword-name var) &optional (initform nil initform-p)) + enc-arg + (pprint-logical-block (nil nil :prefix "(" :suffix ")") + (pprint-logical-block (nil nil :prefix "(" :suffix ")") + (format t "~S ~A" keyword-name var)) + (when initform-p + (format t " ~S" initform)))))))) (t ; required formal or provided actual arg (if (keywordp arg) (prin1 arg) ; for &ANY args. @@ -1002,7 +1006,6 @@ (split-form-spec form-spec) (arglist-dispatch type operator arguments :remove-args remove-args)))) - (defmacro with-availability ((var) form &body body) `(let ((,var ,form)) (if (eql ,var :not-available) @@ -1039,9 +1042,7 @@ (not (null arguments)) ;have generic function name (notany #'listp (rest arguments))) ;don't have arglist yet (let* ((gf-name (first arguments)) - (gf (and (or (symbolp gf-name) - (and (listp gf-name) - (eql (first gf-name) 'setf))) + (gf (and (valid-function-name-p gf-name) (fboundp gf-name) (fdefinition gf-name)))) (when (typep gf 'generic-function) Modified: branches/trunk-reorg/thirdparty/slime/contrib/swank-fancy-inspector.lisp =================================================================== --- branches/trunk-reorg/thirdparty/slime/contrib/swank-fancy-inspector.lisp 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/contrib/swank-fancy-inspector.lisp 2007-12-02 18:46:42 UTC (rev 2295) @@ -94,7 +94,7 @@ (t (list label ": " '(:newline) " " docstring '(:newline)))))) -(defmethod inspect-for-emacs ((f function) (inspector fancy-inspector)) +(defmethod inspect-for-emacs ((f function) inspector) (declare (ignore inspector)) (values "A function." (append Modified: branches/trunk-reorg/thirdparty/slime/doc/CVS/Entries =================================================================== --- branches/trunk-reorg/thirdparty/slime/doc/CVS/Entries 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/doc/CVS/Entries 2007-12-02 18:46:42 UTC (rev 2295) @@ -4,6 +4,6 @@ /slime-refcard.tex/1.1/Thu Oct 11 14:10:24 2007// /slime-small.eps/1.1/Thu Oct 11 14:10:24 2007// /slime-small.pdf/1.1/Thu Oct 11 14:10:24 2007// -/slime.texi/1.57/Thu Oct 11 14:10:24 2007// /texinfo-tabulate.awk/1.2/Thu Oct 11 14:10:24 2007// +/slime.texi/1.61/Sun Dec 2 04:22:10 2007// D Modified: branches/trunk-reorg/thirdparty/slime/doc/slime.texi =================================================================== --- branches/trunk-reorg/thirdparty/slime/doc/slime.texi 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/doc/slime.texi 2007-12-02 18:46:42 UTC (rev 2295) @@ -1,5 +1,5 @@ \input texinfo -- at c %**start of header + at c %**start of header @setfilename slime.info @settitle The Superior Lisp Interaction Mode for Emacs @@ -7,12 +7,12 @@ @direntry * SLIME: (slime). Superior Lisp Interaction Mode for Emacs. @end direntry -- at c %**end of header + at c %**end of header @set EDITION 3.0-alpha @set SLIMEVER 3.0-alpha @c @set UPDATED @today{} - at set UPDATED @code{$Date: 2007/09/17 13:44:48 $} + at set UPDATED @code{$Date: 2007/11/27 13:16:52 $} @set TITLE SLIME User Manual @settitle @value{TITLE}, version @value{EDITION} @@ -37,6 +37,7 @@ @end titlepage + at c Macros @macro SLIME @acronym{SLIME} @@ -90,6 +91,10 @@ @xref{\name\}. @end macro + at c Merge the variable and concept indices because both are rather short + at synindex cp vr + + @c @setchapternewpage off @c @shortcontents @contents @@ -110,14 +115,142 @@ * slime-mode:: * REPL:: * Debugger:: -* Extras:: +* Misc:: * Customization:: * Tips and Tricks:: +* Contributed Packages:: * Credits:: - at c * Index to Functions:: -* Key Index:: -* Command Index:: -* Variable Index:: +* Key Index:: +* Command Index:: +* Variable Index:: + + at detailmenu + --- The Detailed Node Listing --- + +Getting started + +* Platforms:: +* Downloading:: +* Installation:: +* Running:: +* Setup Tuning:: + +Downloading SLIME + +* CVS:: +* CVS Incantations:: + +Downloading from CVS + +* CVS Incantations:: + +Setup Tuning + +* Autoloading:: +* Multiple Lisps:: +* Loading Swank faster:: + +Using slime-mode + +* User-interface conventions:: +* Commands:: +* Semantic indentation:: +* Reader conditionals:: + +User-interface conventions + +* Temporary buffers:: +* Inferior-lisp:: +* Multithreading:: +* Key bindings:: + +Commands + +* Programming:: +* Compilation:: +* Evaluation:: +* Recovery:: +* Inspector:: +* Profiling:: +* Other:: + +Programming commands + +* Completion:: +* Indentation:: +* Documentation:: +* Cross-reference:: +* Finding definitions:: +* Macro-expansion:: +* Disassembly:: + +REPL: the ``top level'' + +* REPL commands:: +* Input Navigation:: +* Shortcuts:: + +SLDB: the SLIME debugger + +* Examining frames:: +* Restarts:: +* Frame Navigation:: +* Stepping:: +* Miscellaneous:: + +Misc + +* slime-selector:: +* slime-macroexpansion-minor-mode:: +* Multiple connections:: + +Customization + +* Emacs-side customization:: +* Lisp-side:: + +Emacs-side + +* Hooks:: + +Lisp-side (Swank) + +* Communication style:: +* Other configurables:: + +Tips and Tricks + +* Connecting to a remote lisp:: +* Global IO Redirection:: +* Auto-SLIME:: + +Connecting to a remote lisp + +* Setting up the lisp image:: +* Setting up Emacs:: +* Setting up pathname translations:: + +Contributed Packages + +* Loading Contribs:: +* Compound Completion:: +* Fuzzy Completion:: +* slime-autodoc-mode:: +* ASDF:: +* Banner:: +* Editing Commands:: +* Fancy Inspector:: +* Presentations:: +* Typeout frames:: +* TRAMP:: +* Documentation Links:: +* Xref and Class Browser:: +* Highlight Edits:: +* inferior-slime-mode:: +* Scratch Buffer:: +* slime-fancy:: + + at end detailmenu @end menu @c ----------------------- @@ -281,7 +414,7 @@ @section Installation With a Lisp implementation that can be started from the command-line, -installation just requires a few lines in your @file{~/.emacs}: +installation just requires a few lines in your @file{.emacs}: @vindex inferior-lisp-program @vindex load-path @@ -333,7 +466,6 @@ * Autoloading:: * Multiple Lisps:: * Loading Swank faster:: -* Loading Contribs:: @end menu @node Autoloading @@ -353,8 +485,8 @@ The only difference compared to the basic setup is the line @code{(require 'slime-autoloads)}. It tells Emacs that the rest of - at SLIME{} should be loaded when one of the commands @kbd{M-x slime} or - at kbd{M-x slime-connect} is executed the first time. + at SLIME{} should be loaded automatically when one of the commands + at kbd{M-x slime} or @kbd{M-x slime-connect} is executed the first time. @node Multiple Lisps @subsection Multiple Lisps @@ -391,10 +523,18 @@ @item PROGRAM-ARGS is a list of command line arguments. @item CODING-SYSTEM -the coding system for the connection. +the coding system for the connection. (@pxref{slime-net-coding-system}) @item INIT - at itemx INIT-FUNCTION - ... to be written ... +should be a function which takes two arguments: a filename and a +character encoding. The function should return a Lisp expression as a +string which instructs Lisp to start the Swank server and to write the +port number to the file. At startup, @SLIME{} starts the Lisp process +and sends the result of this function to Lisp's standard input. As +default, @code{slime-init-command} is used. An example is shown in + at ref{init-example,,Loading Swank faster}. + at itemx INIT-FUNCTION +should be a function which takes no arguments. It is called after +the connection is established. (See also @ref{slime-connected-hook}.) @end table @node Loading Swank faster @@ -426,15 +566,16 @@ @example shell$ sbcl * (load ".../slime/swank-loader.lisp") -* (save-lisp-and-die "sbcl.core-with-slime") +* (save-lisp-and-die "sbcl.core-with-swank") @end example @noindent Then add this to your @file{.emacs}: + at anchor{init-example} @lisp (setq slime-lisp-implementations - '((sbcl ("sbcl" "--core" "sbcl.core-with-slime") + '((sbcl ("sbcl" "--core" "sbcl.core-with-swank") :init (lambda (port-file _) (format "(swank:start-server %S)\n" port-file))))) @end lisp @@ -442,10 +583,6 @@ @noindent Similar setups should also work for other Lisp implementations. - at node Loading Contribs - at subsection Loading Contribs -... to be written ... - @node slime-mode @chapter Using slime-mode @@ -455,7 +592,6 @@ @menu * User-interface conventions:: -* Key bindings:: * Commands:: * Semantic indentation:: * Reader conditionals:: @@ -473,6 +609,7 @@ * Temporary buffers:: * Inferior-lisp:: * Multithreading:: +* Key bindings:: @end menu @c ----------------------- @@ -544,10 +681,28 @@ swank:*default-worker-thread-bindings*). @end example - at c ----------------------- + @node Key bindings - at section Key bindings + at subsection 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 +own: when entering a three-key sequence, the final key can be pressed +either with control or unmodified. For example, the + at code{slime-describe-symbol} command is bound to @kbd{C-c C-d d}, but +it also works to type @kbd{C-c C-d C-d}. We're simply binding both key +sequences because some people like to hold control for all three keys +and others don't, and with the two-key prefix we're not afraid of +running out of keys. + +There is one exception to this rule, just to trip you up. We never +bind @kbd{C-h} anywhere in a key sequence, so @kbd{C-c C-d C-h} +doesn't do the same thing as @kbd{C-c C-d h}. This is because Emacs +has a built-in default so that typing a prefix followed by @kbd{C-h} +will display all bindings starting with that prefix, so @kbd{C-c C-d +C-h} will actually list the bindings for all documentation commands. +This feature is just a bit too useful to clobber! + @quotation @i{``Are you deliberately spiting Emacs's brilliant online help facilities? The gods will be angry!''} @end quotation @@ -570,7 +725,6 @@ @kbdanchorc{C-h l, view-lossage, ``Woah at comma{} what key chord did I just do?''} Shows you the literal sequence of keys you've pressed in order. - @c is breaks links PDF, despite that it's not l it's C-h @c @kbdanchorc{ l, , ``What starts with?''} @c Lists all keybindings that begin with @code{} for the focus buffer mode. @@ -591,24 +745,6 @@ @noindent In this situation everywhere you see @kbd{C-h} in the documentation you would substitute @kbd{F1}. -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 -own: when entering a three-key sequence, the final key can be pressed -either with control or unmodified. For example, the - at code{slime-describe-symbol} command is bound to @kbd{C-c C-d d}, but -it also works to type @kbd{C-c C-d C-d}. We're simply binding both key -sequences because some people like to hold control for all three keys -and others don't, and with the two-key prefix we're not afraid of -running out of keys. - -There is one exception to this rule, just to trip you up. We never -bind @kbd{C-h} anywhere in a key sequence, so @kbd{C-c C-d C-h} -doesn't do the same thing as @kbd{C-c C-d h}. This is because Emacs -has a built-in default so that typing a prefix followed by @kbd{C-h} -will display all bindings starting with that prefix, so @kbd{C-c C-d -C-h} will actually list the bindings for all documentation commands. -This feature is just a bit too useful to clobber! - You can assign or change default key bindings globally using the @code{global-set-key} function in your @file{~/.emacs} file like this: @example @@ -659,7 +795,6 @@ @menu * Completion:: -* Closure:: * Indentation:: * Documentation:: * Cross-reference:: @@ -672,6 +807,9 @@ @node Completion @subsubsection Completion commands + at cindex Completion + at cindex Symbol Completion + 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 @@ -683,89 +821,15 @@ @itemx C-c C-i @itemx C-M-i Complete the symbol at point. Note that three styles of completion are -available in @SLIME{}, and the default differs from normal Emacs +available in @SLIME{}; the default is similar to normal Emacs completion (@pxref{slime-complete-symbol-function}). - at kbditem{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 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 anchor{slime-fuzzy-complete-symbol} - at kbditem{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 cmditem{slime-fuzzy-completions-mode} - at cmditem{slime-fuzzy-abort} @end table - - at c ----------------------- - at node Closure - at subsubsection Closure commands - -Closure commands are used to fill in missing parenthesis. - - at table @kbd - at kbditem{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{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 -the top-level sexp before point. - at end table - - - at c ----------------------- @node Indentation @subsubsection Indentation commands @table @kbd - at kbditem{C-c M-q, slime-reindent-defun} -Re-indents the current defun, or refills the current paragraph. -If point is inside a comment block, the text around point will be -treated as a paragraph and will be filled with @code{fill-paragraph}. -Otherwise, it will be treated as Lisp code, and the current defun -will be reindented. If the current defun has unbalanced parens, -an attempt will be made to fix it before reindenting. @kbditem{C-M-q, indent-sexp} Indents the list immediately following point to match the level at point. @@ -774,7 +838,6 @@ be treated as a paragraph. This is useful for filling docstrings." @end table - @c ----------------------- @node Documentation @subsubsection Documentation commands @@ -828,6 +891,9 @@ @node Cross-reference @subsubsection Cross-reference commands + at cindex xref + at cindex Cross-referencing + @SLIME{}'s cross-reference commands are based on the support provided by the Lisp system, which varies widely between Lisps. For systems with no built-in @acronym{XREF} support @SLIME{} queries a portable @@ -884,6 +950,9 @@ @node Finding definitions @subsubsection Finding definitions (``Meta-Point'' commands). + at cindex Meta-dot + at cindex TAGS + 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} @@ -919,6 +988,8 @@ @node Macro-expansion @subsubsection Macro-expansion commands + at cindex Macros + @table @kbd @kbditem{C-c C-m, slime-macroexpand-1} Macroexpand the expression at point once. If invoked with a prefix @@ -962,6 +1033,8 @@ @node Compilation @subsection Compilation commands + at cindex Compilation + @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 @@ -969,9 +1042,9 @@ see what this means.) @table @kbd + at cindex Compiling Functions @kbditem{C-c C-c, slime-compile-defun} Compile the top-level form at point. - at cindex compiling functions @kbditem{C-c C-y, slime-call-defun} Insert a call to the function defined around point into the REPL. @@ -1012,50 +1085,56 @@ @node Evaluation @subsection Evaluation commands -These commands each evaluate a Lisp expression in a different way. By -default they show their results in a message, but a prefix argument -causes the results to be printed in the @REPL{} instead. +These commands each evaluate a Common Lisp expression in a different +way. Usually they mimic commands for evaluating Emacs Lisp code. By +default they show their results in the echo area, but a prefix +argument causes the results to be inserted in the current buffer. @table @kbd + at kbditem{C-x C-e, slime-eval-last-expression} + +Evaluate the expression before point and show the result in the echo +area. + @kbditem{C-M-x, slime-eval-defun} -Evaluate the current toplevel form. -Use @code{slime-re-evaluate-defvar} if the from starts with @code{(defvar}. +Evaluate the current toplevel form and show the result in the echo +area. `C-M-x' treats `defvar' expressions specially. Normally, +evaluating a `defvar' expression does nothing if the variable it +defines already has a value. But `C-M-x' unconditionally resets the +variable to the initial value specified in the `defvar' expression. +This special feature is convenient for debugging Lisp programs. - at kbditem{C-x C-e, slime-eval-last-expression} -Evaluate the expression before point. @end table -If @kbd{C-M-x} or @kbd{C-x C-e} is given a numeric argument, it inserts the -value into the current buffer at point, rather than displaying it in the -echo area. +If @kbd{C-M-x} or @kbd{C-x C-e} is given a numeric argument, it +inserts the value into the current buffer, rather than displaying it +in the echo area. @table @kbd - at kbditem{C-c C-p, slime-pprint-eval-last-expression} -Evaluate the expression before point and pretty-print the result. + at kbditem{C-c :, slime-interactive-eval} +Evaluate an expression read from the minibuffer. @kbditem{C-c C-r, slime-eval-region} Evaluate the region. - at kbditem{C-x M-e, slime-eval-last-expression-display-output} -Display output buffer and evaluate the expression preceding point. + at kbditem{C-c C-p, slime-pprint-eval-last-expression} +Evaluate the expression before point and pretty-print the result in a +fresh buffer. - at kbditem{C-c :, slime-interactive-eval} -Evaluate an expression read from the minibuffer. - - at anchor{slime-scratch} - at cmditem{slime-scratch} -Create a @file{*slime-scratch*} buffer. In this -buffer you can enter Lisp expressions and evaluate them with - at kbd{C-j}, like in Emacs's @file{*scratch*} buffer. - @kbditem{C-c E, slime-edit-value} Edit the value of a setf-able form in a new buffer @file{*Edit
*}. The value is inserted into a temporary buffer for editing and then set -in Lisp when committed with @code{slime-edit-value-commit}. +in Lisp when committed with @kbd{C-c C-c}. + at kbditem{C-x M-e, slime-eval-last-expression-display-output} +Display the output buffer and evaluate the expression preceding point. +This is useful if the expression writes something to the output stream. + @kbditem{C-c C-u, slime-undefine-function} -Unbind symbol for function at point. +Undefine the function, with @code{fmakunbound}, for the symbol at +point. + @end table @@ -1080,14 +1159,10 @@ @node Inspector @subsection Inspector commands -The @SLIME{} inspector is a very fancy Emacs-based alternative to the +The @SLIME{} inspector is a Emacs-based alternative to the standard @code{INSPECT} function. The inspector presents objects in Emacs buffers using a combination of plain text, hyperlinks to related -objects, and ``actions'' that can be selected to invoke Lisp code on -the inspected object. For example, to present a generic function the -inspector shows the documentation in plain text and presents each -method with both a hyperlink to inspect the method object and a -``remove method'' action that you can invoke interactively. +objects. The inspector can easily be specialized for the objects in your own programs. For details see the the @code{inspect-for-emacs} generic @@ -1120,8 +1195,9 @@ @kbditem{q, slime-inspector-quit} Dismiss the inspector buffer. - at kbditem{M-RET, slime-inspector-copy-down} -Evaluate the value under point via the REPL (to set `*'). + at kbditem{M-RET, slime-inspector-copy-down} +Store the value under point in the variable `*'. This can +then be used to access the object in the REPL. @end table @@ -1129,6 +1205,10 @@ @node Profiling @subsection Profiling commands +The profiling commands are based on CMUCL's profiler. These are +simple wrappers around functions which usually print something to the +output buffer. + @table @kbd @cmditem{slime-toggle-profile-fdefinition} Toggle profiling of a function. @@ -1205,18 +1285,20 @@ @node Reader conditionals @section Reader conditional fontification - at SLIME{} automatically evaluates reader-conditional expressions in -source buffers and ``grays out'' code that will be skipped for the -current Lisp connection. + at SLIME{} automatically evaluates reader-conditional expressions, like + at code{#+linux}, in source buffers and ``grays out'' code that will be +skipped for the current Lisp connection. @c ----------------------- @node REPL @chapter REPL: the ``top level'' + at cindex Listener + @SLIME{} uses a custom Read-Eval-Print Loop (@REPL{}, also known as a -``top level''). The @REPL{} user-interface is written in Emacs Lisp, -which gives more Emacs-integration than the traditional +``top level'', or listener). The @REPL{} user-interface is written in +Emacs Lisp, which gives more Emacs-integration than the traditional @code{comint}-based Lisp interaction: @itemize @bullet @@ -1255,35 +1337,51 @@ @kbditem{C-j, slime-repl-newline-and-indent} Open and indent a new line. + at kbditem{C-a, slime-repl-bol} +Go to the beginning of the line, but stop at the @REPL{} prompt. + @c @anchor{slime-interrupt} @kbditem{C-c C-c, slime-interrupt} Interrupt the Lisp process with @code{SIGINT}. - at kbditem{C-c M-g, slime-quit} -Quit slime. + at c @kbditem{C-c M-g, slime-quit} + at c Quit slime. + at kbditem{C-c C-t, slime-repl-clear-buffer} +Clear the entire buffer, leaving only a prompt. + @kbditem{C-c C-o, slime-repl-clear-output} Remove the output and result of the previous expression from the buffer. - at kbditem{C-c C-t, slime-repl-clear-buffer} -Clear the entire buffer, leaving only a prompt. - @end table @c ----------------------- @node Input Navigation @section Input navigation + at cindex Input History + +The input navigation (a.k.a. history) commands are modelled after + at code{coming}-mode. Be careful if you are used to Bash-like +keybindings: @kbd{M-p} and @kbd{M-n} use the current input as search +pattern and only work Bash-like if the current line is +empty. @kbd{C-} and @kbd{C-} work like the up and down keys in +Bash. + @table @kbd - at kbditem{C-a, slime-repl-bol} -Go to the beginning of the line, but stop at the @REPL{} prompt. + at kbditempair{C-, C-, + slime-repl-forward-input, slime-repl-backward-input} +Go to the next/previous history item. @kbditempair{M-n, M-p, slime-repl-next-input, slime-repl-previous-input} -Go to next/previous in command history. +Search the next/previous item in the command history using the current +input as search pattern. If @kbd{M-n}/@kbd{M-n} is typed two times in +a row, the second invocation uses the same search pattern (even if the +current input has changed). - at kbditempair{M-s, M-r, + at kbditempair{M-s, M-r, slime-repl-next-matching-input, slime-repl-previous-matching-input} Search forward/reverse through command history with regex @@ -1292,22 +1390,24 @@ @c @code{comint}-style input history commands. @kbditempair{C-c C-n, C-c C-p, -slime-repl-next-prompt, slime-repl-previous-prompt} +slime-repl-next-prompt, slime-repl-previous-prompt} Move between the current and previous prompts in the @REPL{} buffer. +Pressing RET on a line with old input copies that line to the newest +prompt. + at end table - at kbditempair{C-M-a, C-M-e, -slime-repl-beginning-of-defun, slime-repl-end-of-defun} -These commands are like @code{beginning-of-defun} and - at code{end-of-defun}, but when used inside the @REPL{} input area they -instead go directly to the beginning or the end, respectively. + at vindex slime-repl-wrap-history +The variable @code{slime-repl-wrap-history} controls wrap around +behaviour, i.e. whether cycling should restart at the beginning of the +history if the end is reached. - at end table - @c ----------------------- @comment node-name, next, previous, up @node Shortcuts @section Shortcuts + at cindex Shortcuts + ``Shortcuts'' are a special set of @REPL{} commands that are invoked by name. To invoke a shortcut you first press @kbd{,} (comma) at the @REPL{} prompt and then enter the shortcut's name when prompted. @@ -1327,24 +1427,15 @@ @item compile-and-load (aka cl) Compile (if neccessary) and load a lisp file. - at item compile-system -Compile (but not load) an ASDF system. @item defparameter (aka !) Define a new global, special, variable. - at item force-compile-system -Recompile (but not load) an ASDF system. - - at item force-load-system -Recompile and load an ASDF system. - @item help (aka ?) Display the help. - at item load-system -Compile (as needed) and load an ASDF system. + @item pop-directory (aka -d) Pop the current directory. @@ -1378,6 +1469,8 @@ @node Debugger @chapter SLDB: the SLIME debugger + at cindex Debugger + @SLIME{} has a custom Emacs-based debugger called @SLDB{}. Conditions signalled in the Lisp system invoke @SLDB{} in Emacs by way of the Lisp @code{*DEBUGGER-HOOK*}. @@ -1391,6 +1484,7 @@ * Examining frames:: * Restarts:: * Frame Navigation:: +* Stepping:: * Miscellaneous:: @end menu @@ -1461,7 +1555,29 @@ only. @end table - at c ----------------------- + at node Stepping + at section Stepping + + at cindex Stepping + +Stepping is not available in all implementations and works very +differently in those in which it is available. + + at table @kbd + at kbditem{s, sldb-step} +Step to the next expression in the frame. For CMUCL that means, set a +breakpoint at all those code locations in the current code block which +are reachable from the current code location. + + at kbditem{x, sldb-next} +[Step to the next form in the current function.] + + at kbditem{o, sldb-next} +[Stop single-stepping temporarily, but resume it once the current +function returns.] + + at end table + @node Miscellaneous @section Miscellaneous Commands @@ -1475,29 +1591,24 @@ Return from the frame with a value entered in the minibuffer. (This command is not available in all implementations.) - at kbditem{s, sldb-step} -Step to the next expression in the frame. (This command is not -available in all implementations.) @kbditem{B, sldb-break-with-default-debugger} Exit @SLDB{} and debug the condition using the Lisp system's default debugger. - at kbditem{C-c :, slime-interactive-eval} + at kbditem{:, slime-interactive-eval} Evaluate an expression entered in the minibuffer. @end table @c ----------------------- - at node Extras - at chapter Extras + at node Misc + at chapter Misc @menu * slime-selector:: -* slime-autodoc-mode:: * slime-macroexpansion-minor-mode:: * Multiple connections:: -* Typeout frames:: @end menu @c ----------------------- @@ -1538,24 +1649,6 @@ buffers for @code{slime-selector} to find. @c ----------------------- - at node slime-autodoc-mode - at section @code{slime-autodoc-mode} - - at table @kbd - at cmditem{slime-autodoc-mode} -Autodoc mode is an additional minor-mode for automatically showing -information about symbols near the point. For function names the -argument list is displayed, and for global variables, the value. -This is a clone of @code{eldoc-mode} for Emacs Lisp. - at end table - -The mode can be enabled by default in the @code{slime-setup} call of your - at code{~/.emacs}: - at example -(slime-setup '(slime-autodoc)) - at end example - - at c ----------------------- @node slime-macroexpansion-minor-mode @section slime-macroexpansion-minor-mode @@ -1648,33 +1741,7 @@ @end table - at c ----------------------- - at node Typeout frames - at section Typeout frames -A ``typeout frame'' is a special Emacs frame which is used instead of -the echo area (minibuffer) to display messages from @SLIME{} commands. -This is an optional feature. The advantage of a typeout frame over the -echo area is that it can hold more text, it can be scrolled, and its -contents don't disappear when you press a key. All potentially long -messages are sent to the typeout frame, such as argument lists, macro -expansions, and so on. - - at table @kbd - at cmditem{slime-ensure-typeout-frame} -Ensure that a typeout frame exists, creating one if necessary. - at end table - -If the typeout frame is closed then the echo area will be used again -as usual. - -To have a typeout frame created automatically at startup you can add -the @code{slime-connected-hook} to your @file{~/.emacs} file: - - at example -(add-hook 'slime-connected-hook 'slime-ensure-typeout-frame) - at end example - @c ----------------------- @node Customization @chapter Customization @@ -1705,34 +1772,13 @@ @vindex slime-complete-symbol-function @item slime-complete-symbol-function The function to use for completion of Lisp symbols. Three completion -styles are available. The default @code{slime-complete-symbol*} -performs completion ``in parallel'' over the hyphen-delimited -sub-words of a symbol name. - at footnote{This style of completion is modelled on @file{completer.el} -by Chris McConnell. That package is bundled with @acronym{ILISP}.} -Formally this means that ``@code{a-b-c}'' can complete to any symbol -matching the regular expression ``@code{^a.*-b.*-c.*}'' (where ``dot'' -matches anything but a hyphen). Examples give a more intuitive -feeling: - at itemize @bullet - at item - at code{m-v-b} completes to @code{multiple-value-bind}. - at item - at code{w-open} is ambiguous: it completes to either - at code{with-open-file} or @code{with-open-stream}. The symbol is -expanded to the longest common completion (@code{with-open-}) and the -point is placed at the first point of ambiguity, which in this case is -the end. - at item - at code{w--stream} completes to @code{with-open-stream}. - at end itemize -An alternative is @code{slime-simple-complete-symbol}, which -completes in the usual Emacs way. Finally, there is - at code{slime-fuzzy-complete-symbol}, which is quite different from both -of the above and tries to find best matches to an abbreviated symbol. -It also has its own key binding, defaulting to @kbd{C-c M-i}. - at xref{slime-fuzzy-complete-symbol}, for more information. +styles are available: @code{slime-simple-complete-symbol}, + at code{slime-complete-symbol*} (@pxref{Compound Completion}), +and @code{slime-fuzzy-complete-symbol} (@pxref{Fuzzy Completion}). +The default is @code{slime-simple-complete-symbol}, which completes in +the usual Emacs way. + @vindex slime-filename-translations @item slime-filename-translations This variable controls filename translation between Emacs and the Lisp @@ -1741,7 +1787,13 @@ but have different layouts, as is the case with @acronym{SMB}-based file sharing. + at anchor{slime-net-coding-system} @vindex slime-net-coding-system + at cindex Unicode + at cindex UTF-8 + at cindex ASCII + at cindex LATIN-1 + at cindex Character Encoding @item slime-net-coding-system If you want to transmit Unicode characters between Emacs and the Lisp system, you should customize this variable. E.g., if you use SBCL, you @@ -1749,11 +1801,12 @@ @example (setq slime-net-coding-system 'utf-8-unix) @end example -To actually display Unicode characters you also need appropriate fonts, -otherwise the characters will be rendered as hollow boxes. If you are -using Allegro CL and GNU Emacs, you can also use @code{emacs-mule-unix} -as coding system. GNU Emacs has often nicer fonts for the latter -encoding. +To actually display Unicode characters you also need appropriate +fonts, otherwise the characters will be rendered as hollow boxes. If +you are using Allegro CL and GNU Emacs, you can also +use @code{emacs-mule-unix} as coding system. GNU Emacs has often +nicer fonts for the latter encoding. (Different encodings can be used +for different Lisps, see @ref{Multiple Lisps}.) @end table @@ -1774,6 +1827,7 @@ buffers. An example use is to enable @code{slime-autodoc-mode} (@pxref{slime-autodoc-mode}). + at anchor{slime-connected-hook} @vindex slime-connected-hook @item slime-connected-hook This hook is run when @SLIME{} establishes a connection to a Lisp @@ -2075,7 +2129,8 @@ @file{/opt/project/source.lisp} refers to the same file on both machines. Unfortunetly NFS is usually slow, often buggy, and not always feasable, fortunetely we have an ssh connection and Emacs' - at code{tramp-mode} can do the rest. + at code{tramp-mode} can do the rest. +(See @inforef{Top, TRAMP User Manual,tramp}.) What we do is teach Emacs how to take a filename on the remote machine and translate it into something that tramp can understand and access @@ -2130,7 +2185,440 @@ (save-excursion (slime))))) @end example + at node Contributed Packages + at chapter Contributed Packages +In version 3.0 we moved some functionility to separate packages. This +chapter tells you how to load contrib modules and describes what the +particular packages do. + + at menu +* Loading Contribs:: +* Compound Completion:: +* Fuzzy Completion:: +* slime-autodoc-mode:: +* ASDF:: +* Banner:: +* Editing Commands:: +* Fancy Inspector:: +* Presentations:: +* Typeout frames:: +* TRAMP:: +* Documentation Links:: +* Xref and Class Browser:: +* Highlight Edits:: +* inferior-slime-mode:: +* Scratch Buffer:: +* slime-fancy:: + at end menu + + at node Loading Contribs + at section Loading Contrib Packages + + at cindex Contribs + at cindex Contributions + at cindex Plugins + +Contrib packages aren't loaded by default. You have to modify your +setup a bit so that Emacs knows where to find them and which of them +to load, i.e. you should add the contrib directory to +Emacs' @code{load-path} and call @code{slime-setup} with the list of +package-names. For example, a setup to load the @code{slime-scratch} +and @code{slime-editing-commands} looks like: + + at example +(add-to-list 'load-path ".../slime") ; path for core +(add-to-list 'load-path ".../slime/contrib") ; path for contribs +(require 'slime-autoloads) +(slime-setup '(slime-scratch slime-editing-commands)) + at end example + +After starting SLIME, the commands of both packages should be +available. + + at node Compound Completion + at section Compund Completion + + at anchor{slime-complete-symbol*} +The package @code{slime-c-p-c} provides a different symbol completion +algorithm, which performs completion ``in parallel'' over the +hyphen-delimited sub-words of a symbol name. + at footnote{This style of completion is modelled on @file{completer.el} +by Chris McConnell. That package is bundled with @acronym{ILISP}.} +Formally this means that ``@code{a-b-c}'' can complete to any symbol +matching the regular expression ``@code{^a.*-b.*-c.*}'' (where ``dot'' +matches anything but a hyphen). Examples give a more intuitive +feeling: + at itemize @bullet + at item + at code{m-v-b} completes to @code{multiple-value-bind}. + at item + at code{w-open} is ambiguous: it completes to either + at code{with-open-file} or @code{with-open-stream}. The symbol is +expanded to the longest common completion (@code{with-open-}) and the +point is placed at the first point of ambiguity, which in this case is +the end. + at item + at code{w--stream} completes to @code{with-open-stream}. + at end itemize + +The variable @code{slime-c-p-c-unambiguous-prefix-p} specifies where +point should be placed after completion. E.g. the possible +completions for @code{f-o} are @code{finish-output} and + at code{force-output}. By the default point is moved after the + at code{f}, because that is the unambigous prefix. If + at code{slime-c-p-c-unambiguous-prefix-p} is nil, point moves to +the end of the inserted text, after the @code{o} in this case. + + at table @kbd + at kbditem{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 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 end table + + at node Fuzzy Completion + at section Fuzzy Completion + +The package @code{slime-fuzzy} implements yet another symbol +completion heuristic. + +[Somebody please describe what the algorithm actually does] + +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}''. + +The algorithm tries to expand every character in various ways and +rates the list of possible completions with the following heuristic. + +Letters are given scores based on their position in the string. +Letters at the beginning of a string or after a prefix letter at +the beginning of a string are scored highest. Letters after a +word separator such as #\- are scored next highest. Letters at +the end of a string or before a suffix letter at the end of a +string are scored medium, and letters anywhere else are scored +low. + +If a letter is directly after another matched letter, and its +intrinsic value in that position is less than a percentage of the +previous letter's value, it will use that percentage instead. + +Finally, a small scaling factor is applied to favor shorter +matches, all other things being equal. + + at table @kbd + at anchor{slime-fuzzy-complete-symbol} + at kbditem{C-c M-i, slime-fuzzy-complete-symbol} +Presents a list of likely completions to choose from for an +abbreviation at point. If you set the +variable @code{slime-complete-symbol-function} to this command, fuzzy +completion will also be used for @kbd{M-TAB}. + at end table + + at node slime-autodoc-mode + at section @code{slime-autodoc-mode} + +Autodoc mode is an additional minor-mode for automatically showing +information about symbols near the point. For function names the +argument list is displayed, and for global variables, the value. +This is a clone of @code{eldoc-mode} for Emacs Lisp. + +The mode can be enabled by default in the @code{slime-setup} call of your + at code{~/.emacs}: + at example +(slime-setup '(slime-autodoc)) + at end example + + at table @kbd + at cmditem{slime-arglist NAME} +Show the argument list of the function NAME. + + at cmditem{slime-autodoc-mode} +Toggles autodoc-mode on or off according to the argument, and +toggles the mode when invoked without argument. + at end table + +If the variable @code{slime-use-autodoc-mode} is set (default), Emacs +starts a timer, otherwise the information is only displayed after +pressing SPC. + + at node ASDF + at section ASDF + + at acronym{ASDF} is a popular ``system construction tool''. The package + at code{slime-asdf} provides some commands to load and compile such +systems from Emacs. @acronym{ASDF} itself is not included with + at SLIME{}; you have to load that yourself into your Lisp. In +particular, you must load @acronym{ASDF} before you connect, otherwise +you will get errors about missing symbols. + + at table @kbd + at cmditem{slime-load-system NAME} +Compile and load an ASDF system. The default system name is taken +from the first file matching *.asd in the current directory. + at end table + +The package also installs some new REPL shortcuts (@pxref{Shortcuts}): + + at table @kbd + at item load-system +Compile (as needed) and load an ASDF system. + at item compile-system +Compile (but not load) an ASDF system. + at item force-compile-system +Recompile (but not load) an ASDF system. + at item force-load-system +Recompile and load an ASDF system. + at end table + + at node Banner + at section Banner +The package @code{slime-banner} installs a window header line ( + at inforef{Header Lines, , elisp}.) in the REPL buffer. It also runs an +animation at startup. + + at vindex slime-startup-animation + at vindex slime-header-line-p +By setting the variable @code{slime-startup-animation} to nil you can +disable the animation respectivly with the +variable @code{slime-header-line-p} the header line. + + at node Editing Commands + at section Editing Commands + +The package @code{slime-editing-commands} provides some commands to +edit Lisp expressions. + + at table @kbd + at kbditem{C-c M-q, slime-reindent-defun} +Re-indents the current defun, or refills the current paragraph. +If point is inside a comment block, the text around point will be +treated as a paragraph and will be filled with @code{fill-paragraph}. +Otherwise, it will be treated as Lisp code, and the current defun +will be reindented. If the current defun has unbalanced parens, +an attempt will be made to fix it before reindenting. + + at cmditem{slime-close-all-parens-in-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 REGION is true, operate on the region. Otherwise operate on +the top-level sexp before point. + + at cmditem{slime-insert-balanced-comments} +Insert a set of balanced comments around the s-expression containing +the point. If this command is invoked repeatedly (without any other +command occurring between invocations), the comment progressively +moves outward over enclosing expressions. If invoked with a positive +prefix argument, the s-expression arg expressions out is enclosed in a +set of balanced comments. + + at kbditem{M-C-a, slime-beginning-of-defun} + at kbditem{M-C-e, slime-end-of-defun} + at end table + + at node Fancy Inspector + at section Fancy Inspector + + at cindex Methods + +An alternative to default inspector is provided by the package +`slime-fancy-inspector'. This inspector knows a lot about CLOS +objects and methods. It provides many ``actions'' that can be +selected to invoke Lisp code on the inspected object. For example, to +present a generic function the inspector shows the documentation in +plain text and presents each method with both a hyperlink to inspect +the method object and a ``remove method'' action that you can invoke +interactively. The key-bindings are the same as for the basic +inspector (@pxref{Inspector}). + + at node Presentations + at section Presentations + + at cindex Presentations + +A ``presentation''@footnote{Presentations are a feature originating +from the Lisp machines. It was possible to define @code{present} +methods specialized to various devices, e.g. to draw an object to +bitmapped screen or to write some text to a character stream.} in + at SLIME{} is a region of text associated with a Lisp object. +Right-clicking on the text brings up a menu with operations for the +particular object. Some operations, like inspecting, are available +for all objects, but the object may also have specialized operations. +E.g. pathnames have a dired operation. + +The package @code{slime-presentations} installs presentations in the +REPL, i.e. the results of evaluation commands become presentations. + +For some implementations you can also install + at code{slime-presentation-streams} which enables presentations on the +Lisp @code{*standard-output*} stream. E.g. printing a list to such a +stream will create presentions in the Emacs buffer. + + at table @kbd + at cmditem{slime-copy-or-inspect-presentation-at-mouse} + at cmditem{slime-inspect-presentation-at-mouse} + at cmditem{slime-copy-presentation-at-mouse} + at cmditem{slime-copy-presentation-at-mouse-to-point} + at cmditem{slime-copy-presentation-at-mouse-to-kill-ring} + at cmditem{slime-describe-presentation-at-mouse} + at cmditem{slime-pretty-print-presentation-at-mouse} + at cmditem{slime-clear-presentations} + at end table + + at node Typeout frames + at section Typeout frames + + at cindex Typeout Frame + +A ``typeout frame'' is a special Emacs frame which is used instead of +the echo area (minibuffer) to display messages from @SLIME{} commands. +This is an optional feature. The advantage of a typeout frame over the +echo area is that it can hold more text, it can be scrolled, and its +contents don't disappear when you press a key. All potentially long +messages are sent to the typeout frame, such as argument lists, macro +expansions, and so on. + + at table @kbd + at cmditem{slime-ensure-typeout-frame} +Ensure that a typeout frame exists, creating one if necessary. + at end table + +If the typeout frame is closed then the echo area will be used again +as usual. + +To have a typeout frame created automatically at startup you should +load the @code{slime-typeout-frame} package. (@pxref{Loading Contribs}.) + +The variable @code{slime-typeout-frame-properties} specifies the +height and possibly other properties of the frame. Its value is +passed to @code{make-frame}. (@inforef{Creating Frames, ,elisp}.) + + at node TRAMP + at section TRAMP + + at cindex TRAMP + +The package @code{slime-tramp} provides some functions to set up +filename translations for TRAMP. (@pxref{Setting up pathname +translations}) + + at node Documentation Links + at section Documentation Links + +For certain error messages, SBCL includes references to the ANSI +Standard or the SBCL User Manual. The @code{slime-references} package +turns those references into clickable links. This makes finding the +referenced section of the HyperSpec much easier. + + at node Xref and Class Browser + at section Xref and Class Browser + +A rudimentary class browser is provied by +the @code{slime-xref-browser} package. + + at table @kbd + at cmditem{slime-browse-classes} +This command asks for a class name and displays inheritance tree of +for the class. + + at cmditem{slime-browse-xrefs} +This command prompts for a symbol and the kind of cross reference, +e.g. callers. The cross reference tree rooted at the symbol is then +then displayed. + + at end table + + + at node Highlight Edits + at section Highlight Edits + + at code{slime-highlight-edits} is a minor mode to highlight those +regions in a Lisp source file which are modified. This is useful to +quickly find those functions which need to be recompiled (whith + at kbd{C-c C-c}) + + at table @kbd + at cmditem{slime-highlight-edits-mode} +Turns @code{slime-highlight-edits-mode} on or off. + at end table + + at node inferior-slime-mode + at section @code{inferior-slime-mode} + +The @code{inferior-slime-mode} is a minor mode is intended to use with +a comint buffer. It provides some of the SLIME commands, like symbol +completion and documentation lookup. To install it, add something +like this to user @file{.emacs}: + + at example +(slime-setup '(inferior-slime-mode)) +(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode 1))) + at end example + + at table @kbd + at cmditem{inferior-slime-mode} +Turns inferior-slime-mode on or off. + at end table + + at vindex inferior-slime-mode-map +The variable @code{inferior-slime-mode-map} contains the extra +keybindings. + + at node Scratch Buffer + at section Scratch Buffer + + at anchor{slime-scratch} +The @SLIME{} scratch buffer, in contrib package @code{slime-scratch}, +imitates Emacs' usual @code{*scratch*} buffer. It's just like any +other Lisp buffer, except for the command bound to @kbd{C-j}. + + at table @kbd + + at kbditem{C-j, slime-eval-print-last-expression} +Evaluate the expression sexp before point and insert print value into +the current buffer. + + at cmditem{slime-scratch} +Create a @file{*slime-scratch*} buffer. In this +buffer you can enter Lisp expressions and evaluate them with + at kbd{C-j}, like in Emacs's @file{*scratch*} buffer. + + at end table + + at node slime-fancy + at section Meta package: @code{slime-fancy} + + at code{slime-fancy} is a meta package which loads a combination of the +most popular packages. + @c ----------------------- @node Credits @chapter Credits @@ -2172,8 +2660,8 @@ This index is currently ingored, because texinfo's built-in indexing produces nicer results. -- Helmut Eller - at node Index to Functions - at appendix Index to Functions + at c@node Index to Functions + at c@appendix Index to Functions These functions are all available (when relevant). To find the keybinding (if there is one) refer to the function description. @@ -2456,16 +2944,20 @@ @end ignore - at node Key Index, Command Index, Credits, top + at node Key Index @unnumbered Key (Character) Index @printindex ky - at node Command Index, Variable Index, Key Index, top + at node Command Index @unnumbered Command and Function Index @printindex fn - at node Variable Index, , Command Index, top - at unnumbered Variable Index + at node Variable Index + at unnumbered Variable and Concept Index @printindex vr @bye +Local Variables: +paragraph-start: "@[a-zA-Z]+\\({[^}]+}\\)?[ \n]\\|[ ]*$" +paragraph-separate: "@[a-zA-Z]+\\({[^}]+}\\)?[ \n]\\|[ ]*$" +End: Modified: branches/trunk-reorg/thirdparty/slime/slime.el =================================================================== --- branches/trunk-reorg/thirdparty/slime/slime.el 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/slime.el 2007-12-02 18:46:42 UTC (rev 2295) @@ -488,13 +488,18 @@ (defun slime-pretty-package-name (name) "Return a pretty version of a package name NAME." - (let ((name (cond ((string-match "^:\\(.*\\)$" name) + (let ((name (cond ((string-match "^#?:\\(.*\\)$" name) (match-string 1 name)) ((string-match "^\"\\(.*\\)\"$" name) (match-string 1 name)) (t name)))) (format "%s" (read name)))) +(defun slime-pretty-current-package () + "Retrun a prettied version of `slime-current-package'." + (let ((p (slime-current-package))) + (and p (slime-pretty-package-name p)))) + (when slime-update-modeline-package (run-with-idle-timer 0.2 0.2 'slime-update-modeline-package)) @@ -1933,6 +1938,9 @@ "The symbol-names of Lisp's *FEATURES*. This is automatically synchronized from Lisp.") +(slime-def-connection-var slime-lisp-modules '() + "The strings of Lisp's *MODULES*.") + (slime-def-connection-var slime-lisp-package "COMMON-LISP-USER" "The current package name of the Superior lisp. @@ -2002,14 +2010,16 @@ "Initialize CONNECTION with INFO received from Lisp." (let ((slime-dispatching-connection connection)) (destructuring-bind (&key pid style lisp-implementation machine - features package version &allow-other-keys) info + features package version modules + &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) + (slime-lisp-features) features + (slime-lisp-modules) modules) (destructuring-bind (&key name prompt) package (setf (slime-lisp-package) name (slime-lisp-package-prompt-string) prompt)) @@ -2029,6 +2039,7 @@ (slime-generate-connection-name (symbol-name name))))) (slime-hide-inferior-lisp-buffer) (slime-init-output-buffer connection) + (slime-load-contribs) (run-hooks 'slime-connected-hook) (when-let (fun (plist-get args ':init-function)) (funcall fun))) @@ -2244,15 +2255,12 @@ ;; (in-package #+ansi-cl :cl #-ansi-cl 'lisp) (defun slime-search-buffer-package () (let ((case-fold-search t) - (regexp (concat "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \n\t\r']*" - "\\([^)]+\\)[ \n\t]*)"))) + (regexp (concat "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \t']*" + "\\([^)]+\\)[ \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))))))) + (match-string-no-properties 2))))) ;;; Synchronous requests are implemented in terms of asynchronous ;;; ones. We make an asynchronous request with a continuation function @@ -2840,6 +2848,7 @@ (slime-define-keys slime-repl-mode-map ("\C-m" 'slime-repl-return) + ([return] 'slime-repl-return) ("\C-j" 'slime-repl-newline-and-indent) ("\C-\M-m" 'slime-repl-closing-return) ([(control return)] 'slime-repl-closing-return) @@ -3302,8 +3311,8 @@ (defun slime-repl-set-package (package) "Set the package of the REPL buffer to PACKAGE." - (interactive (list (slime-read-package-name "Package: " - (slime-find-buffer-package)))) + (interactive (list (slime-read-package-name + "Package: " (slime-pretty-current-package)))) (with-current-buffer (slime-output-buffer) (let ((unfinished-input (slime-repl-current-input))) (destructuring-bind (name prompt-string) @@ -3565,6 +3574,7 @@ nil "[read]" '(("\C-m" . slime-repl-return) + ([return] . slime-repl-return) ("\C-c\C-b" . slime-repl-read-break) ("\C-c\C-c" . slime-repl-read-break))) @@ -4167,6 +4177,7 @@ (slime-define-keys slime-compiler-notes-mode-map ((kbd "RET") 'slime-compiler-notes-default-action-or-show-details) + ([return] 'slime-compiler-notes-default-action-or-show-details) ([mouse-2] 'slime-compiler-notes-default-action-or-show-details/mouse) ("q" 'slime-temp-buffer-quit)) @@ -5985,6 +5996,7 @@ (slime-define-keys slime-xref-mode-map ((kbd "RET") 'slime-show-xref) + ([return] 'slime-show-xref) ("\C-m" 'slime-show-xref) (" " 'slime-goto-xref) ("q" 'slime-xref-quit) @@ -6374,7 +6386,7 @@ (defun slime-set-package (package) (interactive (list (slime-read-package-name "Package: " - (slime-find-buffer-package)))) + (slime-pretty-current-package)))) (message "*package*: %s" (slime-eval `(swank:set-package ,package)))) (defun slime-set-default-directory (directory) @@ -6516,6 +6528,7 @@ ("v" 'sldb-show-source) ((kbd "RET") 'sldb-default-action) ("\C-m" 'sldb-default-action) + ([return] 'sldb-default-action) ([mouse-2] 'sldb-default-action/mouse) ([follow-link] 'mouse-face) ("e" 'sldb-eval-in-frame) @@ -7339,6 +7352,7 @@ (slime-define-keys slime-connection-list-mode-map ((kbd "RET") 'slime-goto-connection) + ([return] 'slime-goto-connection) ("d" 'slime-connection-list-make-default) ("g" 'slime-update-connection-list) ((kbd "C-k") 'slime-quit-connection-at-point) @@ -7680,7 +7694,7 @@ (slime-define-keys slime-inspector-mode-map ([return] 'slime-inspector-operate-on-point) - ([(meta return)] 'slime-inspector-copy-down) + ((kbd "M-RET") 'slime-inspector-copy-down) ("\C-m" 'slime-inspector-operate-on-point) ([mouse-2] 'slime-inspector-operate-on-click) ("l" 'slime-inspector-pop) @@ -7901,6 +7915,27 @@ (run-hook-with-args 'slime-indentation-update-hooks symbol indent)))) +;;;; Contrib modules + +(defvar slime-required-modules '()) + +(defun slime-require (module) + (assert (keywordp module)) + (pushnew module slime-required-modules) + (when (slime-connected-p) + (slime-load-contribs))) + +(defun slime-load-contribs () + (let ((needed (remove-if (lambda (s) + (member (subseq (symbol-name s) 1) + (mapcar #'downcase (slime-lisp-modules)))) + slime-required-modules))) + (when needed + (slime-eval-async `(swank:swank-require ',needed) + (lambda (new-modules) + (setf (slime-lisp-modules) new-modules)))))) + + ;;;;; Pull-down menu (defvar slime-easy-menu @@ -9072,14 +9107,18 @@ (apply #'buffer-substring-no-properties (slime-region-for-defun-at-point))) +(defvar slime-region-for-defun-function nil) + (defun slime-region-for-defun-at-point () "Return the start and end position of the toplevel form at point." - (save-excursion - (save-match-data - (end-of-defun) - (let ((end (point))) - (beginning-of-sexp) - (list (point) end))))) + (or (and slime-region-for-defun-function + (funcall slime-region-for-defun-function)) + (save-excursion + (save-match-data + (end-of-defun) + (let ((end (point))) + (beginning-of-sexp) + (list (point) end)))))) (defun slime-beginning-of-symbol () "Move point to the beginning of the current symbol." Modified: branches/trunk-reorg/thirdparty/slime/swank-cmucl.lisp =================================================================== --- branches/trunk-reorg/thirdparty/slime/swank-cmucl.lisp 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/swank-cmucl.lisp 2007-12-02 18:46:42 UTC (rev 2295) @@ -911,16 +911,17 @@ (vm::find-code-object function)) (not (eq closure function)))) - -(defun byte-function-location (fn) - "Return the location of the byte-compiled function FN." - (etypecase fn +(defun byte-function-location (fun) + "Return the location of the byte-compiled function FUN." + (etypecase fun ((or c::hairy-byte-function c::simple-byte-function) - (let* ((component (c::byte-function-component fn)) - (debug-info (kernel:%code-debug-info component))) - (debug-info-function-name-location debug-info))) + (let* ((di (kernel:%code-debug-info (c::byte-function-component fun)))) + (if di + (debug-info-function-name-location di) + `(:error + ,(format nil "Byte-function without debug-info: ~a" fun))))) (c::byte-closure - (byte-function-location (c::byte-closure-function fn))))) + (byte-function-location (c::byte-closure-function fun))))) ;;; Here we deal with structure accessors. Note that `dd' is a ;;; "defstruct descriptor" structure in CMUCL. A `dd' describes a Modified: branches/trunk-reorg/thirdparty/slime/swank-lispworks.lisp =================================================================== --- branches/trunk-reorg/thirdparty/slime/swank-lispworks.lisp 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/swank-lispworks.lisp 2007-12-02 18:46:42 UTC (rev 2295) @@ -542,22 +542,10 @@ (defun unmangle-unfun (symbol) "Converts symbols like 'SETF::|\"CL-USER\" \"GET\"| to function names like \(SETF GET)." - (or (and (eq (symbol-package symbol) - (load-time-value (find-package :setf))) - (let ((slime-nregex::*regex-groupings* 0) - (slime-nregex::*regex-groups* (make-array 10)) - (symbol-name (symbol-name symbol))) - (and (funcall (load-time-value - (compile nil (slime-nregex:regex-compile "^\"(.+)\" \"(.+)\"$"))) - symbol-name) - (list 'setf - (intern (apply #'subseq symbol-name - (aref slime-nregex::*regex-groups* 2)) - (find-package - (apply #'subseq symbol-name - (aref slime-nregex::*regex-groups* 1)))))))) - symbol)) - + (cond ((sys::setf-symbol-p symbol) + (sys::setf-pair-from-underlying-name symbol)) + (t symbol))) + (defun signal-undefined-functions (htab &optional filename) (maphash (lambda (unfun dspecs) (dolist (dspec dspecs) Modified: branches/trunk-reorg/thirdparty/slime/swank-loader.lisp =================================================================== --- branches/trunk-reorg/thirdparty/slime/swank-loader.lisp 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/swank-loader.lisp 2007-12-02 18:46:42 UTC (rev 2295) @@ -33,7 +33,7 @@ (defparameter *sysdep-files* (append - '("nregex") + '() #+cmu '("swank-source-path-parser" "swank-source-file-cache" "swank-cmucl") #+scl '("swank-source-path-parser" "swank-source-file-cache" "swank-scl") #+sbcl '("swank-source-path-parser" "swank-source-file-cache" Modified: branches/trunk-reorg/thirdparty/slime/swank.lisp =================================================================== --- branches/trunk-reorg/thirdparty/slime/swank.lisp 2007-11-29 13:18:49 UTC (rev 2294) +++ branches/trunk-reorg/thirdparty/slime/swank.lisp 2007-12-02 18:46:42 UTC (rev 2295) @@ -17,6 +17,8 @@ (:export #:startup-multiprocessing #:start-server #:create-server + #:stop-server + #:restart-server #:ed-in-emacs #:inspect-in-emacs #:print-indentation-lossage @@ -103,9 +105,15 @@ (*print-array* . t) (*print-lines* . 10) (*print-escape* . t) - (*print-right-margin* . 70)) + (*print-right-margin* . 65)) "A set of printer variables used in the debugger.") +(defvar *backtrace-printer-bindings* + `((*print-pretty* . nil) + (*print-level* . 4) + (*print-length* . 6)) + "Pretter settings for printing backtraces.") + (defvar *default-worker-thread-bindings* '() "An alist to initialize dynamic variables in worker threads. The list has the form ((VAR . VALUE) ...). Each variable VAR will be @@ -577,19 +585,20 @@ (defvar *coding-system* "iso-latin-1-unix") +(defvar *listener-sockets* nil + "A property list of lists containing style, socket pairs used + by swank server listeners, keyed on socket port number. They + are used to close sockets on server shutdown or restart.") + (defun start-server (port-file &key (style *communication-style*) (dont-close *dont-close*) (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 - (find-external-format-or-lose coding-system)))) - (if (eq style :spawn) - (initialize-multiprocessing #'start-server-aux) - (start-server-aux)))) + (setup-server 0 (lambda (port) + (announce-server-port port-file port)) + style dont-close + (find-external-format-or-lose coding-system))) (defun create-server (&key (port default-server-port) (style *communication-style*) @@ -610,19 +619,61 @@ (defun setup-server (port announce-fn style dont-close external-format) (declare (type function announce-fn)) (let* ((socket (create-socket *loopback-interface* port)) - (port (local-port socket))) - (funcall announce-fn port) + (local-port (local-port socket))) + (funcall announce-fn local-port) (flet ((serve () (serve-connection socket style dont-close external-format))) (ecase style (:spawn - (spawn (lambda () (loop do (ignore-errors (serve)) while dont-close)) - :name "Swank")) + (initialize-multiprocessing + (lambda () + (spawn (lambda () + (loop do (ignore-errors (serve)) while dont-close)) + :name (concatenate 'string "Swank " + (princ-to-string port)))))) ((:fd-handler :sigio) (add-fd-handler socket (lambda () (serve)))) ((nil) (loop do (serve) while dont-close))) - port))) + (setf (getf *listener-sockets* port) (list style socket)) + local-port))) +(defun stop-server (port) + "Stop server running on PORT." + (let* ((socket-description (getf *listener-sockets* port)) + (style (first socket-description)) + (socket (second socket-description))) + (ecase style + (:spawn + (let ((thread-position + (position-if + (lambda (x) + (string-equal (first x) + (concatenate 'string "Swank " + (princ-to-string port)))) + (list-threads)))) + (when thread-position + (kill-nth-thread thread-position) + (close-socket socket) + (remf *listener-sockets* port)))) + ((:fd-handler :sigio) + (remove-fd-handlers socket) + (close-socket socket) + (remf *listener-sockets* port))))) + +(defun restart-server (&key (port default-server-port) + (style *communication-style*) + (dont-close *dont-close*) + (coding-system *coding-system*)) + "Stop the server listening on PORT, then start a new 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." + (stop-server port) + (sleep 5) + (create-server :port port :style style :dont-close dont-close + :coding-system coding-system)) + + (defun serve-connection (socket style dont-close external-format) (let ((closed-socket-p nil)) (unwind-protect @@ -1443,6 +1494,7 @@ :type ,(machine-type) :version ,(machine-version)) :features ,(features-for-emacs) + :modules ,*modules* :package (:name ,(package-name *package*) :prompt ,(package-string-for-prompt *package*)) :version ,*swank-wire-protocol-version*)) @@ -1629,20 +1681,10 @@ (defun parse-package (string) "Find the package named STRING. Return the package or nil." - (check-type string (or string null)) - (if (zerop (length string)) - nil - (multiple-value-bind (name pos interned?) - (let ((*package* *swank-io-package*)) - (ignore-errors (read-softly-from-string string))) - (unwind-protect - (and name - (or (symbolp name) - (stringp name)) - (= (length string) pos) - (find-package name)) - (when interned? - (unintern-in-home-package name)))))) + ;; STRING comes usually from a (in-package STRING) form. + (ignore-errors + (find-package (let ((*package* *swank-io-package*)) + (read-from-string string))))) (defun unparse-name (string) "Print the name STRING according to the current printer settings." @@ -2017,7 +2059,7 @@ (defun safe-condition-message (condition) "Safely print condition to a string, handling any errors during printing." - (let ((*print-pretty* t)) + (let ((*print-pretty* t) (*print-right-margin* 65)) (handler-case (format-sldb-condition condition) (error (cond) @@ -2053,8 +2095,9 @@ (loop for frame in (compute-backtrace start end) for i from start collect (list i (with-output-to-string (stream) - (handler-case - (print-frame frame stream) + (handler-case + (with-bindings *backtrace-printer-bindings* + (print-frame frame stream)) (t () (format stream "[error printing frame]"))))))) @@ -2138,11 +2181,12 @@ (defslimefun frame-locals-for-emacs (index) "Return a property list ((&key NAME ID VALUE) ...) describing the local variables in the frame INDEX." - (mapcar (lambda (frame-locals) - (destructuring-bind (&key name id value) frame-locals - (list :name (prin1-to-string name) :id id - :value (to-string value)))) - (frame-locals index))) + (with-bindings *backtrace-printer-bindings* + (mapcar (lambda (frame-locals) + (destructuring-bind (&key name id value) frame-locals + (list :name (prin1-to-string name) :id id + :value (to-string value)))) + (frame-locals index)))) (defslimefun frame-catch-tags-for-emacs (frame-index) (mapcar #'to-string (frame-catch-tags frame-index))) @@ -2280,10 +2324,12 @@ ;;;;; swank-require -(defslimefun swank-require (module &optional filename) +(defslimefun swank-require (modules &optional filename) "Load the module MODULE." - (require module (or filename (module-filename module))) - nil) + (dolist (module (if (listp modules) modules (list modules))) + (unless (member (string module) *modules* :test #'string=) + (require module (or filename (module-filename module))))) + *modules*) (defvar *find-module* 'find-module "Pluggable function to locate modules. @@ -2358,16 +2404,16 @@ ;;;; Simple completion -(defslimefun simple-completions (string buffer-package) +(defslimefun simple-completions (string package) "Return a list of completions for the string STRING." - (let ((strings (all-completions string buffer-package #'prefix-match-p))) + (let ((strings (all-completions string package #'prefix-match-p))) (list strings (longest-common-prefix strings)))) -(defun all-completions (string buffer-package test) +(defun all-completions (string package test) (multiple-value-bind (name pname intern) (tokenize-symbol string) (let* ((extern (and pname (not intern))) (pack (cond ((equal pname "") keyword-package) - ((not pname) (guess-buffer-package buffer-package)) + ((not pname) (guess-buffer-package package)) (t (guess-package pname)))) (test (lambda (sym) (funcall test name (unparse-symbol sym)))) (syms (and pack (matching-symbols pack extern test)))) @@ -2480,24 +2526,15 @@ (string< (symbol-name x) (symbol-name y)) (string< (package-name px) (package-name py))))))))) -(let ((regex-hash (make-hash-table :test #'equal))) - (defun compiled-regex (regex-string) - (or (gethash regex-string regex-hash) - (setf (gethash regex-string regex-hash) - (if (zerop (length regex-string)) - (lambda (s) (check-type s string) t) - (compile nil (slime-nregex:regex-compile regex-string))))))) - -(defun make-regexp-matcher (string case-sensitive) - (let* ((case-modifier (if case-sensitive #'string #'string-upcase)) - (regex (compiled-regex (funcall case-modifier string)))) +(defun make-apropos-matcher (pattern case-sensitive) + (let ((chr= (if case-sensitive #'char= #'char-equal))) (lambda (symbol) - (funcall regex (funcall case-modifier symbol))))) + (search pattern (string symbol) :test chr=)))) (defun apropos-symbols (string external-only case-sensitive package) (let ((packages (or package (remove (find-package :keyword) (list-all-packages)))) - (matcher (make-regexp-matcher string case-sensitive)) + (matcher (make-apropos-matcher string case-sensitive)) (result)) (with-package-iterator (next packages :external :internal) (loop (multiple-value-bind (morep symbol) (next) @@ -2875,15 +2912,13 @@ *inspectee-actions* (make-array 10 :adjustable t :fill-pointer 0) *inspector-history* (make-array 10 :adjustable t :fill-pointer 0))) -;; FIXME: Unused? (defun valid-function-name-p (form) - (or (and (not (null form)) - (not (eq form t)) - (symbolp form)) + (or (symbolp form) (and (consp form) (second form) (not (third form)) - (eq (first form) 'setf)))) + (eq (first form) 'setf) + (symbolp (second form))))) (defslimefun init-inspector (string) (with-buffer-syntax () From bknr at bknr.net Sun Dec 2 23:36:28 2007 From: bknr at bknr.net (bknr at bknr.net) Date: Sun, 2 Dec 2007 18:36:28 -0500 (EST) Subject: [bknr-cvs] r2296 - in branches/trunk-reorg/projects/scrabble: src website Message-ID: <20071202233628.48AE45B069@common-lisp.net> Author: hhubner Date: 2007-12-02 18:36:27 -0500 (Sun, 02 Dec 2007) New Revision: 2296 Modified: branches/trunk-reorg/projects/scrabble/src/web.lisp branches/trunk-reorg/projects/scrabble/website/scrabble.js Log: Gameplay fixes. Modified: branches/trunk-reorg/projects/scrabble/src/web.lisp =================================================================== --- branches/trunk-reorg/projects/scrabble/src/web.lisp 2007-12-02 18:46:42 UTC (rev 2295) +++ branches/trunk-reorg/projects/scrabble/src/web.lisp 2007-12-02 23:36:27 UTC (rev 2296) @@ -55,6 +55,7 @@ (encode-json-plist (list :type "move" :participant-login (user-login (player-of (participant-of move))) :score (score-of move) + :player-score (score-of (participant-of move)) :placed-tiles (placed-tiles-of move) :words (mapcar (lambda (word-cons) (list (car word-cons) (cdr word-cons))) @@ -64,12 +65,14 @@ (defmethod encode-json ((move move-withdrawal) stream) (encode-json-plist (list :type "move-withdrawal" :participant-login (user-login (player-of (participant-of move))) + :player-score (score-of (participant-of move)) :reason (or (reason-of move) "")) stream)) (defmethod encode-json ((move tile-swap) stream) (encode-json-plist (list :type "tile-swap" :participant-login (user-login (player-of (participant-of move))) + :player-score (score-of (participant-of move)) :reason (count-of move)) stream)) @@ -92,6 +95,7 @@ (start-session) (encode-json-plist (append (list :login (user-login (player-of participant)) :name (user-full-name (player-of participant)) + :score (score-of participant) :remaining-tiles) (list (if (eq (player-of participant) (session-value :user)) Modified: branches/trunk-reorg/projects/scrabble/website/scrabble.js =================================================================== --- branches/trunk-reorg/projects/scrabble/website/scrabble.js 2007-12-02 18:46:42 UTC (rev 2295) +++ branches/trunk-reorg/projects/scrabble/website/scrabble.js 2007-12-02 23:36:27 UTC (rev 2296) @@ -1,4 +1,4 @@ -// -*- Java -*- (really Javascript) +// -*- JavaScript -*- var boardScoring = [["triple-word",null,null,"double-letter",null,null,null,"triple-word", null,null,null,"double-letter",null,null,"triple-word"], @@ -38,7 +38,7 @@ // Given the board and list of placed tiles, either throw an error or // return if the move is legal. - var positions = map(function (placement) { return [ placement[0], placement[1] ] }, placedTiles) + var positions = map(function (placement) { return [ placement.x, placement.y ] }, placedTiles) .sort(function (a, b) { return (a[0] - b[0]) || (a[1] - b[1])}); if (filter(partial(operator.ne, positions[0][0]), map(function (position) { return position[0] }, positions)).length @@ -133,6 +133,13 @@ nextTurn.style.textAlign = 'left'; setElementPosition(nextTurn, { x: border + 680, y: border + 665 }); appendChildNodes($('playfield'), nextTurn); + + var nextTurn = DIV({ id: 'status' }, ""); + nextTurn.style.position = 'absolute'; + nextTurn.style.width = '280px'; + nextTurn.style.textAlign = 'left'; + setElementPosition(nextTurn, { x: border + 680, y: border + 680 }); + appendChildNodes($('playfield'), nextTurn); } function setLetter(x, y, letter, isBlank) { @@ -147,22 +154,11 @@ } function placeLetter(x, y, tile) { - var mask = IMG({ src: 'images/mask.png'}); - mask.style.position = 'absolute'; - mask.style.top = '3px'; - mask.style.left = '3px'; - mask.style.zIndex = '20'; - appendChildNodes(board[x][y], mask); - board[x][y].letterNode = tile; - board[x][y].letter = tile.letter; - board[x][y].justPlaced = true; - tile.anim = new YAHOO.util.Motion(tile, { points: { to: [ border + x * 44 + 3, - border + y * 44 + 3 ]}}, - 0.15, - YAHOO.util.Easing.easeBoth); - tile.anim.animate(); } +function removeLastLetterFromMove() { +} + function letterAt(x, y) { return board[x][y].letter && !board[x][y].justPlaced; } @@ -239,28 +235,74 @@ var move = []; -function makeMove(x, y, letter, isBlank) { - move[move.length] = [x, y, letter, isBlank]; +function makeMask() +{ + var mask = IMG({ src: 'images/mask.png'}); + mask.style.position = 'absolute'; + mask.style.top = '3px'; + mask.style.left = '3px'; + mask.style.zIndex = '20'; + return mask; +} + +function addLetterToMove(x, y, tile) { + mask = makeMask(); + appendChildNodes(board[x][y], mask); + board[x][y].letterNode = tile; + board[x][y].letter = tile.letter; + board[x][y].justPlaced = true; + tile.mask = mask; + tile.anim = new YAHOO.util.Motion(tile, { points: { to: [ border + x * 44 + 3, + border + y * 44 + 3 ]}}, + 0.15, + YAHOO.util.Easing.easeBoth); + tile.anim.animate(); + + move[move.length] = { x: x, y: y, tile: tile }; try { checkMoveLegality(move); $('move').onclick = submitMove; - $('move').innerHTML = move.toString(); + $('move').innerHTML = "submit move"; + displayStatus(''); } catch (e) { + if (typeof e != 'string') { + alert(e.message); + } else { + displayStatus(e); + } $('move').onclick = undefined; $('move').innerHTML = e.toString(); } } -function clearMove() { +function confirmMove() { + for (var i = 0; i < move.length; i++) { + removeElement(move[i].tile.mask); + move[i].tile.mask = undefined; + } + cursor.clear(); move = []; $('move').onclick = null; - $('move').innerHTML = '[no move]'; + $('move').innerHTML = ''; + } +function moveAsString() { + // We internally keep the move as array of objects, but send it to the server rather unstructured: + var serverMessage = []; + for (var i = 0; i < move.length; i++) { + serverMessage.push(move[i].x); + serverMessage.push(move[i].y); + serverMessage.push(move[i].tile.letterName); + serverMessage.push(move[i].tile.letterName == undefined); + } + return serverMessage.toString(); +} + function submitMove() { - var queryString = MochiKit.Base.queryString({ move: move.toString(), game: gameID }); + var queryString = MochiKit.Base.queryString({ move: moveAsString(), game: gameID }); var res = MochiKit.Async.doXHR("/place-tiles", { method: 'POST', sendContent: queryString, @@ -270,20 +312,27 @@ function moveSuccess(result) { - var response; try { - response = eval('(' + result.responseText + ')'); + var response; + try { + response = eval('(' + result.responseText + ')'); + } + catch (e) { + alert("invalid JSON reply: " + result.responseText); + return; + } + if (response.error) { + alert(response.error); + } else { + confirmMove(); + alert(response.move.playerScore); + $('playfield')['score-' + response.move.participantLogin].innerHTML = response.move.playerScore.toString(); + displayMyTray(response.tray); + } } catch (e) { - alert("invalid JSON reply: " + result.responseText); - return; + alert('error during moveSuccess: ' + e.message); } - if (response.error) { - alert(response.error); - } else { - clearMove(); - makeMyTray(response.tray); - } } function moveFailure(e) @@ -315,18 +364,17 @@ } } if (tilePosition == -1) { - alert("You don't have letter + '" + letter + "'!"); + displayStatus('you-dont-have-that-letter', letter); } else { var isHoriz; if (move.length > 0) { - isHoriz = (move[0][0] != x); + isHoriz = (move[0].x != x); } cursor.advance(isHoriz); if (!letterAt(x, y)) { var tile = tray[tilePosition]; tray.splice(tilePosition, 1); - placeLetter(x, y, tile); - makeMove(x, y, tile.letterName, tile.letterName == undefined); + addLetterToMove(x, y, tile); } } } @@ -362,6 +410,10 @@ if (!letterAt(x, ++y)) break; break; + case backspaceKey: + if (move.length) { + removeLastLetterFromMove(); + } } if ((x >= 0) && (x <= 14) && (y >= 0) && (y <= 14)) { cursor.clear(); @@ -391,7 +443,7 @@ this.anim.animate(); } -function makeMyTray(letters) { +function displayMyTray(letters) { map(removeElement, tray); tray = []; for (var i = 0; i < letters.length; i++) { @@ -403,7 +455,7 @@ element.style.height = '34px'; element.style.zIndex = '10'; element.onclick = trayClick; - setElementPosition(element, { x: border + 194 + i * 40, y: border + 665 }); + setElementPosition(element, { x: border + i * 40, y: border + 665 }); tray[i] = element; } appendChildNodes($('playfield'), tray); @@ -428,7 +480,9 @@ var otherPlayerIndex = 0; -function makeTheirTray (name, tileCount) { +function makeTheirTray (participant) { + var tileCount = (typeof participant.remainingTiles == 'number') ? participant.remainingTiles : participant.remainingTiles.length; + var tray = []; for (var i = 0; i < tileCount; i++) { var element = IMG({src: 'images/null.png'}); @@ -441,12 +495,21 @@ } appendChildNodes($('playfield'), tray); - var nameTag = DIV(null, name); + var nameTag = DIV(null, participant.name); nameTag.style.position = 'absolute'; nameTag.style.width = '200px'; nameTag.style.textAlign = 'left'; setElementPosition(nameTag, { x: border + 680, y: border + 80 * otherPlayerIndex + 50 }); appendChildNodes($('playfield'), nameTag); + + var scoreTag = DIV(null, participant.score); + scoreTag.style.position = 'absolute'; + scoreTag.style.width = '80px'; + scoreTag.style.textAlign = 'right'; + setElementPosition(scoreTag, { x: border + 870, y: border + 80 * otherPlayerIndex + 50 }); + appendChildNodes($('playfield'), scoreTag); + $('playfield')['score-' + participant.login] = scoreTag; + otherPlayerIndex++; } @@ -465,32 +528,41 @@ return retval; } +function displayWhosTurnItIs(name) { + replaceChildNodes($('nextTurn'), + "Next: " + name); +} + function drawGameState (gameState) { - for (var i = 0; i < gameState.board.length; i++) { - var x = gameState.board[i][0]; - var y = gameState.board[i][1]; - var char = gameState.board[i][2]; - setLetter(x, y, char, gameState.board[i].length > 3); - } - var firstParticipant = gameState.participants[0]; - replaceChildNodes($('nextTurn'), - "It is " - + ((typeof firstParticipant.remainingTiles == 'number') ? (firstParticipant.name + "s") : "your") - + " turn"); - for (var i = 0; i < gameState.participants.length; i++) { - var participant = gameState.participants[i]; - if (typeof participant.remainingTiles == 'number') { - makeTheirTray(participant.name, participant.remainingTiles); - } else { - makeMyTray(participant.remainingTiles); + try { + for (var i = 0; i < gameState.board.length; i++) { + var x = gameState.board[i][0]; + var y = gameState.board[i][1]; + var char = gameState.board[i][2]; + setLetter(x, y, char, gameState.board[i].length > 3); } + var firstParticipant = gameState.participants[0]; + displayWhosTurnItIs(firstParticipant.name); + for (var i = 0; i < gameState.participants.length; i++) { + var participant = gameState.participants[i]; + makeTheirTray(participant); + if (typeof participant.remainingTiles != 'number') { + displayMyTray(participant.remainingTiles); + } + } + for (var i = 0; i < gameState.moves.length; i++) { + appendChildNodes($('gameLog'), DIV(null, renderMoveAsText(gameState.moves[i]))); + } } - for (var i = 0; i < gameState.moves.length; i++) { - appendChildNodes($('gameLog'), DIV(null, renderMoveAsText(gameState.moves[i]))); + catch (e) { + alert('error ' + e + ' in drawGameState'); } } -var legalLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); +function displayStatus(status) +{ + replaceChildNodes('status', status); +} function init() { makeBoard(); @@ -503,7 +575,7 @@ { fn: functionKeyPressed, scope: this, correctScope: true }); functionKeyListener.enable(); - var moveDisplay = DIV({ id: 'move' }, "[no move yet]"); + var moveDisplay = DIV({ id: 'move' }, ""); moveDisplay.style.color = 'white'; moveDisplay.style.position = 'absolute'; setElementPosition(moveDisplay, { x: border + 550, y: border + 665 });