From mbaringer at common-lisp.net Mon Oct 2 15:29:02 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 2 Oct 2006 11:29:02 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061002152902.8289F50015@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv23989 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/09/27 22:53:45 1.960 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/02 15:29:02 1.961 @@ -1,3 +1,9 @@ +2006-10-02 Marco Baringer + + * slime.el (slime-highlight-compiler-notes): New variable. + (slime-compilation-finished): Only highlight notes when + slime-highlight-compiler-notes is non-NIL. + 2006-09-28 Marco Baringer * swank-loader.lisp (compile-files-if-needed-serially): Don't From mbaringer at common-lisp.net Mon Oct 2 15:29:19 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 2 Oct 2006 11:29:19 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061002152919.A91EC5B05C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv24074 Modified Files: slime.el Log Message: (slime-highlight-compiler-notes): New variable. (slime-compilation-finished): Only highlight notes when slime-highlight-compiler-notes is non-NIL. --- /project/slime/cvsroot/slime/slime.el 2006/09/21 17:44:34 1.657 +++ /project/slime/cvsroot/slime/slime.el 2006/10/02 15:29:18 1.658 @@ -70,6 +70,9 @@ (defvar slime-use-highlight-edits-mode nil "When non-nil always enable slime-highlight-edits-mode in slime-mode") +(defvar slime-highlight-compiler-notes t + "When non-nil highlight buffers with compilation notes, warnings and errors.") + (defun* slime-setup (&key autodoc typeout-frame highlight-edits) "Setup Emacs so that lisp-mode buffers always use SLIME." (when (member 'lisp-mode slime-lisp-modes) @@ -4551,7 +4554,8 @@ (setf slime-compilation-just-finished t) (multiple-value-bind (result secs) result (slime-show-note-counts notes secs) - (slime-highlight-notes notes))) + (when slime-highlight-compiler-notes + (slime-highlight-notes notes)))) (run-hook-with-args 'slime-compilation-finished-hook notes))) (defun slime-compilation-finished-continuation () From mbaringer at common-lisp.net Tue Oct 3 21:49:13 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Tue, 3 Oct 2006 17:49:13 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061003214913.2C25E3000C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv29740 Modified Files: README Log Message: Update license statement. --- /project/slime/cvsroot/slime/README 2005/07/03 15:51:54 1.13 +++ /project/slime/cvsroot/slime/README 2006/10/03 21:49:13 1.14 @@ -27,10 +27,8 @@ Licence. ---------------------------------------- - SLIME is free software. The source files are licensed separately for - maximum compatibility with their host environment, for example - slime.el is GPL and swank-cmucl.lisp is public domain. See the - source files for more details. + SLIME is free software. All files, unless explicitly stated + otherwise, are public domain. Contact. ---------------------------------------- From mbaringer at common-lisp.net Tue Oct 3 21:49:29 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Tue, 3 Oct 2006 17:49:29 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061003214929.5A70934001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv29781 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/02 15:29:02 1.961 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/03 21:49:29 1.962 @@ -1,3 +1,11 @@ +2006-10-03 Marco Baringer + + Change license statement to say that all files without an explicit + copyright notice are public domain. This change will allow SLIME + to moved out of debian's nonfree tree. + + * README: Update license statement. + 2006-10-02 Marco Baringer * slime.el (slime-highlight-compiler-notes): New variable. From mkoeppe at common-lisp.net Sun Oct 8 12:47:50 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 8 Oct 2006 08:47:50 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061008124750.D158F2F00A@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11282 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/03 21:49:29 1.962 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/08 12:47:50 1.963 @@ -1,3 +1,8 @@ +2006-10-08 Matthias Koeppe + + * swank-loader.lisp (lisp-version-string) [allegro]: Distinguish + between 32-bit and 64-bit version on the SPARC architecture. + 2006-10-03 Marco Baringer Change license statement to say that all files without an explicit From mkoeppe at common-lisp.net Sun Oct 8 12:48:12 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 8 Oct 2006 08:48:12 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061008124812.60C1E2F025@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11333 Modified Files: swank-loader.lisp Log Message: (lisp-version-string) [allegro]: Distinguish between 32-bit and 64-bit version on the SPARC architecture. --- /project/slime/cvsroot/slime/swank-loader.lisp 2006/09/27 22:52:26 1.60 +++ /project/slime/cvsroot/slime/swank-loader.lisp 2006/10/08 12:48:12 1.61 @@ -70,8 +70,11 @@ ccl::*openmcl-major-version* ccl::*openmcl-minor-version*) #+lispworks (lisp-implementation-version) - #+allegro (concatenate 'string (if (eq 'h 'H) "A" "M") ; ANSI vs MoDeRn - excl::*common-lisp-version-number*) + #+allegro (format nil + "~A~A~A" + excl::*common-lisp-version-number* + (if (eq 'h 'H) "A" "M") ; ANSI vs MoDeRn + (if (member :64bit *features*) "-64bit" "")) #+clisp (let ((s (lisp-implementation-version))) (subseq s 0 (position #\space s))) #+armedbear (lisp-implementation-version) From mkoeppe at common-lisp.net Mon Oct 9 13:22:24 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Mon, 9 Oct 2006 09:22:24 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061009132224.6B76246127@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12593 Modified Files: swank.lisp Log Message: (completions-for-keyword): Look up the operator names in the right package. Return nil (rather than signalling an error) when no valid operator name is present. --- /project/slime/cvsroot/slime/swank.lisp 2006/09/27 10:42:07 1.403 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/09 13:22:24 1.404 @@ -2238,38 +2238,39 @@ (apply #'arglist-ref arg nil (rest indices)))))))) (defslimefun completions-for-keyword (names keyword-string arg-indices) - (multiple-value-bind (name index) - (find-valid-operator-name names) - (with-buffer-syntax () - (let* ((form (operator-designator-to-form name)) - (operator-form (first form)) - (argument-forms (rest form)) - (arglist - (form-completion operator-form argument-forms - :remove-args nil))) - (unless (eql arglist :not-available) - (let* ((indices (butlast (reverse (last arg-indices (1+ index))))) - (arglist (apply #'arglist-ref arglist operator-form indices))) - (when (and arglist (arglist-p arglist)) - ;; It would be possible to complete keywords only if we - ;; are in a keyword position, but it is not clear if we - ;; want that. - (let* ((keywords - (mapcar #'keyword-arg.keyword - (arglist.keyword-args arglist))) - (keyword-name - (tokenize-symbol keyword-string)) - (matching-keywords - (find-matching-symbols-in-list keyword-name keywords - #'compound-prefix-match)) - (converter (output-case-converter keyword-string)) - (strings - (mapcar converter - (mapcar #'symbol-name matching-keywords))) - (completion-set - (format-completion-set strings nil ""))) - (list completion-set - (longest-completion completion-set)))))))))) + (with-buffer-syntax () + (multiple-value-bind (name index) + (find-valid-operator-name names) + (when name + (let* ((form (operator-designator-to-form name)) + (operator-form (first form)) + (argument-forms (rest form)) + (arglist + (form-completion operator-form argument-forms + :remove-args nil))) + (unless (eql arglist :not-available) + (let* ((indices (butlast (reverse (last arg-indices (1+ index))))) + (arglist (apply #'arglist-ref arglist operator-form indices))) + (when (and arglist (arglist-p arglist)) + ;; It would be possible to complete keywords only if we + ;; are in a keyword position, but it is not clear if we + ;; want that. + (let* ((keywords + (mapcar #'keyword-arg.keyword + (arglist.keyword-args arglist))) + (keyword-name + (tokenize-symbol keyword-string)) + (matching-keywords + (find-matching-symbols-in-list keyword-name keywords + #'compound-prefix-match)) + (converter (output-case-converter keyword-string)) + (strings + (mapcar converter + (mapcar #'symbol-name matching-keywords))) + (completion-set + (format-completion-set strings nil ""))) + (list completion-set + (longest-completion completion-set))))))))))) (defun arglist-to-string (arglist package &key print-right-margin highlight) From mkoeppe at common-lisp.net Mon Oct 9 13:22:36 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Mon, 9 Oct 2006 09:22:36 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061009132236.1907649031@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12638 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/08 12:47:50 1.963 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/09 13:22:35 1.964 @@ -1,3 +1,9 @@ +2006-10-09 Matthias Koeppe + + * swank.lisp (completions-for-keyword): Look up the operator names + in the right package. Return nil (rather than signalling an + error) when no valid operator name is present. + 2006-10-08 Matthias Koeppe * swank-loader.lisp (lisp-version-string) [allegro]: Distinguish From mkoeppe at common-lisp.net Wed Oct 11 11:59:56 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Wed, 11 Oct 2006 07:59:56 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061011115956.8E6E06C00D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv21104 Modified Files: slime.el Log Message: (slime-presentation-syntax-table): New. (slime-add-presentation-properties): Install it in a syntax-table text property, so that #<...> is balanced in a presentation. (slime-remove-presentation-properties): Remove the text property. (slime-repl-mode): Respect the syntax text properties of presentations in REPL buffers. --- /project/slime/cvsroot/slime/slime.el 2006/10/02 15:29:18 1.658 +++ /project/slime/cvsroot/slime/slime.el 2006/10/11 11:59:56 1.659 @@ -2830,6 +2830,18 @@ (defstruct slime-presentation text id) +(defvar slime-presentation-syntax-table + (let ((table (copy-syntax-table lisp-mode-syntax-table))) + ;; We give < and > parenthesis syntax, so that #< ... > is treated + ;; as a balanced expression. This allows to use C-M-k, C-M-SPC, + ;; etc. to deal with a whole presentation. (For Lisp mode, this + ;; is not desirable, since we do not wish to get a mismatched + ;; paren highlighted everytime we type < or >.) + (modify-syntax-entry ?< "(>" table) + (modify-syntax-entry ?> ")<" table) + table) + "Syntax table for presentations.") + (defun slime-add-presentation-properties (start end id result-p) "Make the text between START and END a presentation with ID. RESULT-P decides whether a face for a return value or output text is used." @@ -2840,6 +2852,7 @@ `(modification-hooks (slime-after-change-function) insert-in-front-hooks (slime-after-change-function) insert-behind-hooks (slime-after-change-function) + syntax-table ,slime-presentation-syntax-table rear-nonsticky t)) ;; Use the presentation as the key of a text property (case (- end start) @@ -2882,7 +2895,7 @@ (defun slime-remove-presentation-properties (from to presentation) (let ((inhibit-read-only t)) (remove-text-properties from to - `(,presentation t rear-nonsticky t)) + `(,presentation t syntax-table t rear-nonsticky t)) (when (eq (get-text-property from 'slime-repl-presentation) presentation) (remove-text-properties from (1+ from) `(slime-repl-presentation t))) (when (eq (get-text-property (1- to) 'slime-repl-presentation) presentation) @@ -3076,6 +3089,9 @@ (slime-setup-command-hooks) (when slime-use-autodoc-mode (slime-autodoc-mode 1)) + (when slime-repl-enable-presentations + ;; Respect the syntax text properties of presentations. + (set (make-local-variable 'parse-sexp-lookup-properties) t)) (run-hooks 'slime-repl-mode-hook)) (defun slime-presentation-whole-p (presentation start end &optional object) From mkoeppe at common-lisp.net Wed Oct 11 12:00:09 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Wed, 11 Oct 2006 08:00:09 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061011120009.778B622013@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv21352 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/09 13:22:35 1.964 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/11 12:00:04 1.965 @@ -1,3 +1,12 @@ +2006-10-11 Matthias Koeppe + + * slime.el (slime-presentation-syntax-table): New. + (slime-add-presentation-properties): Install it in a syntax-table + text property, so that #<...> is balanced in a presentation. + (slime-remove-presentation-properties): Remove the text property. + (slime-repl-mode): Respect the syntax text properties of + presentations in REPL buffers. + 2006-10-09 Matthias Koeppe * swank.lisp (completions-for-keyword): Look up the operator names From heller at common-lisp.net Mon Oct 16 13:14:19 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 09:14:19 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016131419.4B3E44612B@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17873 Modified Files: slime.el Log Message: (sldb-activate): Get debug-info from the correct thread. Fixes bug reported by Dan Weinreb . --- /project/slime/cvsroot/slime/slime.el 2006/10/11 11:59:56 1.659 +++ /project/slime/cvsroot/slime/slime.el 2006/10/16 13:14:19 1.660 @@ -7908,10 +7908,11 @@ (defun sldb-activate (thread level) (unless (let ((b (sldb-find-buffer thread))) (and b (with-current-buffer b (equal sldb-level level)))) - (with-lexical-bindings (thread level) - (slime-eval-async `(swank:debugger-info-for-emacs 0 10) - (lambda (result) - (apply #'sldb-setup thread level result)))))) + (slime-rex (thread level) + ('(swank:debugger-info-for-emacs 0 10) + nil thread) + ((:ok result) + (apply #'sldb-setup thread level result))))) (defun sldb-exit (thread level &optional stepping) (when-let (sldb (sldb-find-buffer thread)) From heller at common-lisp.net Mon Oct 16 13:14:35 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 09:14:35 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016131435.B198648145@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17916 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/11 12:00:04 1.965 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/16 13:14:35 1.966 @@ -1,3 +1,8 @@ +2006-10-16 Helmut Eller + + * slime.el (sldb-activate): Get debug-info from the correct + thread. Fixes bug reported by Dan Weinreb . + 2006-10-11 Matthias Koeppe * slime.el (slime-presentation-syntax-table): New. From heller at common-lisp.net Mon Oct 16 13:54:54 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 09:54:54 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016135454.774AC59081@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv22809 Modified Files: slime.el Log Message: (unwind-to-previous-sldb-level): New test. --- /project/slime/cvsroot/slime/slime.el 2006/10/16 13:14:19 1.660 +++ /project/slime/cvsroot/slime/slime.el 2006/10/16 13:54:54 1.661 @@ -9919,6 +9919,40 @@ debug-hook-max-depth depth) (= debug-hook-max-depth depth)))))) +(def-slime-test unwind-to-previous-sldb-level (level2 level1) + "Test recursive debugging and returning to lower SLDB levels." + '((2 1) (4 2)) + (slime-check-top-level) + (lexical-let ((level2 level2) + (level1 level1) + (state 'enter) + (max-depth 0)) + (let ((debug-hook + (lambda () + (with-current-buffer (sldb-get-default-buffer) + (setq max-depth (max sldb-level max-depth)) + (ecase state + (enter + (cond ((= sldb-level level2) + (setq state 'leave) + (sldb-invoke-restart 0)) + (t + (slime-eval-async `(cl:aref cl:nil ,sldb-level))))) + (leave + (cond ((= sldb-level level1) + (setq state 'ok) + (sldb-quit)) + (t + (sldb-invoke-restart 0))))))))) + (let ((sldb-hook (cons debug-hook sldb-hook))) + (slime-eval-async `(cl:aref cl:nil 0)) + (slime-sync-to-top-level 5) + (slime-check-top-level) + (slime-check ("Maximum depth reached (%S) is %S." max-depth level2) + (= max-depth level2)) + (slime-check ("Final state reached.") + (eq state 'ok)))))) + (def-slime-test loop-interrupt-quit () "Test interrupting a loop." From heller at common-lisp.net Mon Oct 16 13:57:17 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 09:57:17 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016135717.E3C625B05E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv23011 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/16 13:14:35 1.966 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/16 13:57:17 1.967 @@ -2,6 +2,7 @@ * slime.el (sldb-activate): Get debug-info from the correct thread. Fixes bug reported by Dan Weinreb . + (unwind-to-previous-sldb-level): New test. 2006-10-11 Matthias Koeppe From heller at common-lisp.net Mon Oct 16 19:57:41 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 15:57:41 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016195741.CC9877D001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5664 Modified Files: slime.el Log Message: (slime-init-command): Send a single form. --- /project/slime/cvsroot/slime/slime.el 2006/10/16 13:54:54 1.661 +++ /project/slime/cvsroot/slime/slime.el 2006/10/16 19:57:41 1.662 @@ -1617,9 +1617,13 @@ slime-backend (concat slime-path slime-backend))) (encoding (slime-coding-system-cl-name coding-system))) - (format "%S\n%S\n\n" - `(load ,loader :verbose t) - `(swank:start-server ,port-filename :external-format ,encoding)))) + ;; Return a single form to avoid problems with buffered input. + (format "%S\n\n" + `(progn + (load ,loader :verbose t) + (funcall (read-from-string "swank:start-server") + ,port-filename + :external-format ,encoding))))) (defun slime-swank-port-file () "Filename where the SWANK server writes its TCP port number." From heller at common-lisp.net Mon Oct 16 19:58:46 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 15:58:46 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016195846.077DE48143@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5779 Modified Files: swank.lisp Log Message: Clean up global IO redirection. (setup-stream-indirection): Turn macro into a function and delay initialization after user init files are loaded, so that we do nothing if *globally-redirect-io* is nil. (*after-init-hook*, run-after-init-hook, init-global-stream-redirection): New. (parse-symbol-or-lose): Lose loudly and early (instead of failing silently). --- /project/slime/cvsroot/slime/swank.lisp 2006/10/09 13:22:24 1.404 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/16 19:58:45 1.405 @@ -21,6 +21,7 @@ #:ed-in-emacs #:print-indentation-lossage #:swank-debugger-hook + #:run-after-init-hook ;; These are user-configurable variables: #:*communication-style* #:*log-events* @@ -129,7 +130,6 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (export ',name :swank)))) -(declaim (ftype (function () nil) missing-arg)) (defun missing-arg () "A function that the compiler knows will never to return a value. You can use (MISSING-ARG) as the initform for defstruct slots that @@ -166,6 +166,12 @@ (defvar *pre-reply-hook* '() "Hook run (without arguments) immediately before replying to an RPC.") +(defvar *after-init-hook* '() + "Hook run after user init files are loaded.") + +(defun run-after-init-hook () + (run-hook *after-init-hook*)) + ;;;; Connections ;;; @@ -922,15 +928,21 @@ ;;; variables, so they can always be assigned to affect a global ;;; change. -(defvar *globally-redirect-io* t +(defvar *globally-redirect-io* nil "When non-nil globally redirect all standard streams to Emacs.") -(defmacro setup-stream-indirection (stream-var) +;;;;; Global redirection setup + +(defvar *saved-global-streams* '() + "A plist to save and restore redirected stream objects. +E.g. the value for '*standard-output* holds the stream object +for *standard-output* before we install our redirection.") + +(defun setup-stream-indirection (stream-var &optional stream) "Setup redirection scaffolding for a global stream variable. Supposing (for example) STREAM-VAR is *STANDARD-INPUT*, this macro: -1. Saves the value of *STANDARD-INPUT* in a variable called -*REAL-STANDARD-INPUT*. +1. Saves the value of *STANDARD-INPUT* in `*SAVED-GLOBAL-STREAMS*'. 2. Creates *CURRENT-STANDARD-INPUT*, initially with the same value as *STANDARD-INPUT*. @@ -942,49 +954,43 @@ effective global value for *STANDARD-INPUT*. This way we can assign the effective global value even when *STANDARD-INPUT* is shadowed by a dynamic binding." - (let ((real-stream-var (prefixed-var '#:real stream-var)) - (current-stream-var (prefixed-var '#:current stream-var))) - `(progn - ;; Save the real stream value for the future. - (defvar ,real-stream-var ,stream-var) - ;; Define a new variable for the effective stream. - ;; This can be reassigned. - (defvar ,current-stream-var ,stream-var) - ;; Assign the real binding as a synonym for the current one. - (setq ,stream-var (make-synonym-stream ',current-stream-var))))) - -(eval-when (:compile-toplevel :load-toplevel :execute) - (defun prefixed-var (prefix variable-symbol) - "(PREFIXED-VAR \"FOO\" '*BAR*) => SWANK::*FOO-BAR*" - (let ((basename (subseq (symbol-name variable-symbol) 1))) - (intern (format nil "*~A-~A" prefix basename) :swank)))) + (let ((current-stream-var (prefixed-var '#:current stream-var)) + (stream (or stream (symbol-value stream-var)))) + ;; Save the real stream value for the future. + (setf (getf *saved-global-streams* stream-var) stream) + ;; Define a new variable for the effective stream. + ;; This can be reassigned. + (proclaim `(special ,current-stream-var)) + (set current-stream-var stream) + ;; Assign the real binding as a synonym for the current one. + (set stream-var (make-synonym-stream current-stream-var)))) + +(defun prefixed-var (prefix variable-symbol) + "(PREFIXED-VAR \"FOO\" '*BAR*) => SWANK::*FOO-BAR*" + (let ((basename (subseq (symbol-name variable-symbol) 1))) + (intern (format nil "*~A-~A" (string prefix) basename) :swank))) -;;;;; Global redirection setup - -;; FIXME: This doesn't work with Allegros IDE (MAKE-SYNONYM-STREAM -;; doesn't work with their GUI-streams). Maybe we should just drop this -;; global redirection stuff. -;; -;; (setup-stream-indirection *standard-output*) -;; (setup-stream-indirection *error-output*) -;; (setup-stream-indirection *trace-output*) -;; (setup-stream-indirection *standard-input*) -;; (setup-stream-indirection *debug-io*) -;; (setup-stream-indirection *query-io*) -;; (setup-stream-indirection *terminal-io*) - -(defparameter *standard-output-streams* +(defvar *standard-output-streams* '(*standard-output* *error-output* *trace-output*) "The symbols naming standard output streams.") -(defparameter *standard-input-streams* +(defvar *standard-input-streams* '(*standard-input*) "The symbols naming standard input streams.") -(defparameter *standard-io-streams* +(defvar *standard-io-streams* '(*debug-io* *query-io* *terminal-io*) "The symbols naming standard io streams.") +(defun init-global-stream-redirection () + (when *globally-redirect-io* + (mapc #'setup-stream-indirection + (append *standard-output-streams* + *standard-input-streams* + *standard-io-streams*)))) + +(add-hook *after-init-hook* 'init-global-stream-redirection) + (defun globally-redirect-io-to-connection (connection) "Set the standard I/O streams to redirect to CONNECTION. Assigns *CURRENT-* for all standard streams." @@ -1014,7 +1020,7 @@ *standard-input-streams* *standard-io-streams*)) (set (prefixed-var '#:current stream-var) - (symbol-value (prefixed-var '#:real stream-var))))) + (getf *saved-global-streams* stream-var)))) ;;;;; Global redirection hooks @@ -1349,7 +1355,7 @@ (multiple-value-bind (symbol status) (parse-symbol string package) (if status (values symbol status) - (abort-request "Unknown symbol: ~A [in ~A]" string package)))) + (error "Unknown symbol: ~A [in ~A]" string package)))) ;; FIXME: interns the name (defun parse-package (string) @@ -3035,7 +3041,6 @@ (*print-length* . nil))) (defun apply-macro-expander (expander string) - (declare (type function expander)) (with-buffer-syntax () (with-bindings *macroexpand-printer-bindings* (prin1-to-string (funcall expander (from-string string)))))) @@ -3709,7 +3714,6 @@ "Like (mapcar FN . LISTS) but only call FN on objects satisfying TEST. Example: \(map-if #'oddp #'- '(1 2 3 4 5)) => (-1 2 -3 4 -5)" - (declare (type function test fn)) (apply #'mapcar (lambda (x) (if (funcall test x) (funcall fn x) x)) lists)) @@ -3717,7 +3721,6 @@ (defun listify (f) "Return a function like F, but which returns any non-null value wrapped in a list." - (declare (type function f)) (lambda (x) (let ((y (funcall f x))) (and y (list y))))) From heller at common-lisp.net Mon Oct 16 19:59:33 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 15:59:33 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016195933.7328A53001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5856 Modified Files: swank-loader.lisp Log Message: Abort on compile-time or load-time errors. Don't try to load the source-file if COMPILE-FILE's 3rd return value is true (it's true even for warnings). (handle-loadtime-error): New function. Run the after-init-hook. --- /project/slime/cvsroot/slime/swank-loader.lisp 2006/10/08 12:48:12 1.61 +++ /project/slime/cvsroot/slime/swank-loader.lisp 2006/10/16 19:59:33 1.62 @@ -21,19 +21,19 @@ (cl:defpackage :swank-loader (:use :cl) - (:export :load-swank + (:export :load-swank :*source-directory* :*fasl-directory*)) (cl:in-package :swank-loader) -(defvar *source-directory* - (make-pathname :name nil :type nil +(defvar *source-directory* + (make-pathname :name nil :type nil :defaults (or *load-pathname* *default-pathname-defaults*)) "The directory where to look for the source.") (defparameter *sysdep-files* - (append + (append '("nregex") #+cmu '("swank-source-path-parser" "swank-source-file-cache" "swank-cmucl") #+scl '("swank-source-path-parser" "swank-source-file-cache" "swank-scl") @@ -49,7 +49,7 @@ )) (defparameter *implementation-features* - '(:allegro :lispworks :sbcl :openmcl :cmu :clisp :ccl :corman :cormanlisp + '(:allegro :lispworks :sbcl :openmcl :cmu :clisp :ccl :corman :cormanlisp :armedbear :gcl :ecl :scl)) (defparameter *os-features* @@ -67,7 +67,7 @@ #+sbcl (lisp-implementation-version) #+ecl (lisp-implementation-version) #+openmcl (format nil "~d.~d" - ccl::*openmcl-major-version* + ccl::*openmcl-major-version* ccl::*openmcl-minor-version*) #+lispworks (lisp-implementation-version) #+allegro (format nil @@ -79,7 +79,7 @@ (subseq s 0 (position #\space s))) #+armedbear (lisp-implementation-version) #+cormanlisp (lisp-implementation-version)) - + (defun unique-directory-name () "Return a name that can be used as a directory name that is unique to a Lisp implementation, Lisp implementation version, @@ -92,7 +92,7 @@ (t (apply #'warn fstring args) "unknown")))) (let ((lisp (maybe-warn (first-of *implementation-features*) - "No implementation feature found in ~a." + "No implementation feature found in ~a." *implementation-features*)) (os (maybe-warn (first-of *os-features*) "No os feature found in ~a." *os-features*)) @@ -123,8 +123,8 @@ (defun default-fasl-directory () (merge-pathnames - (make-pathname - :directory `(:relative ".slime" "fasl" + (make-pathname + :directory `(:relative ".slime" "fasl" ,@(if (slime-version-string) (list (slime-version-string))) ,(unique-directory-name))) (user-homedir-pathname))) @@ -136,35 +136,41 @@ :type (pathname-type cfp)) binary-directory))) + +(defun handle-loadtime-error (condition binary-pathname) + (format *error-output* + "~%~<;; ~@;Error while loading: ~A~% Condition: ~A~%Aborting.~:>~%" + (list binary-pathname condition)) + (when (equal (directory-namestring binary-pathname) + (directory-namestring (default-fasl-directory))) + (ignore-errors (delete-file binary-pathname))) + (abort)) + (defun compile-files-if-needed-serially (files fasl-directory) "Compile each file in FILES if the source is newer than -its corresponding binary, or the file preceding it was +its corresponding binary, or the file preceding it was recompiled." (with-compilation-unit () (let ((needs-recompile nil)) (dolist (source-pathname files) (let ((binary-pathname (binary-pathname source-pathname fasl-directory))) - (when (or needs-recompile - (not (probe-file binary-pathname)) - (file-newer-p source-pathname binary-pathname)) - ;; need a to recompile source-pathname, so we'll - ;; nede to recompile everything after this too. - (setq needs-recompile t) - (ensure-directories-exist binary-pathname) - (multiple-value-bind (output-file warningsp failurep) - (compile-file source-pathname :output-file binary-pathname - :print nil - :verbose t) - (declare (ignore output-file warningsp)) - (when failurep - ;; If an error occurs compiling, load the source - ;; instead so we can try to debug it (this next - ;; call should, unless things are really broken, - ;; signal an error). - (format *error-output* ";; ERROR wihle compiling ~S." source-pathname) - (load source-pathname)))) - (load binary-pathname :verbose t)))))) + (handler-case + (progn + (when (or needs-recompile + (not (probe-file binary-pathname)) + (file-newer-p source-pathname binary-pathname)) + ;; need a to recompile source-pathname, so we'll + ;; need to recompile everything after this too. + (setq needs-recompile t) + (ensure-directories-exist binary-pathname) + (compile-file source-pathname :output-file binary-pathname + :print nil + :verbose t)) + (load binary-pathname :verbose t)) + ;; Fail as early as possible + (serious-condition (c) + (handle-loadtime-error c binary-pathname)))))))) #+(or cormanlisp ecl) (defun compile-files-if-needed-serially (files fasl-directory) @@ -194,13 +200,14 @@ (defvar *fasl-directory* (default-fasl-directory) "The directory where fasl files should be placed.") -(defun load-swank (&key +(defun load-swank (&key (source-directory *source-directory*) (fasl-directory *fasl-directory*)) - (compile-files-if-needed-serially (swank-source-files source-directory) + (compile-files-if-needed-serially (swank-source-files source-directory) fasl-directory) (funcall (intern (string :warn-unimplemented-interfaces) :swank-backend)) (load-site-init-file source-directory) - (load-user-init-file)) + (load-user-init-file) + (funcall (intern (string :run-after-init-hook) :swank))) -(load-swank) \ No newline at end of file +(load-swank) From heller at common-lisp.net Mon Oct 16 20:01:57 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 16:01:57 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016200157.651995538E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv7347 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/16 13:57:17 1.967 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/16 20:01:57 1.968 @@ -3,6 +3,24 @@ * slime.el (sldb-activate): Get debug-info from the correct thread. Fixes bug reported by Dan Weinreb . (unwind-to-previous-sldb-level): New test. + (slime-init-command): Send a single form. + + * swank.lisp: Clean up global IO redirection. + (setup-stream-indirection): Turn macro into a + function and delay initialization after user init files are + loaded, so that we do nothing if *globally-redirect-io* is nil. + (*after-init-hook*, run-after-init-hook) + (init-global-stream-redirection): New. + + (parse-symbol-or-lose): Lose loudly and early (instead of failing + silently). + + * swank-loader.lisp: Abort on compile-time or load-time errors. + Don't try to load the source-file if COMPILE-FILE's 3rd return + value is true (it's true even for warnings). + (handle-loadtime-error): New function. + + Run the after-init-hook. 2006-10-11 Matthias Koeppe From heller at common-lisp.net Mon Oct 16 20:20:43 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 16:20:43 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016202043.1A36358001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8642 Modified Files: slime.el Log Message: (slime-insert-presentation): Honor slime-repl-enable-presentations. Presentations kill SLDB and the inspector in Emacs 20 (besides being troublesome GC-wise). --- /project/slime/cvsroot/slime/slime.el 2006/10/16 19:57:41 1.662 +++ /project/slime/cvsroot/slime/slime.el 2006/10/16 20:20:42 1.663 @@ -2908,10 +2908,13 @@ (when (eq (overlay-get overlay 'slime-repl-presentation) presentation) (delete-overlay overlay))))) -(defun slime-insert-presentation (result output-id) - (let ((start (point))) - (insert result) - (slime-add-presentation-properties start (point) output-id t))) +(defun slime-insert-presentation (string output-id) + (cond ((not slime-repl-enable-presentations) + (insert string)) + (t + (let ((start (point))) + (insert string) + (slime-add-presentation-properties start (point) output-id t))))) (defun slime-open-stream-to-lisp (port) (let ((stream (open-network-stream "*lisp-output-stream*" From heller at common-lisp.net Mon Oct 16 20:21:46 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 16:21:46 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016202146.3034963034@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9904 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/16 20:01:57 1.968 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/16 20:21:46 1.969 @@ -4,6 +4,9 @@ thread. Fixes bug reported by Dan Weinreb . (unwind-to-previous-sldb-level): New test. (slime-init-command): Send a single form. + (slime-insert-presentation): Honor slime-repl-enable-presentations. + Presentations kill SLDB and the inspector in Emacs 20 (besides + being troublesome GC-wise). * swank.lisp: Clean up global IO redirection. (setup-stream-indirection): Turn macro into a From heller at common-lisp.net Mon Oct 16 20:42:02 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 16:42:02 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016204202.2F2A43007@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12672 Modified Files: swank-cmucl.lisp Log Message: (inspect-for-emacs): Don't break for simple-strings. --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/08/11 16:26:20 1.163 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/10/16 20:42:02 1.164 @@ -1960,21 +1960,23 @@ (defmethod inspect-for-emacs ((o array) (inspector cmucl-inspector)) inspector - (values (format nil "~A is an array." o) - (label-value-line* - (:header (describe-primitive-type o)) - (:rank (array-rank o)) - (:fill-pointer (kernel:%array-fill-pointer o)) - (:fill-pointer-p (kernel:%array-fill-pointer-p o)) - (:elements (kernel:%array-available-elements o)) - (:data (kernel:%array-data-vector o)) - (:displacement (kernel:%array-displacement o)) - (:displaced-p (kernel:%array-displaced-p o)) - (:dimensions (array-dimensions o))))) + (if (typep o 'simple-array) + (call-next-method) + (values (format nil "~A is an array." o) + (label-value-line* + (:header (describe-primitive-type o)) + (:rank (array-rank o)) + (:fill-pointer (kernel:%array-fill-pointer o)) + (:fill-pointer-p (kernel:%array-fill-pointer-p o)) + (:elements (kernel:%array-available-elements o)) + (:data (kernel:%array-data-vector o)) + (:displacement (kernel:%array-displacement o)) + (:displaced-p (kernel:%array-displaced-p o)) + (:dimensions (array-dimensions o)))))) (defmethod inspect-for-emacs ((o simple-vector) (inspector cmucl-inspector)) inspector - (values (format nil "~A is a vector." o) + (values (format nil "~A is a simple-vector." o) (append (label-value-line* (:header (describe-primitive-type o)) From heller at common-lisp.net Mon Oct 16 20:43:00 2006 From: heller at common-lisp.net (heller) Date: Mon, 16 Oct 2006 16:43:00 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061016204300.745633063@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12719 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/16 20:21:46 1.969 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/16 20:43:00 1.970 @@ -25,6 +25,9 @@ Run the after-init-hook. + * swank-cmucl.lisp (inspect-for-emacs): Don't break for + simple-strings. + 2006-10-11 Matthias Koeppe * slime.el (slime-presentation-syntax-table): New. From heller at common-lisp.net Tue Oct 17 09:14:18 2006 From: heller at common-lisp.net (heller) Date: Tue, 17 Oct 2006 05:14:18 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061017091418.742A94F001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28332 Modified Files: slime.el Log Message: (slime-accept-process-output): The timeout arg can be nil. Handle that case. --- /project/slime/cvsroot/slime/slime.el 2006/10/16 20:20:42 1.663 +++ /project/slime/cvsroot/slime/slime.el 2006/10/17 09:14:18 1.664 @@ -10516,9 +10516,9 @@ (accept-process-output process timeout)) (t (accept-process-output process - (truncate timeout) + (if timeout (truncate timeout)) ;; Emacs 21 uses microsecs; Emacs 22 millisecs - (truncate (* timeout 1000000)))))) + (if timeout (truncate (* timeout 1000000))))))) (put 'slime-defun-if-undefined 'lisp-indent-function 2) From mbaringer at common-lisp.net Tue Oct 17 10:48:05 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Tue, 17 Oct 2006 06:48:05 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061017104805.16D6B3A009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9339 Modified Files: slime.el Log Message: (slime-find-buffer-package): Handle #. forms. --- /project/slime/cvsroot/slime/slime.el 2006/10/17 09:14:18 1.664 +++ /project/slime/cvsroot/slime/slime.el 2006/10/17 10:48:04 1.665 @@ -2400,16 +2400,24 @@ (regexp "^(\\(cl:\\|common-lisp:\\)?in-package\\>")) (or (re-search-backward regexp nil t) (re-search-forward regexp nil t))) - (goto-char (match-end 0)) - (skip-chars-forward " \n\t\f\r#'") - (cond - ((looking-at "\\.\\*swig-module-name\\*") ; # was skipped - (if (re-search-backward "(defparameter \\*swig-module-name\\* \\(:?\\sw*\\))" - nil t) - (match-string-no-properties 1))) - (t - (let ((pkg (ignore-errors (read (current-buffer))))) - (if pkg (format "%S" pkg))))))))) + (let ((evalp nil)) + (goto-char (match-end 0)) + (skip-chars-forward " \n\t\f\r'") + (if (looking-at "#\\.") + (progn + (setf evalp t) + (goto-char (+ (point) 2))) + (skip-chars-forward "#.")) + (cond + ((and evalp + (looking-at "\\*swig-module-name\\*")) ; #. was skipped + (if (re-search-backward "(defparameter \\*swig-module-name\\* \\(:?\\sw*\\))" + nil t) + (match-string-no-properties 1))) + (t + (let ((pkg (ignore-errors (read (current-buffer))))) + (if pkg + (format "%s%S" (if evalp "#." "") pkg)))))))))) ;;; Synchronous requests are implemented in terms of asynchronous ;;; ones. We make an asynchronous request with a continuation function From mbaringer at common-lisp.net Tue Oct 17 10:48:36 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Tue, 17 Oct 2006 06:48:36 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061017104836.12D2447016@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9401 Modified Files: swank-sbcl.lisp Log Message: (inspect-for-emacs weak-pointer ...): Added method. --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/09/24 21:52:55 1.166 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/17 10:48:35 1.167 @@ -935,6 +935,12 @@ (ash (sb-kernel:%code-code-size o) sb-vm:word-shift) :stream s)))))))) +(defmethod inspect-for-emacs ((o sb-ext:weak-pointer) (inspector sbcl-inspector)) + (declare (ignore inspector)) + (values "A weak pointer." + (label-value-line* + (:value (sb-ext:weak-pointer-value o))))) + (defmethod inspect-for-emacs ((o sb-kernel:fdefn) (inspector sbcl-inspector)) (declare (ignore inspector)) (values "A fdefn object." From mbaringer at common-lisp.net Tue Oct 17 10:48:55 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Tue, 17 Oct 2006 06:48:55 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061017104855.2418E4E009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9448 Modified Files: swank.lisp Log Message: (guess-package-from-string): Handle #. forms. (inspect-for-emacs standard-class): Handle non-string :documentation slot contents. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/16 19:58:45 1.405 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/17 10:48:54 1.406 @@ -1371,7 +1371,11 @@ (find-package name)))) (defun guess-package-from-string (name &optional (default-package *package*)) - (or (and name + (or (and (> (length name) 2) + (equal "#." (subseq name 0 2)) + (ignore-errors + (find-package (read-from-string name)))) + (and name (or (parse-package name) (find-package (string-upcase name)) (parse-package (substitute #\- #\! name)))) @@ -4384,8 +4388,9 @@ (swank-mop:slot-definition-name slot))))) '("#")) (:newline) - ,@(when (documentation class t) - `("Documentation:" (:newline) ,(documentation class t) (:newline))) + ,@(let ((doc (documentation class t))) + (when doc + `("Documentation:" (:newline) ,(inspector-princ doc) (:newline)))) "Sub classes: " ,@(common-seperated-spec (swank-mop:class-direct-subclasses class) (lambda (sub) From mbaringer at common-lisp.net Tue Oct 17 10:49:07 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Tue, 17 Oct 2006 06:49:07 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061017104907.37DA783006@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9478 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/16 20:43:00 1.970 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/17 10:49:07 1.971 @@ -1,3 +1,14 @@ +2006-10-11 Attila Lendvai + + * slime.el (slime-find-buffer-package): Handle #. forms. + + * swank.lisp (guess-package-from-string): Handle #. forms. + (inspect-for-emacs standard-class): Handle non-string + :documentation slot contents. + + * swank-sbcl.lisp (inspect-for-emacs weak-pointer ...): Added + method. + 2006-10-16 Helmut Eller * slime.el (sldb-activate): Get debug-info from the correct From heller at common-lisp.net Thu Oct 19 11:57:47 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 07:57:47 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019115747.CCFB12200E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv31895 Modified Files: slime.el Log Message: (slime-find-buffer-package): Simplify. --- /project/slime/cvsroot/slime/slime.el 2006/10/17 10:48:04 1.665 +++ /project/slime/cvsroot/slime/slime.el 2006/10/19 11:57:47 1.666 @@ -505,7 +505,7 @@ :type 'string :group 'slime-repl) -(defcustom slime-repl-history-size 1000 +(defcustom slime-repl-history-size 200 "*Maximum number of lines for persistent REPL history." :type 'integer :group 'slime-repl) @@ -2386,38 +2386,25 @@ (widen) (slime-find-buffer-package))))) -(defvar slime-find-buffer-package-function nil - "Function to use instead of `slime-find-buffer-package'. +(defvar slime-find-buffer-package-function 'slime-search-buffer-package + "*Function to use for `slime-find-buffer-package'. The result should be a string. The string will be READ at the Lisp side.") (defun slime-find-buffer-package () "Figure out which Lisp package the current buffer is associated with." - (if slime-find-buffer-package-function - (funcall slime-find-buffer-package-function) - (save-excursion - (when (let ((case-fold-search t) - (regexp "^(\\(cl:\\|common-lisp:\\)?in-package\\>")) - (or (re-search-backward regexp nil t) - (re-search-forward regexp nil t))) - (let ((evalp nil)) - (goto-char (match-end 0)) - (skip-chars-forward " \n\t\f\r'") - (if (looking-at "#\\.") - (progn - (setf evalp t) - (goto-char (+ (point) 2))) - (skip-chars-forward "#.")) - (cond - ((and evalp - (looking-at "\\*swig-module-name\\*")) ; #. was skipped - (if (re-search-backward "(defparameter \\*swig-module-name\\* \\(:?\\sw*\\))" - nil t) - (match-string-no-properties 1))) - (t - (let ((pkg (ignore-errors (read (current-buffer))))) - (if pkg - (format "%s%S" (if evalp "#." "") pkg)))))))))) + (funcall slime-find-buffer-package-function)) + +(defun slime-search-buffer-package () + (save-excursion + (when (let ((case-fold-search t) + (regexp "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \n\t\r']*")) + (or (re-search-backward regexp nil t) + (re-search-forward regexp nil t))) + (let ((start (match-end 0))) + (ignore-errors + (up-list 1) + (buffer-substring-no-properties start (1- (point)))))))) ;;; Synchronous requests are implemented in terms of asynchronous ;;; ones. We make an asynchronous request with a continuation function @@ -9961,7 +9948,7 @@ (sldb-invoke-restart 0))))))))) (let ((sldb-hook (cons debug-hook sldb-hook))) (slime-eval-async `(cl:aref cl:nil 0)) - (slime-sync-to-top-level 5) + (slime-sync-to-top-level 15) (slime-check-top-level) (slime-check ("Maximum depth reached (%S) is %S." max-depth level2) (= max-depth level2)) From heller at common-lisp.net Thu Oct 19 12:11:15 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:11:15 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019121115.90A4C72080@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5853 Modified Files: slime.el Log Message: (slime-search-buffer-package): Fix. --- /project/slime/cvsroot/slime/slime.el 2006/10/19 11:57:47 1.666 +++ /project/slime/cvsroot/slime/slime.el 2006/10/19 12:11:15 1.667 @@ -2401,10 +2401,10 @@ (regexp "^(\\(cl:\\|common-lisp:\\)?in-package\\>[ \n\t\r']*")) (or (re-search-backward regexp nil t) (re-search-forward regexp nil t))) - (let ((start (match-end 0))) - (ignore-errors + (goto-char (match-end 0)) + (let ((start (point))) (up-list 1) - (buffer-substring-no-properties start (1- (point)))))))) + (buffer-substring-no-properties start (1- (point))))))) ;;; Synchronous requests are implemented in terms of asynchronous ;;; ones. We make an asynchronous request with a continuation function From heller at common-lisp.net Thu Oct 19 12:11:42 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:11:42 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019121142.B5B9B72082@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5908 Modified Files: slime.el Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/slime.el 2006/10/19 12:11:15 1.667 +++ /project/slime/cvsroot/slime/slime.el 2006/10/19 12:11:42 1.668 @@ -2403,8 +2403,9 @@ (re-search-forward regexp nil t))) (goto-char (match-end 0)) (let ((start (point))) + (ignore-errors (up-list 1) - (buffer-substring-no-properties start (1- (point))))))) + (buffer-substring-no-properties start (1- (point)))))))) ;;; Synchronous requests are implemented in terms of asynchronous ;;; ones. We make an asynchronous request with a continuation function From heller at common-lisp.net Thu Oct 19 12:12:58 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:12:58 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019121258.CA1D976042@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5991 Modified Files: swank.lisp Log Message: (guess-package-from-string): Remove special case for "#.". parse-package will handle that just fine. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/17 10:48:54 1.406 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/19 12:12:58 1.407 @@ -1364,18 +1364,16 @@ (multiple-value-bind (name pos) (if (zerop (length string)) (values :|| 0) - (let ((*package* keyword-package)) + (let ((*package* *swank-io-package*)) (ignore-errors (read-from-string string)))) - (if (and (or (keywordp name) (stringp name)) - (= (length string) pos)) - (find-package name)))) + (and name + (or (symbolp name) + (stringp name)) + (= (length string) pos) + (find-package name)))) (defun guess-package-from-string (name &optional (default-package *package*)) - (or (and (> (length name) 2) - (equal "#." (subseq name 0 2)) - (ignore-errors - (find-package (read-from-string name)))) - (and name + (or (and name (or (parse-package name) (find-package (string-upcase name)) (parse-package (substitute #\- #\! name)))) From heller at common-lisp.net Thu Oct 19 12:14:26 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:14:26 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019121426.823331007@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6083 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/17 10:49:07 1.971 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/19 12:14:26 1.972 @@ -1,4 +1,16 @@ -2006-10-11 Attila Lendvai +2006-10-19 Helmut Eller + + * swank.lisp (guess-package-from-string): Remove special case for + "#.". parse-package will handle that just fine. + + * slime.el (slime-find-buffer-package): Simplify. + +2006-10-17 Helmut Eller + + * slime.el (slime-accept-process-output): The timeout arg can be + nil. Handle that case. + +2006-10-17 Attila Lendvai * slime.el (slime-find-buffer-package): Handle #. forms. From heller at common-lisp.net Thu Oct 19 12:29:09 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:29:09 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019122909.316B21900A@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8509 Modified Files: swank.lisp Log Message: (sanitize-xrefs): Moved to swank-sbcl. The backend is supposed to return sane values. (find-definitions-for-emacs): Don't filter errors out. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/19 12:12:58 1.407 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/19 12:29:09 1.408 @@ -3868,7 +3868,7 @@ (format nil "~S is now unprofiled." fname)) (t (profile fname) - (format nil "~S is now profiled." fname))))) + (format nil "~S is now profiled." fname))))) ;;;; Source Locations @@ -3880,8 +3880,7 @@ (ignore-errors (values (from-string name))) (cond (error '()) (t (loop for (dspec loc) in (find-definitions sexp) - unless (eql :error (first loc)) - collect (list (to-string dspec) loc)))))) + collect (list (to-string dspec) loc)))))) (defun alistify (list key test) "Partition the elements of LIST into an alist. KEY extracts the key @@ -3895,7 +3894,7 @@ (push e (cdr probe)) (push (cons k (list e)) alist)))) alist)) - + (defun location-position< (pos1 pos2) (cond ((and (position-p pos1) (position-p pos2)) (< (position-pos pos1) @@ -3904,7 +3903,7 @@ (defun partition (list test key) (declare (type function test key)) - (loop for e in list + (loop for e in list if (funcall test (funcall key e)) collect e into yes else collect e into no finally (return (values yes no)))) @@ -3925,10 +3924,10 @@ (defun group-xrefs (xrefs) "Group XREFS, a list of the form ((DSPEC LOCATION) ...) by location. The result is a list of the form ((LOCATION . ((DSPEC . LOCATION) ...)) ...)." - (multiple-value-bind (resolved errors) + (multiple-value-bind (resolved errors) (partition xrefs #'location-valid-p #'xref.location) (let ((alist (alistify resolved #'xref-buffer #'equal))) - (append + (append (loop for (buffer . list) in alist collect (cons (second buffer) (mapcar (lambda (xref) @@ -3936,8 +3935,8 @@ (xref.location xref))) (sort list #'location-position< :key #'xref-position)))) - (if errors - (list (cons "Unresolved" + (if errors + (list (cons "Unresolved" (mapcar (lambda (xref) (cons (to-string (xref.dspec xref)) (xref.location xref))) @@ -3946,27 +3945,16 @@ (defslimefun xref (type symbol-name) (let ((symbol (parse-symbol-or-lose symbol-name *buffer-package*))) (group-xrefs - (sanitize-xrefs - (ecase type - (:calls (who-calls symbol)) - (:calls-who (calls-who symbol)) - (:references (who-references symbol)) - (:binds (who-binds symbol)) - (:sets (who-sets symbol)) - (:macroexpands (who-macroexpands symbol)) - (:specializes (who-specializes symbol)) - (:callers (list-callers symbol)) - (:callees (list-callees symbol))))))) - -(defun sanitize-xrefs (x) - (remove-duplicates - (remove-if (lambda (f) - (member f (ignored-xref-function-names))) - x - :key #'car) - :test (lambda (a b) - (and (eq (first a) (first b)) - (equal (second a) (second b)))))) + (ecase type + (:calls (who-calls symbol)) + (:calls-who (calls-who symbol)) + (:references (who-references symbol)) + (:binds (who-binds symbol)) + (:sets (who-sets symbol)) + (:macroexpands (who-macroexpands symbol)) + (:specializes (who-specializes symbol)) + (:callers (list-callers symbol)) + (:callees (list-callees symbol)))))) ;;;; Inspecting From heller at common-lisp.net Thu Oct 19 12:29:32 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:29:32 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019122932.E0DB61901E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8548 Modified Files: swank-backend.lisp Log Message: (ignored-xref-function-names): Deleted. --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/09/24 21:52:55 1.104 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/19 12:29:32 1.105 @@ -732,12 +732,6 @@ "List the functions called by FUNCTION-NAME. See LIST-CALLERS for a description of the return value.") -;;; Utilities - -(definterface ignored-xref-function-names () - "List of function names that SANITIZE-XREFS should remove." - '(nil)) - ;;;; Profiling From heller at common-lisp.net Thu Oct 19 12:30:51 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:30:51 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019123051.C072321013@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8708 Modified Files: swank-sbcl.lisp Log Message: (list-callers, list-callers): Use SANITIZE-XREFS. --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/17 10:48:35 1.167 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/19 12:30:51 1.168 @@ -572,15 +572,29 @@ (defimplementation list-callers (symbol) (let ((fn (fdefinition symbol))) - (mapcar #'function-dspec (sb-introspect:find-function-callers fn)))) + (sanitize-xrefs + (mapcar #'function-dspec (sb-introspect:find-function-callers fn))))) (defimplementation list-callees (symbol) (let ((fn (fdefinition symbol))) - (mapcar #'function-dspec (sb-introspect:find-function-callees fn)))) + (sanitize-xrefs + (mapcar #'function-dspec (sb-introspect:find-function-callees fn))))) -#-#.(swank-backend::sbcl-with-new-stepper-p) -(defimplementation ignored-xref-function-names () - '(nil sb-c::step-form sb-c::step-values)) +(defun sanitize-xrefs (x) + (remove-duplicates + (remove-if (lambda (f) + (member f (ignored-xref-function-names))) + x + :key #'car) + :test (lambda (a b) + (and (eq (first a) (first b)) + (equal (second a) (second b)))))) + +(defun ignored-xref-function-names () + #-#.(swank-backend::sbcl-with-new-stepper-p) + '(nil sb-c::step-form sb-c::step-values) + #+#.(swank-backend::sbcl-with-new-stepper-p) + '(nil)) (defun function-dspec (fn) "Describe where the function FN was defined. From heller at common-lisp.net Thu Oct 19 12:32:09 2006 From: heller at common-lisp.net (heller) Date: Thu, 19 Oct 2006 08:32:09 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061019123209.06B7821013@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8765 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/19 12:14:26 1.972 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/19 12:32:08 1.973 @@ -1,8 +1,15 @@ 2006-10-19 Helmut Eller + * swank-backend.lisp (ignored-xref-function-names): Deleted. + * swank.lisp (guess-package-from-string): Remove special case for "#.". parse-package will handle that just fine. + (find-definitions-for-emacs): Don't filter errors out. + (sanitize-xrefs): Moved to swank-sbcl. The backend is supposed to + return sane values. + * swank-sbcl.lisp: See above. + * slime.el (slime-find-buffer-package): Simplify. 2006-10-17 Helmut Eller From mbaringer at common-lisp.net Fri Oct 20 00:00:11 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:00:11 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020000011.E12F14F002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv10467 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/19 12:32:08 1.973 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/20 00:00:11 1.974 @@ -1,3 +1,35 @@ +2006-10-20 Levente M?sz?ros + + Added "in-place" fuzzy completion GUI. See + slime-fuzzy-completions-map and + slime-target-buffer-fuzzy-completions-map for details. + + * slime.el (slime-space-information-p): New variable. + (slime-target-buffer-fuzzy-completions-mode): New keymap for + in-place fuzzy completions. + (slime-fuzzy-target-buffer-completions-mode): New minor mode for + in-place fuzzy completions. + (slime-fuzzy-current-completion-overlay): New overlay for + highlighting currently selected completion. + (slime-fuzzy-completions-map): Added new fuzzy completon keys + (slime-fuzzy-indent-and-complete-symbol): New function. + (slime-fuzzy-complete-symbol): Use new in-place fuzzy completion. + (slime-fuzzy-choices-buffer): Support in-place completion editing. + (slime-fuzzy-fill-completions-buffer): Highlight completions, + don't automatically jump to completion buffer. + (slime-fuzzy-enable-target-buffer-completions-mode, + slime-fuzzy-disable-target-buffer-completions-mode): New modes for + moving in/out of in-place fuzzy completion mode + (slime-fuzzy-next, slime-fuzzy-prev): Don't assume point is in the + completion buffer. + (slime-fuzzy-dehighlight-current-completion, + slime-fuzzy-highlight-current-completion): Manage completion + selection highlighting. + (slime-fuzzy-select-or-update-completions): New function. + (slime-fuzzy-process-event-in-completions-buffer): New function. + (slime-fuzzy-select-and-process-event-in-target-buffer): New function. + (slime-fuzzy-done): Changed to deal with in-place completion. + 2006-10-19 Helmut Eller * swank-backend.lisp (ignored-xref-function-names): Deleted. From mbaringer at common-lisp.net Fri Oct 20 00:00:22 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:00:22 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020000022.329DD56002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11029 Modified Files: slime.el Log Message: --- /project/slime/cvsroot/slime/slime.el 2006/10/19 12:11:42 1.668 +++ /project/slime/cvsroot/slime/slime.el 2006/10/20 00:00:21 1.669 @@ -267,6 +267,12 @@ :group 'slime-mode :type 'boolean) +(defcustom slime-fuzzy-completion-in-place nil + "When non-NIL the fuzzy symbol completion is done in place as +opposed to moving the point to the completion buffer." + :group 'slime-mode + :type 'boolean) + (defcustom slime-space-information-p t "Have the SPC key offer arglist information." :type 'boolean @@ -512,8 +518,44 @@ ;;;; Minor modes -;;;;; slime-mode +;;;; slime-target-buffer-fuzzy-completions-mode +;;;; NOTE: this mode has to be able to override key mappings in slime-mode +(defvar slime-target-buffer-fuzzy-completions-map + (let* ((map (make-sparse-keymap))) + + (define-key map (kbd "C-g") 'slime-fuzzy-abort) + (define-key map (kbd "") 'slime-fuzzy-abort) + + ;; the completion key + (define-key map "\t" 'slime-fuzzy-select-or-update-completions) + + (dolist (key (list (kbd "") " " "(" ")" "[" "]")) + (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer)) + + (define-key map (kbd "") 'slime-fuzzy-prev) + (define-key map (kbd "") 'slime-fuzzy-next) + (define-key map (where-is-internal 'isearch-forward global-map t t) + (lambda () + (interactive) + (select-window (get-buffer-window (slime-get-fuzzy-buffer))) + (call-interactively 'isearch-forward))) + "Keymap for slime-target-buffer-fuzzy-completions-mode. This will override the key +bindings in the target buffer temporarily during completion.") + +(define-minor-mode slime-fuzzy-target-buffer-completions-mode + "This minor mode is intented to override key bindings during fuzzy +completions in the target buffer. Most of the bindings will do an implicit select +in the completion window and let the keypress be processed in the target buffer." + nil + nil + slime-target-buffer-fuzzy-completions-map) + +(add-to-list 'minor-mode-alist + '(slime-fuzzy-target-buffer-completions-mode + " Fuzzy Target Buffer Completions")) + +;;;;; slime-mode (define-minor-mode slime-mode "\\\ SLIME: The Superior Lisp Interaction Mode for Emacs (minor-mode). @@ -6093,6 +6135,9 @@ "The current completion object. If this is the same before and after point moves in the completions buffer, the text is not replaced in the target for efficiency.") +(defvar slime-fuzzy-current-completion-overlay nil + "The overlay representing the current completion in the completion +buffer. This is used to hightlight the text.") (define-derived-mode slime-fuzzy-completions-mode fundamental-mode "Fuzzy Completions" @@ -6106,17 +6151,26 @@ (let* ((map (make-sparse-keymap))) (define-key map "q" 'slime-fuzzy-abort) + (define-key map (kbd "C-g") 'slime-fuzzy-abort) (define-key map "\r" 'slime-fuzzy-select) (define-key map "n" 'slime-fuzzy-next) (define-key map "\M-n" 'slime-fuzzy-next) + (define-key map (kbd "") 'slime-fuzzy-next) (define-key map "p" 'slime-fuzzy-prev) (define-key map "\M-p" 'slime-fuzzy-prev) + (define-key map (kbd "") 'slime-fuzzy-prev) - (define-key map "\d" 'scroll-down) - (define-key map " " 'scroll-up) + (define-key map "\d" 'scroll-down) + + ;; the completion key + (define-key map "\t" 'slime-fuzzy-select) + + (dolist (key (list (kbd "") " ")) + (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer)) + (define-key map [mouse-2] 'slime-fuzzy-select/mouse) map) @@ -6141,6 +6195,21 @@ (slime-eval `(swank:fuzzy-completion-selected ,no-properties ',completion)))) +(defun slime-fuzzy-indent-and-complete-symbol () + "Indent the current line and perform fuzzy symbol completion. First +indent the line. If indenting doesn't move point, complete the +symbol. If there's no symbol at the point, show the arglist for the +most recently enclosed macro or function." + (interactive) + (let ((pos (point))) + (unless (get-text-property (line-beginning-position) 'slime-repl-prompt) + (lisp-indent-line)) + (when (= pos (point)) + (cond ((save-excursion (re-search-backward "[^() \n\t\r]+\\=" nil t)) + (slime-fuzzy-complete-symbol)) + ((memq (char-before) '(?\t ?\ )) + (slime-echo-arglist)))))) + (defun* slime-fuzzy-complete-symbol () "Fuzzily completes the abbreviation at point into a symbol." (interactive) @@ -6157,13 +6226,14 @@ (progn (slime-minibuffer-respecting-message "Can't find completion for \"%s\"" prefix) (ding) - (slime-complete-restore-window-configuration)) + (slime-fuzzy-done)) (goto-char end) (cond ((= (length completion-set) 1) (insert-and-inherit (caar completion-set)) (delete-region beg end) (goto-char (+ beg (length (caar completion-set)))) - (slime-minibuffer-respecting-message "Sole completion")) + (slime-minibuffer-respecting-message "Sole completion") + (slime-fuzzy-done)) ;; Incomplete (t (slime-minibuffer-respecting-message "Complete but not unique") @@ -6239,13 +6309,25 @@ `end'. This saves the window configuration before popping the buffer so that it can possibly be restored when the user is done." - (setq slime-fuzzy-target-buffer (current-buffer)) - (setq slime-fuzzy-start (move-marker (make-marker) start)) - (setq slime-fuzzy-end (move-marker (make-marker) end)) - (set-marker-insertion-type slime-fuzzy-end t) - (setq slime-fuzzy-original-text (buffer-substring start end)) - (setq slime-fuzzy-text slime-fuzzy-original-text) - (slime-fuzzy-save-window-configuration) + (let ((new-completion-buffer (not slime-fuzzy-target-buffer))) + (when new-completion-buffer + (slime-fuzzy-save-window-configuration)) + (slime-fuzzy-enable-target-buffer-completions-mode) + (setq slime-fuzzy-target-buffer (current-buffer)) + (setq slime-fuzzy-start (move-marker (make-marker) start)) + (setq slime-fuzzy-end (move-marker (make-marker) end)) + (set-marker-insertion-type slime-fuzzy-end t) + (setq slime-fuzzy-original-text (buffer-substring start end)) + (setq slime-fuzzy-text slime-fuzzy-original-text) + (slime-fuzzy-fill-completions-buffer completions) + (when new-completion-buffer + (pop-to-buffer (slime-get-fuzzy-buffer)) + (when (not slime-fuzzy-completion-in-place) + ;; switch back to the original buffer + (switch-to-buffer-other-window slime-fuzzy-target-buffer))))) + +(defun slime-fuzzy-fill-completions-buffer (completions) + "Erases and fills the completion buffer with the given completions." (with-current-buffer (slime-get-fuzzy-buffer) (setq buffer-read-only nil) (erase-buffer) @@ -6265,11 +6347,20 @@ (setq buffer-read-only t)) (setq slime-fuzzy-current-completion (caar completions)) - (slime-fuzzy-insert (caar completions)) (goto-char slime-fuzzy-first) - (pop-to-buffer (current-buffer)) - (add-hook (make-local-variable 'post-command-hook) - 'slime-fuzzy-post-command-hook))) + (slime-fuzzy-highlight-current-completion))) + +(defun slime-fuzzy-enable-target-buffer-completions-mode () + "Store the target buffer's local map, so that we can restore it." + (unless slime-fuzzy-target-buffer-completions-mode +; (slime-log-event "Enabling target buffer completions mode") + (slime-fuzzy-target-buffer-completions-mode 1))) + +(defun slime-fuzzy-disable-target-buffer-completions-mode () + "Restores the target buffer's local map when completion is finished." + (when slime-fuzzy-target-buffer-completions-mode +; (slime-log-event "Disabling target buffer completions mode") + (slime-fuzzy-target-buffer-completions-mode 0))) (defun slime-fuzzy-insert-from-point () "Inserts the completion that is under point in the completions @@ -6301,23 +6392,40 @@ "Moves point directly to the next completion in the completions buffer." (interactive) - (goto-char - (next-single-char-property-change (point) 'completion))) + (with-current-buffer (slime-get-fuzzy-buffer) + (slime-fuzzy-dehighlight-current-completion) + (let ((point (next-single-char-property-change (point) 'completion))) + (set-window-point (get-buffer-window (current-buffer)) point) + (goto-char point)) + (slime-fuzzy-highlight-current-completion))) (defun slime-fuzzy-prev () "Moves point directly to the previous completion in the completions buffer." (interactive) - (goto-char (previous-single-char-property-change - (point) 'completion - nil slime-fuzzy-first))) + (with-current-buffer (slime-get-fuzzy-buffer) + (slime-fuzzy-dehighlight-current-completion) + (let ((point (previous-single-char-property-change (point) 'completion nil slime-fuzzy-first))) + (set-window-point (get-buffer-window (current-buffer)) point) + (goto-char point)) + (slime-fuzzy-highlight-current-completion))) + +(defun slime-fuzzy-dehighlight-current-completion () + "Restores the original face for the current completion." + (overlay-put slime-fuzzy-current-completion-overlay 'face 'nil)) + +(defun slime-fuzzy-highlight-current-completion () + "Highlights the current completion, so that the user can see it on the screen." + (let ((pos (point))) + (setq slime-fuzzy-current-completion-overlay (make-overlay (point) (search-forward " ") (current-buffer) t nil)) + (overlay-put slime-fuzzy-current-completion-overlay 'face 'secondary-selection) + (goto-char pos))) (defun slime-fuzzy-abort () "Aborts the completion process, setting the completions slot in the target buffer back to its original contents." (interactive) (when slime-fuzzy-target-buffer - (slime-fuzzy-insert slime-fuzzy-original-text) (slime-fuzzy-done))) (defun slime-fuzzy-select () @@ -6334,6 +6442,36 @@ completion) (slime-fuzzy-done)))))) +(defun slime-fuzzy-select-or-update-completions () + "If there were no changes since the last time fuzzy completion was started +this function will select the current completion. Otherwise refreshes the completion +list based on the changes made." + (interactive) +; (slime-log-event "Selecting or updating completions") + (if (string-equal slime-fuzzy-original-text + (buffer-substring slime-fuzzy-start + slime-fuzzy-end)) + (slime-fuzzy-select) + (slime-fuzzy-complete-symbol))) + +(defun slime-fuzzy-process-event-in-completions-buffer () + "Simply processes the event in the target buffer" + (interactive) + (with-current-buffer (slime-get-fuzzy-buffer) + (push last-input-event unread-command-events))) + +(defun slime-fuzzy-select-and-process-event-in-target-buffer () + "Selects the current completion, making sure that it is inserted +into the target buffer and processes the event in the target buffer." + (interactive) +; (slime-log-event "Selecting and processing event in target buffer") + (when slime-fuzzy-target-buffer + (let ((buff slime-fuzzy-target-buffer)) + (slime-fuzzy-select) + (with-current-buffer buff + (slime-fuzzy-disable-target-buffer-completions-mode) + (push last-input-event unread-command-events))))) + (defun slime-fuzzy-select/mouse (event) "Handle a mouse-2 click on a completion choice as if point were on the completion choice and the slime-fuzzy-select command was @@ -6351,18 +6489,18 @@ and attempts to restore the window configuration. If this fails, it just burys the completions buffer and leaves the window configuration alone." - (set-buffer slime-fuzzy-target-buffer) - (remove-hook 'post-command-hook - 'slime-fuzzy-post-command-hook) - (if (slime-fuzzy-maybe-restore-window-configuration) - (bury-buffer (slime-get-fuzzy-buffer)) - ;; We couldn't restore the windows, so just bury the fuzzy - ;; completions buffer and let something else fill it in. - (pop-to-buffer (slime-get-fuzzy-buffer)) - (bury-buffer)) - (pop-to-buffer slime-fuzzy-target-buffer) - (goto-char slime-fuzzy-end) - (setq slime-fuzzy-target-buffer nil)) + (when slime-fuzzy-target-buffer + (set-buffer slime-fuzzy-target-buffer) + (slime-fuzzy-disable-target-buffer-completions-mode) + (if (slime-fuzzy-maybe-restore-window-configuration) + (bury-buffer (slime-get-fuzzy-buffer)) + ;; We couldn't restore the windows, so just bury the fuzzy + ;; completions buffer and let something else fill it in. + (pop-to-buffer (slime-get-fuzzy-buffer)) + (bury-buffer)) + (pop-to-buffer slime-fuzzy-target-buffer) + (goto-char slime-fuzzy-end) + (setq slime-fuzzy-target-buffer nil))) (defun slime-fuzzy-save-window-configuration () "Saves the current window configuration, and (if the From mbaringer at common-lisp.net Fri Oct 20 00:04:33 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:04:33 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020000433.D864D6F23D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11869 Modified Files: slime.el Log Message: --- /project/slime/cvsroot/slime/slime.el 2006/10/20 00:00:21 1.669 +++ /project/slime/cvsroot/slime/slime.el 2006/10/20 00:04:33 1.670 @@ -540,7 +540,7 @@ (select-window (get-buffer-window (slime-get-fuzzy-buffer))) (call-interactively 'isearch-forward))) "Keymap for slime-target-buffer-fuzzy-completions-mode. This will override the key -bindings in the target buffer temporarily during completion.") +bindings in the target buffer temporarily during completion.")) (define-minor-mode slime-fuzzy-target-buffer-completions-mode "This minor mode is intented to override key bindings during fuzzy @@ -6322,7 +6322,7 @@ (slime-fuzzy-fill-completions-buffer completions) (when new-completion-buffer (pop-to-buffer (slime-get-fuzzy-buffer)) - (when (not slime-fuzzy-completion-in-place) + (when slime-fuzzy-completion-in-place ;; switch back to the original buffer (switch-to-buffer-other-window slime-fuzzy-target-buffer))))) From mbaringer at common-lisp.net Fri Oct 20 00:13:11 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:13:11 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001311.5F2F15F001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13739 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/20 00:00:11 1.974 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/20 00:13:11 1.975 @@ -1,3 +1,16 @@ +2006-10-20 Martin Simmons + + * swank-backend.lisp (initialize-multiprocessing): New API to + support lisps where initialize-multiprocessing may not return (lispworks). + + * swank.lisp (start-server): New API for initialize-multiprocessing. + + * swank-lispworks.lisp (initialize-multiprocessing): Update for new API. + + * swank-cmucl.lisp (initialize-multiprocessing): Update for new API. + + * swank-allegro.lisp (initialize-multiprocessing): Update for new api. + 2006-10-20 Levente M?sz?ros Added "in-place" fuzzy completion GUI. See From mbaringer at common-lisp.net Fri Oct 20 00:13:34 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:13:34 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001334.6C3E563037@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13788 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/20 00:13:11 1.975 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/20 00:13:34 1.976 @@ -3,7 +3,7 @@ * swank-backend.lisp (initialize-multiprocessing): New API to support lisps where initialize-multiprocessing may not return (lispworks). - * swank.lisp (start-server): New API for initialize-multiprocessing. + * swank.lisp (start-server): initialize-multiprocessing's API has changed. * swank-lispworks.lisp (initialize-multiprocessing): Update for new API. From mbaringer at common-lisp.net Fri Oct 20 00:14:08 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:14:08 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001408.1E47D7433D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13841 Modified Files: swank.lisp Log Message: (start-server): initialize-multiprocessing's API has changed. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/19 12:29:09 1.408 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/20 00:14:07 1.409 @@ -405,12 +405,14 @@ dont-close (external-format *coding-system*)) "Start the server and write the listen port number to PORT-FILE. This is the entry point for Emacs." - (when (eq style :spawn) - (initialize-multiprocessing)) - (setup-server 0 (lambda (port) (announce-server-port port-file port)) - style dont-close external-format) - (when (eq style :spawn) - (startup-idle-and-top-level-loops))) + (flet ((start-server-aux () + (setup-server 0 (lambda (port) (announce-server-port port-file port)) + style dont-close external-format) + (when (eq style :spawn) + (startup-idle-and-top-level-loops)))) + (if (eq style :spawn) + (initialize-multiprocessing #'start-server-aux) + (start-server-aux)))) (defun create-server (&key (port default-server-port) (style *communication-style*) From mbaringer at common-lisp.net Fri Oct 20 00:14:26 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:14:26 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001426.AE3D57603F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13895 Modified Files: swank-lispworks.lisp Log Message: (initialize-multiprocessing): Update for new API. --- /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/08/10 11:53:35 1.85 +++ /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/10/20 00:14:26 1.86 @@ -684,7 +684,8 @@ ;;; Multithreading -(defimplementation initialize-multiprocessing () +(defimplementation initialize-multiprocessing (continuation) + (push (list "Initialize SLIME" '() continuation) mp:*initial-processes*) (mp:initialize-multiprocessing)) (defimplementation spawn (fn &key name) From mbaringer at common-lisp.net Fri Oct 20 00:14:39 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:14:39 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001439.E652B3063@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13926 Modified Files: swank-cmucl.lisp Log Message: (initialize-multiprocessing): Update for new API. --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/10/16 20:42:02 1.164 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/10/20 00:14:39 1.165 @@ -2044,8 +2044,9 @@ #+mp (progn - (defimplementation initialize-multiprocessing () - (mp::init-multi-processing)) + (defimplementation initialize-multiprocessing (continuation) + (mp::init-multi-processing) + (funcall continuation)) (defimplementation startup-idle-and-top-level-loops () ;; Threads magic: this never returns! But top-level becomes From mbaringer at common-lisp.net Fri Oct 20 00:15:01 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:15:01 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001501.7E2F678001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13963 Modified Files: swank-backend.lisp Log Message: (initialize-multiprocessing): New API to support lisps where initialize-multiprocessing may not return (lispworks). --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/19 12:29:32 1.105 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/20 00:15:01 1.106 @@ -845,9 +845,9 @@ ;;; The default implementations are sufficient for non-multiprocessing ;;; implementations. -(definterface initialize-multiprocessing () - "Initialize multiprocessing, if necessary." - nil) +(definterface initialize-multiprocessing (continuation) + "Initialize multiprocessing, if necessary and then invoke CONTINUATION." + (funcall continuation)) (definterface startup-idle-and-top-level-loops () "This function is called directly through the listener, not in an RPC From mbaringer at common-lisp.net Fri Oct 20 00:15:16 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:15:16 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020001516.1AB2D1C010@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14087 Modified Files: swank-allegro.lisp Log Message: (initialize-multiprocessing): Update for new api. --- /project/slime/cvsroot/slime/swank-allegro.lisp 2006/08/10 18:55:51 1.90 +++ /project/slime/cvsroot/slime/swank-allegro.lisp 2006/10/20 00:15:15 1.91 @@ -616,8 +616,9 @@ ;;;; Multithreading -(defimplementation initialize-multiprocessing () - (mp:start-scheduler)) +(defimplementation initialize-multiprocessing (continuation) + (mp:start-scheduler) + (funcall continuation)) (defimplementation spawn (fn &key name) (mp:process-run-function name fn)) From mbaringer at common-lisp.net Fri Oct 20 00:42:27 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 19 Oct 2006 20:42:27 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020004227.991294F004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20066 Modified Files: slime.el Log Message: --- /project/slime/cvsroot/slime/slime.el 2006/10/20 00:04:33 1.670 +++ /project/slime/cvsroot/slime/slime.el 2006/10/20 00:42:26 1.671 @@ -538,9 +538,9 @@ (lambda () (interactive) (select-window (get-buffer-window (slime-get-fuzzy-buffer))) - (call-interactively 'isearch-forward))) + (call-interactively 'isearch-forward)))) "Keymap for slime-target-buffer-fuzzy-completions-mode. This will override the key -bindings in the target buffer temporarily during completion.")) +bindings in the target buffer temporarily during completion.") (define-minor-mode slime-fuzzy-target-buffer-completions-mode "This minor mode is intented to override key bindings during fuzzy From mbaringer at common-lisp.net Fri Oct 20 10:08:45 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 20 Oct 2006 06:08:45 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020100845.AB015710D2@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17909 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/20 00:13:34 1.976 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/20 10:08:45 1.977 @@ -1,3 +1,8 @@ +2006-10-20 Marco Baringer + + * slime.el (slime-target-buffer-fuzzy-completions-map): Fix a dug + I introduced when applying levente's patch. + 2006-10-20 Martin Simmons * swank-backend.lisp (initialize-multiprocessing): New API to From mbaringer at common-lisp.net Fri Oct 20 10:09:05 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 20 Oct 2006 06:09:05 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020100905.766597603F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17959 Modified Files: slime.el Log Message: (slime-target-buffer-fuzzy-completions-map): Fix a dug I introduced when applying levente's patch. --- /project/slime/cvsroot/slime/slime.el 2006/10/20 00:42:26 1.671 +++ /project/slime/cvsroot/slime/slime.el 2006/10/20 10:09:05 1.672 @@ -538,7 +538,9 @@ (lambda () (interactive) (select-window (get-buffer-window (slime-get-fuzzy-buffer))) - (call-interactively 'isearch-forward)))) + (call-interactively 'isearch-forward))) + map + ) "Keymap for slime-target-buffer-fuzzy-completions-mode. This will override the key bindings in the target buffer temporarily during completion.") From mbaringer at common-lisp.net Fri Oct 20 11:07:39 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 20 Oct 2006 07:07:39 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020110739.708784F000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30560 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/20 10:08:45 1.977 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/20 11:07:39 1.978 @@ -1,6 +1,12 @@ +2006-10-20 Attila Lendvai + + * slime.el (slime-fuzzy-choices-buffer): Added kill-buffer-hook to + the completion buffer to slime-fuzzy-abort, so we get out from the + completion mode and key maps when the completion buffer is closed. + 2006-10-20 Marco Baringer - * slime.el (slime-target-buffer-fuzzy-completions-map): Fix a dug + * slime.el (slime-target-buffer-fuzzy-completions-map): Fix a bug I introduced when applying levente's patch. 2006-10-20 Martin Simmons From mbaringer at common-lisp.net Fri Oct 20 11:07:57 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 20 Oct 2006 07:07:57 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020110757.A30BD50001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30625 Modified Files: slime.el Log Message: (slime-fuzzy-choices-buffer): Added kill-buffer-hook to the completion buffer to slime-fuzzy-abort, so we get out from the completion mode and key maps when the completion buffer is closed. --- /project/slime/cvsroot/slime/slime.el 2006/10/20 10:09:05 1.672 +++ /project/slime/cvsroot/slime/slime.el 2006/10/20 11:07:57 1.673 @@ -6324,6 +6324,7 @@ (slime-fuzzy-fill-completions-buffer completions) (when new-completion-buffer (pop-to-buffer (slime-get-fuzzy-buffer)) + (add-hook 'kill-buffer-hook 'slime-fuzzy-abort nil t) (when slime-fuzzy-completion-in-place ;; switch back to the original buffer (switch-to-buffer-other-window slime-fuzzy-target-buffer))))) From heller at common-lisp.net Fri Oct 20 17:07:55 2006 From: heller at common-lisp.net (heller) Date: Fri, 20 Oct 2006 13:07:55 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020170755.D876770247@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv25845 Modified Files: swank-backend.lisp swank-cmucl.lisp swank.lisp Log Message: (startup-idle-and-top-level-loops): Deleted. Merged into initialize-multiprocessing. --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/20 00:15:01 1.106 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/20 17:07:55 1.107 @@ -846,15 +846,10 @@ ;;; implementations. (definterface initialize-multiprocessing (continuation) - "Initialize multiprocessing, if necessary and then invoke CONTINUATION." - (funcall continuation)) + "Initialize multiprocessing, if necessary and then invoke CONTINUATION. -(definterface startup-idle-and-top-level-loops () - "This function is called directly through the listener, not in an RPC -from Emacs. This is to support interfaces such as CMUCL's -MP::STARTUP-IDLE-AND-TOP-LEVEL-LOOPS which does not return like a -normal function." - nil) +Depending on the impleimentaion, this function may never return." + (funcall continuation)) (definterface spawn (fn &key name) "Create a new thread to call FN.") --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/10/20 00:14:39 1.165 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/10/20 17:07:55 1.166 @@ -1475,7 +1475,12 @@ (error (make-condition 'sldb-condition :original-condition condition))))) - (funcall debugger-loop-fn)))) + (unwind-protect + (progn + #+(or)(sys:scrub-control-stack) + (funcall debugger-loop-fn)) + #+(or)(sys:scrub-control-stack) + )))) (defun frame-down (frame) (handler-case (di:frame-down frame) @@ -2046,14 +2051,12 @@ (progn (defimplementation initialize-multiprocessing (continuation) (mp::init-multi-processing) - (funcall continuation)) - - (defimplementation startup-idle-and-top-level-loops () + (mp:make-process continuation :name "swank") ;; Threads magic: this never returns! But top-level becomes ;; available again. - (unless mp::*initial-process* + (unless mp::*idle-process* (mp::startup-idle-and-top-level-loops))) - + (defimplementation spawn (fn &key name) (mp:make-process fn :name (or name "Anonymous"))) --- /project/slime/cvsroot/slime/swank.lisp 2006/10/20 00:14:07 1.409 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/20 17:07:55 1.410 @@ -406,10 +406,9 @@ "Start the server and write the listen port number to PORT-FILE. This is the entry point for Emacs." (flet ((start-server-aux () - (setup-server 0 (lambda (port) (announce-server-port port-file port)) - style dont-close external-format) - (when (eq style :spawn) - (startup-idle-and-top-level-loops)))) + (setup-server 0 (lambda (port) + (announce-server-port port-file port)) + style dont-close external-format))) (if (eq style :spawn) (initialize-multiprocessing #'start-server-aux) (start-server-aux)))) @@ -3691,7 +3690,7 @@ The result is a list of property lists." (let ((package (if package (or (find-package (string-to-package-designator package)) - (abort-request "No such package: ~S" package))))) + (error "No such package: ~S" package))))) (mapcan (listify #'briefly-describe-symbol-for-emacs) (sort (remove-duplicates (apropos-symbols name external-only case-sensitive package)) From heller at common-lisp.net Fri Oct 20 17:08:58 2006 From: heller at common-lisp.net (heller) Date: Fri, 20 Oct 2006 13:08:58 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061020170858.5DB34B@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv25963 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/20 11:07:39 1.978 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/20 17:08:58 1.979 @@ -1,3 +1,9 @@ +2006-10-20 Helmut Eller + + * swank-backend.lisp, swank-cmucl.lisp: + (startup-idle-and-top-level-loops): Deleted. Merged into + initialize-multiprocessing. + 2006-10-20 Attila Lendvai * slime.el (slime-fuzzy-choices-buffer): Added kill-buffer-hook to From heller at common-lisp.net Sat Oct 21 09:27:50 2006 From: heller at common-lisp.net (heller) Date: Sat, 21 Oct 2006 05:27:50 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061021092750.4900660002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5423 Modified Files: test.sh Log Message: Run Emacs in Screen. --- /project/slime/cvsroot/slime/test.sh 2005/08/29 20:02:58 1.7 +++ /project/slime/cvsroot/slime/test.sh 2006/10/21 09:27:50 1.8 @@ -1,6 +1,6 @@ #!/bin/sh -# Run the SLIME test suite in batch mode, saving the results to a file. +# Run the SLIME test suite inside screen, saving the results to a file. # This script's exit status is the number of tests failed. If no tests # fail then no output is printed. If at least one test fails then a @@ -12,42 +12,71 @@ # This code has been placed in the Public Domain. All warranties # are disclaimed. -if [ $# != 4 ]; then - echo "Usage: $0 " +function usage () { + echo "Usage: $name [-v] [-r] " exit 1 -fi +} + +name=$0 + +while getopts vr opt; do + case $opt in + v) verbose=true;; + r) dump_results=true;; + *) usage;; + esac +done -emacs=$1; lisp=$2; dribble=$3; results=$4 -slimedir=$(dirname $0) +shift $((OPTIND - 1)) +[ $# = 2 ] || usage + +emacs=$1; lisp=$2; # Move the code into a directory in /tmp, so that we can compile it # for the current lisp. +slimedir=$(dirname $name) testdir=/tmp/slime-test.$$ +results=$testdir/results +dribble=$testdir/dribble +statusfile=$testdir/status + test -d $testdir && rm -r $testdir + trap "rm -r $testdir" EXIT # remove temporary directory on exit mkdir $testdir cp $slimedir/*.el $slimedir/*.lisp ChangeLog $testdir +mkfifo $dribble -# you can remove "--batch" to get an emacs window for troubleshooting. -$emacs --no-site-file --no-init-file \ - --eval "(setq debug-on-quit t)" \ - --eval "(setq max-lisp-eval-depth 1000)" \ - --eval "(setq load-path (cons \"$testdir\" load-path))" \ - --eval "(require 'slime)" \ - --eval "(setq inferior-lisp-program \"$lisp\")" \ - --eval "(slime-batch-test \"${results}\")" \ - &> $dribble \ +session=slime-screen.$$ -status=$? +screen -S $session -m -D bash -c "$emacs -nw -q -no-site-file --no-site-file \ + --eval '(setq debug-on-quit t)' \ + --eval '(setq max-lisp-eval-depth 1000)' \ + --eval '(setq load-path (cons \"$testdir\" load-path))' \ + --eval '(require (quote slime))' \ + --eval '(setq inferior-lisp-program \"$lisp\")' \ + --eval '(slime-batch-test \"$results\")' > $dribble;\ + echo \$? > $statusfile" & -if [ -f "$results" ]; then - echo $status "test(s) failed." +screenpid=$! + +if [ "$verbose" = true ]; then + cat $dribble & +else + cat $dribble > /dev/null & +fi; + +trap "screen -S $session -X quit" SIGINT +wait $screenpid + +if [ -f "$statusfile" ]; then + [ "$dump_results" = true ] && cat $results; + echo $(cat $statusfile) "test(s) failed." else # Tests crashed echo crashed fi exit $status - From heller at common-lisp.net Sat Oct 21 09:28:58 2006 From: heller at common-lisp.net (heller) Date: Sat, 21 Oct 2006 05:28:58 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061021092858.A59226A003@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5611 Modified Files: swank-lispworks.lisp Log Message: (initialize-multiprocessing): Don't init MP if it is already running. --- /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/10/20 00:14:26 1.86 +++ /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/10/21 09:28:57 1.87 @@ -685,8 +685,11 @@ ;;; Multithreading (defimplementation initialize-multiprocessing (continuation) - (push (list "Initialize SLIME" '() continuation) mp:*initial-processes*) - (mp:initialize-multiprocessing)) + (cond ((not mp::*multiprocessing*) + (push (list "Initialize SLIME" '() continuation) + mp:*initial-processes*) + (mp:initialize-multiprocessing)) + (t (funcall continuation)))) (defimplementation spawn (fn &key name) (let ((mp:*process-initial-bindings* From heller at common-lisp.net Sat Oct 21 09:30:20 2006 From: heller at common-lisp.net (heller) Date: Sat, 21 Oct 2006 05:30:20 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061021093020.A2AF870247@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv5682 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/20 17:08:58 1.979 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/21 09:30:20 1.980 @@ -1,3 +1,10 @@ +2006-10-21 Helmut Eller + + * swank-lispworks.lisp (initialize-multiprocessing): Don't init + MP if it is already running. + + * test.sh: Run Emacs in Screen. + 2006-10-20 Helmut Eller * swank-backend.lisp, swank-cmucl.lisp: From heller at common-lisp.net Sat Oct 21 10:31:50 2006 From: heller at common-lisp.net (heller) Date: Sat, 21 Oct 2006 06:31:50 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061021103150.99E1A61026@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17059 Modified Files: slime.el Log Message: (slime-execute-tests): Show the test name to the echo area. --- /project/slime/cvsroot/slime/slime.el 2006/10/20 11:07:57 1.673 +++ /project/slime/cvsroot/slime/slime.el 2006/10/21 10:31:50 1.674 @@ -9704,6 +9704,7 @@ (slime-test-heading 1 "%s" name) (dolist (input inputs) (incf slime-total-tests) + (message "%s: %s" name input) (slime-test-heading 2 "input: %s" input) (if slime-test-debug-on-error (let ((debug-on-error t) From mbaringer at common-lisp.net Thu Oct 26 08:51:29 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 04:51:29 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026085129.5BD583C005@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14220 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/21 09:30:20 1.980 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/26 08:51:29 1.981 @@ -1,3 +1,9 @@ +2006-10-26 Marco Baringer + + * slime.el (slime-global-variable-name-p): Use a custom 'parser' + instead of string-match to avoid regexp overflow errors on very + long strings. + 2006-10-21 Helmut Eller * swank-lispworks.lisp (initialize-multiprocessing): Don't init From mbaringer at common-lisp.net Thu Oct 26 08:52:48 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 04:52:48 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026085248.3A1763E002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14275 Modified Files: slime.el Log Message: (slime-global-variable-name-p): Use a custom 'parser' instead of string-match to avoid regexp overflow errors on very long strings. --- /project/slime/cvsroot/slime/slime.el 2006/10/21 10:31:50 1.674 +++ /project/slime/cvsroot/slime/slime.el 2006/10/26 08:52:47 1.675 @@ -5632,7 +5632,20 @@ (defun slime-global-variable-name-p (name) "Is NAME a global variable? Globals are recognised purely by *this-naming-convention*." - (string-match "^\\(.*::?\\)?[*+].*[*+]$" name)) + (when (<= (length name) 2) + (return-from slime-global-variable-name-p nil)) + (when (char-equal ?\: (aref name 0)) + (return-from slime-global-variable-name-p nil)) + (let ((package-prefix-end (cond + ((search "::" name) + (+ 2 (search "::" name))) + ((search ":" name) + (+ 1 (search ":" name))) + (t + 0)))) + (let ((first-char-in-name (aref name package-prefix-end))) + (and (member first-char-in-name '(?\* ?\+)) + (char-equal first-char-in-name (aref name (1- (length name)))))))) (defun slime-get-cached-autodoc (symbol-name) "Return the cached autodoc documentation for SYMBOL-NAME, or nil." From mbaringer at common-lisp.net Thu Oct 26 12:46:52 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 08:46:52 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026124652.9DF033C008@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13554 Modified Files: slime.el Log Message: (slime-setup-command-hooks): Use make-local-hook. (slime-repl-mode): Ditto. (slime-fuzzy-choices-buffer): Ditto. (sldb-mode): Ditto. (slime-fuzzy-completion-limit): New variable. (slime-fuzzy-completion-time-limit-in-msec): New variable. (slime-fuzzy-next): Fix when at the end of the buffer. (completion-output-symbol-converter): New to handle escaped symbols for those who need to mess around with symbols like layered-function-definers::|CONTEXTL::SLOT-VALUE-USING-LAYER|. When a symbol is escaped then completion is case sensitive. (completion-output-package-converter): New. (mimic-key-bindings): New to easily define bindings by first trying to look up bindings for an operation and only use the provided default bindings if nothing was found in the source keymap. Use it to set up fuzzy bindings. (Hint: if you have keys like previous-line customized, then only load slime after they have been set, and the fuzzy mode will mimic them.) (slime-temp-buffer-quit): Always close the opened window, updated docstring. Also made the fuzzy maps smarter, they now try to look up keys with 'where-is-internal and map the functions on them. --- /project/slime/cvsroot/slime/slime.el 2006/10/26 08:52:47 1.675 +++ /project/slime/cvsroot/slime/slime.el 2006/10/26 12:46:52 1.676 @@ -273,6 +273,17 @@ :group 'slime-mode :type 'boolean) +(defcustom slime-fuzzy-completion-limit 300 + "Only return and present this many symbols from swank." + :group 'slime-mode + :type 'integer) + +(defcustom slime-fuzzy-completion-time-limit-in-msec 1500 + "Limit the time spent (given in msec) in swank while gathering comletitions. +(NOTE: currently it's rounded up the nearest second)" + :group 'slime-mode + :type 'integer) + (defcustom slime-space-information-p t "Have the SPC key offer arglist information." :type 'boolean @@ -520,25 +531,43 @@ ;;;; Minor modes ;;;; slime-target-buffer-fuzzy-completions-mode ;;;; NOTE: this mode has to be able to override key mappings in slime-mode -(defvar slime-target-buffer-fuzzy-completions-map - (let* ((map (make-sparse-keymap))) - - (define-key map (kbd "C-g") 'slime-fuzzy-abort) - (define-key map (kbd "") 'slime-fuzzy-abort) - ;; the completion key - (define-key map "\t" 'slime-fuzzy-select-or-update-completions) +(defun mimic-key-bindings (from-keymap to-keymap bindings-or-operation operation) + "Iterate on BINDINGS-OR-OPERATION. If an element is a symbol then +try to look it up (as an operation) in FROM-KEYMAP. Non symbols are taken +as default key bindings when none to be mimiced was found in FROM-KEYMAP. +Set the resulting list of keys in TO-KEYMAP to OPERATION." + (let ((mimic-keys nil) + (direct-keys nil)) + (dolist (key-or-operation bindings-or-operation) + (if (symbolp key-or-operation) + (setf mimic-keys (append mimic-keys (where-is-internal key-or-operation from-keymap nil t))) + (push key-or-operation direct-keys))) + (dolist (key (or mimic-keys direct-keys)) + (define-key to-keymap key operation)))) - (dolist (key (list (kbd "") " " "(" ")" "[" "]")) - (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer)) +(defvar slime-target-buffer-fuzzy-completions-map + (let* ((map (make-sparse-keymap))) + (flet ((remap (keys to) + (mimic-key-bindings global-map map keys to))) + + (remap (list 'keyboard-quit (kbd "C-g")) 'slime-fuzzy-abort) - (define-key map (kbd "") 'slime-fuzzy-prev) - (define-key map (kbd "") 'slime-fuzzy-next) - (define-key map (where-is-internal 'isearch-forward global-map t t) - (lambda () - (interactive) - (select-window (get-buffer-window (slime-get-fuzzy-buffer))) - (call-interactively 'isearch-forward))) + (remap (list 'slime-fuzzy-indent-and-complete-symbol + 'slime-indent-and-complete-symbol + (kbd "")) + 'slime-fuzzy-select-or-update-completions) + (remap (list 'previous-line (kbd "")) 'slime-fuzzy-prev) + (remap (list 'next-line (kbd "")) 'slime-fuzzy-next) + (remap (list 'isearch-forward (kbd "C-s")) + (lambda () + (interactive) + (select-window (get-buffer-window (slime-get-fuzzy-buffer))) + (call-interactively 'isearch-forward))) + + ;; some unconditional direct bindings + (dolist (key (list (kbd "RET") (kbd "SPC") "(" ")" "[" "]")) + (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer))) map ) "Keymap for slime-target-buffer-fuzzy-completions-mode. This will override the key @@ -995,6 +1024,19 @@ (easy-menu-add slime-sldb-easy-menu 'sldb-mode-map))) +;;;; Emacs compatibility + +(or (fboundp 'add-local-hook) + (defun add-local-hook (hook function &optional append) + (make-local-hook hook) + (add-hook hook function append t))) + +(or (fboundp 'remove-local-hook) + (defun remove-local-hook (hook function) + (if (local-variable-p hook (current-buffer)) + (remove-hook hook function t)))) + + ;;;; Setup initial `slime-mode' hooks (make-variable-buffer-local @@ -1013,15 +1055,11 @@ (add-hook 'pre-command-hook 'slime-pre-command-hook))) (defun slime-setup-command-hooks () - "Setup a buffer-local `pre-command-h'ook' to call `slime-pre-command-hook'." - (make-local-hook 'pre-command-hook) - (make-local-hook 'post-command-hook) - ;; alanr: need local t - (add-hook 'pre-command-hook 'slime-pre-command-hook nil t) - (add-hook 'post-command-hook 'slime-post-command-hook nil t) + "Setup a buffer-local `pre-command-hook' to call `slime-pre-command-hook'." + (add-local-hook 'pre-command-hook 'slime-pre-command-hook) + (add-local-hook 'post-command-hook 'slime-post-command-hook) (when slime-repl-enable-presentations - (make-local-variable 'after-change-functions) - (add-hook 'after-change-functions 'slime-after-change-function nil t))) + (add-local-hook 'after-change-functions 'slime-after-change-function))) ;;;; Framework'ey bits @@ -1302,12 +1340,15 @@ ;; Interface (defun slime-temp-buffer-quit () - "Kill the current buffer and restore the old window configuration. -See `slime-temp-buffer-dismiss'." + "Kill the current (temp) buffer without asking. To restore the +window configuration without killing the buffer see +`slime-dismiss-temp-buffer'." (interactive) - (let ((buf (current-buffer))) - (slime-dismiss-temp-buffer) - (kill-buffer buf))) + (let* ((buffer (current-buffer)) + (window (get-buffer-window buffer))) + (kill-buffer buffer) + (when window + (delete-window window)))) ;; Interface (defun slime-dismiss-temp-buffer () @@ -3130,8 +3171,7 @@ (set (make-local-variable 'scroll-conservatively) 20) (set (make-local-variable 'scroll-margin) 0) (slime-repl-safe-load-history) - (make-local-hook 'kill-buffer-hook) - (add-hook 'kill-buffer-hook 'slime-repl-safe-save-merged-history nil t) + (add-local-hook 'kill-buffer-hook 'slime-repl-safe-save-merged-history) (add-hook 'kill-emacs-hook 'slime-repl-save-all-histories) (slime-setup-command-hooks) (when slime-use-autodoc-mode @@ -6164,32 +6204,34 @@ (defvar slime-fuzzy-completions-map (let* ((map (make-sparse-keymap))) + (flet ((remap (keys to) + (mimic-key-bindings global-map map keys to))) + (remap (list 'keyboard-quit (kbd "C-g")) 'slime-fuzzy-abort) + (define-key map "q" 'slime-fuzzy-abort) - (define-key map "q" 'slime-fuzzy-abort) - (define-key map (kbd "C-g") 'slime-fuzzy-abort) - (define-key map "\r" 'slime-fuzzy-select) + (remap (list 'previous-line (kbd "")) 'slime-fuzzy-prev) + (remap (list 'next-line (kbd "")) 'slime-fuzzy-next) - (define-key map "n" 'slime-fuzzy-next) - (define-key map "\M-n" 'slime-fuzzy-next) - (define-key map (kbd "") 'slime-fuzzy-next) + (define-key map "n" 'slime-fuzzy-next) + (define-key map "\M-n" 'slime-fuzzy-next) - (define-key map "p" 'slime-fuzzy-prev) - (define-key map "\M-p" 'slime-fuzzy-prev) - (define-key map (kbd "") 'slime-fuzzy-prev) + (define-key map "p" 'slime-fuzzy-prev) + (define-key map "\M-p" 'slime-fuzzy-prev) - - (define-key map "\d" 'scroll-down) - - ;; the completion key - (define-key map "\t" 'slime-fuzzy-select) + (define-key map "\d" 'scroll-down) - (dolist (key (list (kbd "") " ")) - (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer)) + (remap (list 'slime-fuzzy-indent-and-complete-symbol + 'slime-indent-and-complete-symbol + (kbd "")) + 'slime-fuzzy-select) - (define-key map [mouse-2] 'slime-fuzzy-select/mouse) + (define-key map (kbd "") 'slime-fuzzy-select/mouse)) + + (define-key map (kbd "RET") 'slime-fuzzy-select) + (define-key map (kbd "SPC") 'slime-fuzzy-select) map) - "Keymap for slime-fuzzy-completions-mode.") + "Keymap for slime-fuzzy-completions-mode when in the completion buffer.") (defun slime-fuzzy-completions (prefix &optional default-package) "Get the list of sorted completion objects from completing @@ -6200,7 +6242,9 @@ (slime-eval `(swank:fuzzy-completions ,prefix ,(or default-package (slime-find-buffer-package) - (slime-current-package)))))) + (slime-current-package)) + :limit ,slime-fuzzy-completion-limit + :time-limit-in-msec ,slime-fuzzy-completion-time-limit-in-msec)))) (defun slime-fuzzy-selected (prefix completion) "Tell the connected Lisp that the user selected completion @@ -6326,7 +6370,8 @@ done." (let ((new-completion-buffer (not slime-fuzzy-target-buffer))) (when new-completion-buffer - (slime-fuzzy-save-window-configuration)) + (slime-fuzzy-save-window-configuration) + (add-local-hook 'kill-buffer-hook 'slime-fuzzy-abort)) (slime-fuzzy-enable-target-buffer-completions-mode) (setq slime-fuzzy-target-buffer (current-buffer)) (setq slime-fuzzy-start (move-marker (make-marker) start)) @@ -6335,12 +6380,10 @@ (setq slime-fuzzy-original-text (buffer-substring start end)) (setq slime-fuzzy-text slime-fuzzy-original-text) (slime-fuzzy-fill-completions-buffer completions) - (when new-completion-buffer - (pop-to-buffer (slime-get-fuzzy-buffer)) - (add-hook 'kill-buffer-hook 'slime-fuzzy-abort nil t) - (when slime-fuzzy-completion-in-place - ;; switch back to the original buffer - (switch-to-buffer-other-window slime-fuzzy-target-buffer))))) + (pop-to-buffer (slime-get-fuzzy-buffer)) + (when slime-fuzzy-completion-in-place + ;; switch back to the original buffer + (switch-to-buffer-other-window slime-fuzzy-target-buffer)))) (defun slime-fuzzy-fill-completions-buffer (completions) "Erases and fills the completion buffer with the given completions." @@ -6411,6 +6454,8 @@ (with-current-buffer (slime-get-fuzzy-buffer) (slime-fuzzy-dehighlight-current-completion) (let ((point (next-single-char-property-change (point) 'completion))) + (when (= point (point-max)) + (setf point (previous-single-char-property-change (point-max) 'completion nil slime-fuzzy-first))) (set-window-point (get-buffer-window (current-buffer)) point) (goto-char point)) (slime-fuzzy-highlight-current-completion))) @@ -7900,8 +7945,7 @@ (slime-autodoc-mode 1)) ;; Make original slime-connection "sticky" for SLDB commands in this buffer (setq slime-buffer-connection (slime-connection)) - (make-local-variable 'kill-buffer-hook) - (add-hook 'kill-buffer-hook 'sldb-delete-overlays nil t)) + (add-local-hook 'kill-buffer-hook 'sldb-delete-overlays)) (defun sldb-help-summary () "Show summary of important sldb commands" From mbaringer at common-lisp.net Thu Oct 26 12:47:06 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 08:47:06 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026124706.0EE987C034@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13594 Modified Files: swank-sbcl.lisp Log Message: (make-weak-value-hash-table): New for sbcl. (make-weak-key-hash-table): New for sbcl. --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/19 12:30:51 1.168 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/26 12:47:05 1.169 @@ -1178,11 +1178,8 @@ ;;; Weak datastructures - -;; SBCL doesn't actually implement weak hash-tables, the WEAK-P -;; keyword is just a decoy. Leave this here, but commented out, -;; so that no-one tries adding it back. -#+(or) (defimplementation make-weak-key-hash-table (&rest args) - (apply #'make-hash-table :weak-p t args)) + (apply #'make-hash-table :weakness :key args)) +(defimplementation make-weak-value-hash-table (&rest args) + (apply #'make-hash-table :weakness :value args)) From mbaringer at common-lisp.net Thu Oct 26 12:47:15 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 08:47:15 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026124715.6CF9247002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13619 Modified Files: swank.lisp Log Message: (fuzzy-completions and friends): Added :limit and :time-limit-in-msec keyword params. Used vectors instead of lists that nearly doubled its speed (at least on sbcl). Also added some declare optimize and type annotations. (do-symbols*): New, uses a hash-table to visit only non-seen symbols. Replaced various uses of do-symbols where it was appropiate. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/20 17:07:55 1.410 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/26 12:47:15 1.411 @@ -384,6 +384,15 @@ (defun ascii-char-p (c) (<= (char-code c) 127)) +(defmacro do-symbols* ((var &optional (package '*package*) result-form) &body body) + "Just like do-symbols, but makes sure a symbol is visited only once." + (let ((seen-ht (gensym "SEEN-HT"))) + `(let ((,seen-ht (make-hash-table :test #'eq))) + (do-symbols (,var ,package ,result-form) + (unless (gethash ,var ,seen-ht) + (setf (gethash ,var ,seen-ht) t) + , at body))))) + ;;;; TCP Server @@ -2272,7 +2281,7 @@ (matching-keywords (find-matching-symbols-in-list keyword-name keywords #'compound-prefix-match)) - (converter (output-case-converter keyword-string)) + (converter (completion-output-symbol-converter keyword-string)) (strings (mapcar converter (mapcar #'symbol-name matching-keywords))) @@ -3106,41 +3115,40 @@ "Return the set of completion-candidates as strings." (multiple-value-bind (name package-name package internal-p) (parse-completion-arguments string default-package-name) - (let* ((symbols (and package - (find-matching-symbols name - package - (and (not internal-p) - package-name) - matchp))) - (packs (and (not package-name) - (find-matching-packages name matchp))) - (converter (output-case-converter name)) - (strings - (mapcar converter - (nconc (mapcar #'symbol-name symbols) packs)))) - (format-completion-set strings internal-p package-name)))) + (let* ((symbols (mapcar (completion-output-symbol-converter name) + (and package + (mapcar #'symbol-name + (find-matching-symbols name + package + (and (not internal-p) + package-name) + matchp))))) + (packs (mapcar (completion-output-package-converter name) + (and (not package-name) + (find-matching-packages name matchp))))) + (format-completion-set (nconc symbols packs) internal-p package-name)))) (defun find-matching-symbols (string package external test) "Return a list of symbols in PACKAGE matching STRING. TEST is called with two strings. If EXTERNAL is true, only external symbols are returned." (let ((completions '()) - (converter (output-case-converter string))) + (converter (completion-output-symbol-converter string))) (flet ((symbol-matches-p (symbol) (and (or (not external) (symbol-external-p symbol package)) (funcall test string (funcall converter (symbol-name symbol)))))) - (do-symbols (symbol package) + (do-symbols* (symbol package) (when (symbol-matches-p symbol) (push symbol completions)))) - (remove-duplicates completions))) + completions)) (defun find-matching-symbols-in-list (string list test) "Return a list of symbols in LIST matching STRING. TEST is called with two strings." (let ((completions '()) - (converter (output-case-converter string))) + (converter (completion-output-symbol-converter string))) (flet ((symbol-matches-p (symbol) (funcall test string (funcall converter (symbol-name symbol))))) @@ -3208,20 +3216,44 @@ (values (concatenate 'string prefix string) (length prefix)))) -(defun output-case-converter (input) - "Return a function to case convert strings for output. +(defun completion-output-case-converter (input &optional with-escaping-p) + "Return a function to convert strings for the completion output. INPUT is used to guess the preferred case." (ecase (readtable-case *readtable*) - (:upcase (if (some #'lower-case-p input) #'string-downcase #'identity)) + (:upcase (cond ((or with-escaping-p + (every #'upper-case-p input)) + #'identity) + (t #'string-downcase))) (:invert (lambda (output) (multiple-value-bind (lower upper) (determine-case output) (cond ((and lower upper) output) (lower (string-upcase output)) (upper (string-downcase output)) (t output))))) - (:downcase (if (some #'upper-case-p input) #'string-upcase #'identity)) + (:downcase (cond ((or with-escaping-p + (every #'lower-case-p input)) + #'identity) + (t #'string-upcase))) (:preserve #'identity))) +(defun completion-output-package-converter (input) + "Return a function to convert strings for the completion output. +INPUT is used to guess the preferred case." + (completion-output-case-converter input)) + +(defun completion-output-symbol-converter (input) + "Return a function to convert strings for the completion output. +INPUT is used to guess the preferred case. Escape symbols when needed." + (let ((case-converter (completion-output-case-converter input)) + (case-converter-with-escaping (completion-output-case-converter input t))) + (lambda (str) + (if (some (lambda (el) + (member el '(#\: #\. #\ #\Newline #\Tab))) + str) + (concatenate 'string "|" (funcall case-converter-with-escaping str) "|") + (funcall case-converter str))))) + + (defun determine-case (string) "Return two booleans LOWER and UPPER indicating whether STRING contains lower or upper case characters." @@ -3320,7 +3352,7 @@ ;;;; Fuzzy completion -(defslimefun fuzzy-completions (string default-package-name &optional limit) +(defslimefun fuzzy-completions (string default-package-name &key limit time-limit-in-msec) "Return an (optionally limited to LIMIT best results) list of fuzzy completions for a symbol designator STRING. The list will be sorted by score, most likely match first. @@ -3346,7 +3378,13 @@ FOO - Symbols accessible in the buffer package. PKG:FOO - Symbols external in package PKG. PKG::FOO - Symbols accessible in package PKG." - (fuzzy-completion-set string default-package-name limit)) + ;; We may send this as elisp [] arrays to spare a coerce here, + ;; but then the network serialization were slower by handling arrays. + ;; Instead we limit the number of completions that is transferred + ;; (the limit is set from emacs). + (coerce (fuzzy-completion-set string default-package-name + :limit limit :time-limit-in-msec time-limit-in-msec) + 'list)) (defun convert-fuzzy-completion-result (result converter internal-p package-name) @@ -3358,10 +3396,12 @@ (destructuring-bind (symbol-or-name score chunks) result (multiple-value-bind (name added-length) (format-completion-result - (funcall converter - (if (symbolp symbol-or-name) - (symbol-name symbol-or-name) - symbol-or-name)) + (if converter + (funcall converter + (if (symbolp symbol-or-name) + (symbol-name symbol-or-name) + symbol-or-name)) + symbol-or-name) internal-p package-name) (list name score (mapcar @@ -3395,66 +3435,94 @@ ))) collect flag))))) -(defun fuzzy-completion-set (string default-package-name &optional limit) +(defun fuzzy-completion-set (string default-package-name &key limit time-limit-in-msec) "Prepares list of completion obajects, sorted by SCORE, of fuzzy completions of STRING in DEFAULT-PACKAGE-NAME. If LIMIT is set, only the top LIMIT results will be returned." + (declare (type (or null (integer 0 #.(1- most-positive-fixnum))) limit time-limit-in-msec)) (multiple-value-bind (name package-name package internal-p) (parse-completion-arguments string default-package-name) - (let* ((symbols (and package - (fuzzy-find-matching-symbols name - package - (and (not internal-p) - package-name)))) - (packs (and (not package-name) - (fuzzy-find-matching-packages name))) - (converter (output-case-converter name)) - (results - (sort (mapcar #'(lambda (result) - (convert-fuzzy-completion-result - result converter internal-p package-name)) - (nconc symbols packs)) - #'> :key #'second))) - (when (and limit - (> limit 0) - (< limit (length results))) - (setf (cdr (nthcdr (1- limit) results)) nil)) - results))) + (flet ((convert (vector) + (loop for idx :upfrom 0 + while (< idx (length vector)) + for el = (aref vector idx) + do (setf (aref vector idx) (convert-fuzzy-completion-result + el nil internal-p package-name))))) + (let* ((symbols (and package + (fuzzy-find-matching-symbols name + package + (and (not internal-p) + package-name) + :time-limit-in-msec time-limit-in-msec + :return-converted-p t))) + (packs (and (not package-name) + (fuzzy-find-matching-packages name))) + (results)) + (convert symbols) + (convert packs) + (setf results (sort (concatenate 'vector symbols packs) #'> :key #'second)) + (when (and limit + (> limit 0) + (< limit (length results))) + (if (array-has-fill-pointer-p results) + (setf (fill-pointer results) limit) + (setf results (make-array limit :displaced-to results)))) + results)))) -(defun fuzzy-find-matching-symbols (string package external) +(defun fuzzy-find-matching-symbols (string package external &key time-limit-in-msec return-converted-p) "Return a list of symbols in PACKAGE matching STRING using the fuzzy completion algorithm. If EXTERNAL is true, only external symbols are returned." - (let ((completions '()) - (converter (output-case-converter string))) - (flet ((symbol-match (symbol) + (let ((completions (make-array 256 :adjustable t :fill-pointer 0)) + (time-limit (if time-limit-in-msec + (ceiling (/ time-limit-in-msec 1000)) + 0)) + (utime-at-start (get-universal-time)) + (count 0) + (converter (completion-output-symbol-converter string))) + (declare (type (integer 0 #.(1- most-positive-fixnum)) count time-limit) + (type function converter)) + (flet ((symbol-match (symbol converted) (and (or (not external) (symbol-external-p symbol package)) - (compute-highest-scoring-completion - string (funcall converter (symbol-name symbol)))))) - (do-symbols (symbol package) - (if (string= "" string) - (when (or (and external (symbol-external-p symbol package)) - (not external)) - (push (list symbol 0.0 (list (list 0 ""))) completions)) - (multiple-value-bind (result score) (symbol-match symbol) - (when result - (push (list symbol score result) completions)))))) - (remove-duplicates completions :key #'first))) + (compute-highest-scoring-completion + string converted)))) + (block loop + (do-symbols* (symbol package) + (incf count) + (when (and (not (zerop time-limit)) + (zerop (mod count 256)) ; ease up on calling get-universal-time like crazy + (>= (- (get-universal-time) utime-at-start) time-limit)) + (return-from loop)) + (let* ((converted (funcall converter (symbol-name symbol))) + (result (if return-converted-p converted symbol))) + (if (string= "" string) + (when (or (and external (symbol-external-p symbol package)) + (not external)) + (vector-push-extend (list result 0.0 (list (list 0 ""))) completions)) + (multiple-value-bind (match-result score) (symbol-match symbol converted) + (when match-result + (vector-push-extend (list result score match-result) completions))))))) + completions))) (defun fuzzy-find-matching-packages (name) "Return a list of package names matching NAME using the fuzzy completion algorithm." - (let ((converter (output-case-converter name))) + (let ((converter (completion-output-package-converter name)) + (completions (make-array 32 :adjustable t :fill-pointer 0))) + (declare (optimize (speed 3)) + (type function converter)) (loop for package in (list-all-packages) for package-name = (concatenate 'string (funcall converter (package-name package)) ":") for (result score) = (multiple-value-list - (compute-highest-scoring-completion - name package-name)) - if result collect (list package-name score result)))) + (compute-highest-scoring-completion + name package-name)) + when result do + (vector-push-extend (list package-name score result) completions)) + completions)) (defslimefun fuzzy-completion-selected (original-string completion) "This function is called by Slime when a fuzzy completion is From mbaringer at common-lisp.net Thu Oct 26 12:47:32 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 08:47:32 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026124732.CB1FD4E00E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13644 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/26 08:51:29 1.981 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/26 12:47:32 1.982 @@ -1,3 +1,41 @@ +2006-10-26 Attila Lendvai + + * slime.el (slime-setup-command-hooks): Use make-local-hook. + (slime-repl-mode): Ditto. + (slime-fuzzy-choices-buffer): Ditto. + (sldb-mode): Ditto. + (slime-fuzzy-completion-limit): New variable. + (slime-fuzzy-completion-time-limit-in-msec): New variable. + (slime-fuzzy-next): Fix when at the end of the buffer. + (completion-output-symbol-converter): New to handle escaped + symbols for those who need to mess around with symbols like + layered-function-definers::|CONTEXTL::SLOT-VALUE-USING-LAYER|. + When a symbol is escaped then completion is case sensitive. + (completion-output-package-converter): New. + (mimic-key-bindings): New to easily define bindings by first + trying to look up bindings for an operation and only use + the provided default bindings if nothing was found in the + source keymap. Use it to set up fuzzy bindings. (Hint: + if you have keys like previous-line customized, then only + load slime after they have been set, and the fuzzy mode + will mimic them.) + (slime-temp-buffer-quit): Always close the opened window, + updated docstring. + Also made the fuzzy maps smarter, they now try to look up + keys with 'where-is-internal and map the functions on them. + + * swank-sbcl.lisp + (make-weak-value-hash-table): New for sbcl. + (make-weak-key-hash-table): New for sbcl. + + * swank.lisp (fuzzy-completions and friends): Added :limit + and :time-limit-in-msec keyword params. Used vectors instead + of lists that nearly doubled its speed (at least on sbcl). + Also added some declare optimize and type annotations. + (do-symbols*): New, uses a hash-table to visit only non-seen + symbols. Replaced various uses of do-symbols where it was + appropiate. + 2006-10-26 Marco Baringer * slime.el (slime-global-variable-name-p): Use a custom 'parser' @@ -47,7 +85,7 @@ slime-fuzzy-completions-map and slime-target-buffer-fuzzy-completions-map for details. - * slime.el (slime-space-information-p): New variable. + * slime.el (slime-fuzzy-completion-in-place): New variable. (slime-target-buffer-fuzzy-completions-mode): New keymap for in-place fuzzy completions. (slime-fuzzy-target-buffer-completions-mode): New minor mode for From mbaringer at common-lisp.net Thu Oct 26 12:50:25 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 08:50:25 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026125025.2F5B461034@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13811 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/26 12:47:32 1.982 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/26 12:50:25 1.983 @@ -1,40 +1,38 @@ 2006-10-26 Attila Lendvai - * slime.el (slime-setup-command-hooks): Use make-local-hook. - (slime-repl-mode): Ditto. - (slime-fuzzy-choices-buffer): Ditto. - (sldb-mode): Ditto. - (slime-fuzzy-completion-limit): New variable. - (slime-fuzzy-completion-time-limit-in-msec): New variable. - (slime-fuzzy-next): Fix when at the end of the buffer. - (completion-output-symbol-converter): New to handle escaped - symbols for those who need to mess around with symbols like - layered-function-definers::|CONTEXTL::SLOT-VALUE-USING-LAYER|. - When a symbol is escaped then completion is case sensitive. - (completion-output-package-converter): New. - (mimic-key-bindings): New to easily define bindings by first - trying to look up bindings for an operation and only use - the provided default bindings if nothing was found in the - source keymap. Use it to set up fuzzy bindings. (Hint: - if you have keys like previous-line customized, then only - load slime after they have been set, and the fuzzy mode - will mimic them.) - (slime-temp-buffer-quit): Always close the opened window, - updated docstring. - Also made the fuzzy maps smarter, they now try to look up - keys with 'where-is-internal and map the functions on them. + * slime.el (slime-setup-command-hooks): Use make-local-hook. + (slime-repl-mode): Ditto. + (slime-fuzzy-choices-buffer): Ditto. + (sldb-mode): Ditto. + (slime-fuzzy-completion-limit): New variable. + (slime-fuzzy-completion-time-limit-in-msec): New variable. + (slime-fuzzy-next): Fix when at the end of the buffer. + (completion-output-symbol-converter): New to handle escaped + symbols for those who need to mess around with symbols like + layered-function-definers::|CONTEXTL::SLOT-VALUE-USING-LAYER|. + When a symbol is escaped then completion is case sensitive. + (completion-output-package-converter): New. + (mimic-key-bindings): New to easily define bindings by first + trying to look up bindings for an operation and only use the + provided default bindings if nothing was found in the source + keymap. Use it to set up fuzzy bindings. (Hint: if you have keys + like previous-line customized, then only load slime after they + have been set, and the fuzzy mode will mimic them.) + (slime-temp-buffer-quit): Always close the opened window, updated + docstring. Also made the fuzzy maps smarter, they now try to look + up keys with 'where-is-internal and map the functions on them. - * swank-sbcl.lisp - (make-weak-value-hash-table): New for sbcl. - (make-weak-key-hash-table): New for sbcl. + * swank-sbcl.lisp + (make-weak-value-hash-table): New for sbcl. + (make-weak-key-hash-table): New for sbcl. - * swank.lisp (fuzzy-completions and friends): Added :limit - and :time-limit-in-msec keyword params. Used vectors instead - of lists that nearly doubled its speed (at least on sbcl). - Also added some declare optimize and type annotations. - (do-symbols*): New, uses a hash-table to visit only non-seen - symbols. Replaced various uses of do-symbols where it was - appropiate. + * swank.lisp (fuzzy-completions and friends): Added :limit and + :time-limit-in-msec keyword params. Used vectors instead of lists + that nearly doubled its speed (at least on sbcl). Also added some + declare optimize and type annotations. + (do-symbols*): New, uses a hash-table to visit only non-seen + symbols. Replaced various uses of do-symbols where it was + appropiate. 2006-10-26 Marco Baringer From mbaringer at common-lisp.net Thu Oct 26 13:38:08 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 26 Oct 2006 09:38:08 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026133808.19D232B147@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv18401 Modified Files: slime.el Log Message: fix xemacs problems in previous commit --- /project/slime/cvsroot/slime/slime.el 2006/10/26 12:46:52 1.676 +++ /project/slime/cvsroot/slime/slime.el 2006/10/26 13:38:07 1.677 @@ -566,7 +566,7 @@ (call-interactively 'isearch-forward))) ;; some unconditional direct bindings - (dolist (key (list (kbd "RET") (kbd "SPC") "(" ")" "[" "]")) + (dolist (key (list (kbd "RET") (kbd "") "(" ")" "[" "]")) (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer))) map ) @@ -6228,7 +6228,7 @@ (define-key map (kbd "") 'slime-fuzzy-select/mouse)) (define-key map (kbd "RET") 'slime-fuzzy-select) - (define-key map (kbd "SPC") 'slime-fuzzy-select) + (define-key map (kbd "") 'slime-fuzzy-select) map) "Keymap for slime-fuzzy-completions-mode when in the completion buffer.") @@ -6370,8 +6370,7 @@ done." (let ((new-completion-buffer (not slime-fuzzy-target-buffer))) (when new-completion-buffer - (slime-fuzzy-save-window-configuration) - (add-local-hook 'kill-buffer-hook 'slime-fuzzy-abort)) + (slime-fuzzy-save-window-configuration)) (slime-fuzzy-enable-target-buffer-completions-mode) (setq slime-fuzzy-target-buffer (current-buffer)) (setq slime-fuzzy-start (move-marker (make-marker) start)) @@ -6381,6 +6380,8 @@ (setq slime-fuzzy-text slime-fuzzy-original-text) (slime-fuzzy-fill-completions-buffer completions) (pop-to-buffer (slime-get-fuzzy-buffer)) + (when new-completion-buffer + (add-local-hook 'kill-buffer-hook 'slime-fuzzy-abort)) (when slime-fuzzy-completion-in-place ;; switch back to the original buffer (switch-to-buffer-other-window slime-fuzzy-target-buffer)))) From mkoeppe at common-lisp.net Thu Oct 26 16:50:03 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Thu, 26 Oct 2006 12:50:03 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026165003.65CCA46125@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11122 Modified Files: swank-allegro.lisp Log Message: (sldb-break-at-start): Implement. Patch from Utz-Uwe Haus. --- /project/slime/cvsroot/slime/swank-allegro.lisp 2006/10/20 00:15:15 1.91 +++ /project/slime/cvsroot/slime/swank-allegro.lisp 2006/10/26 16:50:03 1.92 @@ -141,6 +141,15 @@ (excl::*break-hook* nil)) (funcall debugger-loop-fn))) +(defimplementation sldb-break-at-start (fname) + ;; :print-before is kind of mis-used but we just want to stuff our break form + ;; somewhere. This does not work for setf, :before and :after methods, which + ;; need special syntax in the trace call, see ACL's doc/debugging.htm chapter 10. + (eval `(trace (,fname + :print-before + ((break "Function start breakpoint of ~A" ',fname))))) + `(:ok ,(format nil "Set breakpoint at start of ~S" fname))) + (defun find-topframe () (let ((skip-frames 3)) (do ((f (excl::int-newest-frame) (next-frame f)) From mkoeppe at common-lisp.net Thu Oct 26 16:51:41 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Thu, 26 Oct 2006 12:51:41 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061026165141.A097D4B009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11214 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/26 12:50:25 1.983 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/26 16:51:41 1.984 @@ -1,3 +1,7 @@ +2006-10-26 Utz-Uwe Haus + + * swank-allegro.lisp (sldb-break-at-start): Implement. + 2006-10-26 Attila Lendvai * slime.el (slime-setup-command-hooks): Use make-local-hook. From nsiivola at common-lisp.net Fri Oct 27 06:24:26 2006 From: nsiivola at common-lisp.net (nsiivola) Date: Fri, 27 Oct 2006 02:24:26 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061027062426.50C424F011@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv2635 Modified Files: ChangeLog swank-sbcl.lisp Log Message: Restore support for pre 0.9.17 SBCL --- /project/slime/cvsroot/slime/ChangeLog 2006/10/26 16:51:41 1.984 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/27 06:24:26 1.985 @@ -1,3 +1,9 @@ +2006-10-27 Nikodemus Siivola + + * swank-sbcl (make-weak-key-hash-table): Restore support + for older SBCLs without weak hash-tables. + (make-weak-value-hash-table): Ditto. + 2006-10-26 Utz-Uwe Haus * swank-allegro.lisp (sldb-break-at-start): Implement. --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/26 12:47:05 1.169 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/10/27 06:24:26 1.170 @@ -30,6 +30,11 @@ (defun sbcl-with-new-stepper-p () (if (find-symbol "ENABLE-STEPPING" "SB-IMPL") '(and) + '(or))) + ;; Ditto for weak hash-tables + (defun sbcl-with-weak-hash-tables () + (if (find-symbol "HASH-TABLE-WEAKNESS" "SB-EXT") + '(and) '(or)))) ;;; swank-mop @@ -1178,8 +1183,14 @@ ;;; Weak datastructures -(defimplementation make-weak-key-hash-table (&rest args) - (apply #'make-hash-table :weakness :key args)) +(defimplementation make-weak-key-hash-table (&rest args) + #+#.(swank-backend::sbcl-with-weak-hash-tables) + (apply #'make-hash-table :weakness :key args) + #-#.(swank-backend::sbcl-with-weak-hash-tables) + (apply #'make-hash-table args)) (defimplementation make-weak-value-hash-table (&rest args) - (apply #'make-hash-table :weakness :value args)) + #+#.(swank-backend::sbcl-with-weak-hash-tables) + (apply #'make-hash-table :weakness :value args) + #-#.(swank-backend::sbcl-with-weak-hash-tables) + (apply #'make-hash-table args)) From nsiivola at common-lisp.net Fri Oct 27 09:22:58 2006 From: nsiivola at common-lisp.net (nsiivola) Date: Fri, 27 Oct 2006 05:22:58 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061027092258.C10713000C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26043 Modified Files: hyperspec.el Log Message: Hyperspec links for ~% and ~& --- /project/slime/cvsroot/slime/hyperspec.el 2006/03/28 00:30:31 1.8 +++ /project/slime/cvsroot/slime/hyperspec.el 2006/10/27 09:22:58 1.9 @@ -1205,6 +1205,8 @@ (pushnew (cadr entry) (symbol-value symbol) :test 'equal) (set symbol (cdr entry)))))) '(("c" (22 3 1 1)) ("C: Character" (22 3 1 1)) + ("%" (22 3 1 2)) ("Percent: Newline" (22 3 1 2)) + ("&" (22 3 1 3)) ("Ampersand: Fresh-line" (22 3 1 3)) ("r" (22 3 2 1)) ("R: Radix" (22 3 2 1)) ("d" (22 3 2 2)) ("D: Decimal" (22 3 2-2)) ("b" (22 3 2 3)) ("B: Binary" (22 3 2 3)) From nsiivola at common-lisp.net Sat Oct 28 08:44:41 2006 From: nsiivola at common-lisp.net (nsiivola) Date: Sat, 28 Oct 2006 04:44:41 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061028084441.8ABC95B067@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8026 Modified Files: ChangeLog hyperspec.el Log Message: Missing Hyperspec links for ~| and ~~ --- /project/slime/cvsroot/slime/ChangeLog 2006/10/27 09:22:32 1.986 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/28 08:44:41 1.987 @@ -1,3 +1,7 @@ +2006-10-28 Ivan Toshkov + + * hyperspec.el: Missing Hyperspec links for ~| and ~~ + 2006-10-27 Ivan Toshkov * hyperspec.el: Missing Hyperspec links for ~% and ~& --- /project/slime/cvsroot/slime/hyperspec.el 2006/10/27 09:22:58 1.9 +++ /project/slime/cvsroot/slime/hyperspec.el 2006/10/28 08:44:41 1.10 @@ -1207,6 +1207,8 @@ '(("c" (22 3 1 1)) ("C: Character" (22 3 1 1)) ("%" (22 3 1 2)) ("Percent: Newline" (22 3 1 2)) ("&" (22 3 1 3)) ("Ampersand: Fresh-line" (22 3 1 3)) + ("|" (22 3 1 4)) ("Vertical-Bar: Page" (22 3 1 4)) + ("~" (22 3 1 5)) ("Tilde: Tilde" (22 3 1 5)) ("r" (22 3 2 1)) ("R: Radix" (22 3 2 1)) ("d" (22 3 2 2)) ("D: Decimal" (22 3 2-2)) ("b" (22 3 2 3)) ("B: Binary" (22 3 2 3)) From mkoeppe at common-lisp.net Sat Oct 28 17:41:43 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 28 Oct 2006 13:41:43 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061028174143.D9C6D4C00B@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28828 Modified Files: swank-backend.lisp Log Message: (character-completion-set): New interface. --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/20 17:07:55 1.107 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/10/28 17:41:41 1.108 @@ -953,3 +953,15 @@ (definterface make-weak-value-hash-table (&rest args) "Like MAKE-HASH-TABLE, but weak w.r.t. the values." (apply #'make-hash-table args)) + + +;;;; Character names + +(definterface character-completion-set (prefix matchp) + "Return a list of names of characters that match PREFIX." + ;; Handle the standard and semi-standard characters. + (loop for name in '("Newline" "Space" "Tab" "Page" "Rubout" + "Linefeed" "Return" "Backspace") + when (funcall matchp prefix name) + collect name)) + From mkoeppe at common-lisp.net Sat Oct 28 17:41:57 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 28 Oct 2006 13:41:57 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061028174157.4E2D05538C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28908 Modified Files: swank-allegro.lisp Log Message: (character-completion-set): Implement it. --- /project/slime/cvsroot/slime/swank-allegro.lisp 2006/10/26 16:50:03 1.92 +++ /project/slime/cvsroot/slime/swank-allegro.lisp 2006/10/28 17:41:57 1.93 @@ -769,3 +769,11 @@ (defimplementation make-weak-value-hash-table (&rest args) (apply #'make-hash-table :values :weak args)) + + +;;;; Character names + +(defimplementation character-completion-set (prefix matchp) + (loop for name being the hash-keys of excl::*name-to-char-table* + when (funcall matchp prefix name) + collect (string-capitalize name))) From mkoeppe at common-lisp.net Sat Oct 28 17:42:19 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 28 Oct 2006 13:42:19 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061028174219.3E4525903D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv28971 Modified Files: swank.lisp Log Message: (completions-for-character): New slimefun. (compound-prefix-match/ci/underscores) (longest-completion/underscores, tokenize-completion/underscores) (untokenize-completion/underscores): New functions. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/26 12:47:15 1.411 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/28 17:42:19 1.412 @@ -3750,6 +3750,48 @@ max-len (highlight-completion result sym) score result)))) +;;;; Completion for character names + +(defslimefun completions-for-character (prefix) + (let ((completion-set + (sort + (character-completion-set prefix + #'compound-prefix-match/ci/underscores) + #'string<))) + (list completion-set (longest-completion/underscores completion-set)))) + +(defun compound-prefix-match/ci/underscores (prefix target) + "Like compound-prefix-match, but case-insensitive, and using the underscore, +not the hyphen, as a delimiter." + (declare (type simple-string prefix target)) + (loop for ch across prefix + with tpos = 0 + always (and (< tpos (length target)) + (if (char= ch #\_) + (setf tpos (position #\_ target :start tpos)) + (char-equal ch (aref target tpos)))) + do (incf tpos))) + +(defun longest-completion/underscores (completions) + "Return the longest prefix for all COMPLETIONS. +COMPLETIONS is a list of strings." + (untokenize-completion/underscores + (mapcar #'longest-common-prefix + (transpose-lists (mapcar #'tokenize-completion/underscores + completions))))) + +(defun tokenize-completion/underscores (string) + "Return all substrings of STRING delimited by #\_." + (loop with end + for start = 0 then (1+ end) + until (> start (length string)) + do (setq end (or (position #\_ string :start start) (length string))) + collect (subseq string start end))) + +(defun untokenize-completion/underscores (tokens) + (format nil "~{~A~^_~}" tokens)) + + ;;;; Documentation (defslimefun apropos-list-for-emacs (name &optional external-only From mkoeppe at common-lisp.net Sat Oct 28 17:43:28 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 28 Oct 2006 13:43:28 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061028174328.3E1AC5F009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv29103 Modified Files: slime.el Log Message: (slime-completions-for-character): New. (slime-contextual-completions): Use it here. --- /project/slime/cvsroot/slime/slime.el 2006/10/26 13:38:07 1.677 +++ /project/slime/cvsroot/slime/slime.el 2006/10/28 17:43:28 1.678 @@ -6130,7 +6130,8 @@ "Return a list of completions of the token from BEG to END in the current buffer." (let ((token (buffer-substring-no-properties beg end))) - (when (and (< beg (point-max)) + (cond + ((and (< beg (point-max)) (string= (buffer-substring-no-properties beg (1+ beg)) ":")) ;; Contextual keyword completion (multiple-value-bind (operator-names arg-indices) @@ -6146,8 +6147,13 @@ ;; If no matching keyword was found, do regular symbol ;; completion. )))) + ((and (> beg 2) + (string= (buffer-substring-no-properties (- beg 2) beg) "#\\")) + ;; Character name completion + (return-from slime-contextual-completions + (slime-completions-for-character token)))) ;; Regular symbol completion - (slime-completions (buffer-substring-no-properties beg end)))) + (slime-completions token))) (defun slime-completions (prefix) (slime-eval `(swank:completions ,prefix ',(slime-current-package)))) @@ -6161,6 +6167,9 @@ ,prefix ',arg-indices))) +(defun slime-completions-for-character (prefix) + (slime-eval `(swank:completions-for-character ,prefix))) + ;;;; Fuzzy completion From mkoeppe at common-lisp.net Sat Oct 28 17:43:40 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 28 Oct 2006 13:43:40 -0400 (EDT) Subject: [slime-cvs] CVS slime Message-ID: <20061028174340.C67376102F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv29151 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/28 08:44:41 1.987 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/28 17:43:40 1.988 @@ -1,3 +1,19 @@ +2006-10-28 Matthias Koeppe + + Add completion for character names. + + * slime.el (slime-completions-for-character): New. + (slime-contextual-completions): Use it here. + + * swank-backend.lisp (character-completion-set): New interface. + + * swank-allegro.lisp (character-completion-set): Implement it. + + * swank.lisp (completions-for-character): New slimefun. + (compound-prefix-match/ci/underscores) + (longest-completion/underscores, tokenize-completion/underscores) + (untokenize-completion/underscores): New functions. + 2006-10-28 Ivan Toshkov * hyperspec.el: Missing Hyperspec links for ~| and ~~ From heller at common-lisp.net Sun Oct 29 07:11:50 2006 From: heller at common-lisp.net (heller) Date: Sun, 29 Oct 2006 02:11:50 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061029071150.C633B710EC@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11203 Modified Files: slime.el Log Message: (slime-global-variable-name-p): Simplified. --- /project/slime/cvsroot/slime/slime.el 2006/10/28 17:43:28 1.678 +++ /project/slime/cvsroot/slime/slime.el 2006/10/29 07:11:50 1.679 @@ -5672,20 +5672,7 @@ (defun slime-global-variable-name-p (name) "Is NAME a global variable? Globals are recognised purely by *this-naming-convention*." - (when (<= (length name) 2) - (return-from slime-global-variable-name-p nil)) - (when (char-equal ?\: (aref name 0)) - (return-from slime-global-variable-name-p nil)) - (let ((package-prefix-end (cond - ((search "::" name) - (+ 2 (search "::" name))) - ((search ":" name) - (+ 1 (search ":" name))) - (t - 0)))) - (let ((first-char-in-name (aref name package-prefix-end))) - (and (member first-char-in-name '(?\* ?\+)) - (char-equal first-char-in-name (aref name (1- (length name)))))))) + (string-match "^\\(.*:\\)?\\([*+]\\).+\\2$" name)) (defun slime-get-cached-autodoc (symbol-name) "Return the cached autodoc documentation for SYMBOL-NAME, or nil." From heller at common-lisp.net Sun Oct 29 07:13:00 2006 From: heller at common-lisp.net (heller) Date: Sun, 29 Oct 2006 02:13:00 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061029071300.840617431E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11253 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/28 17:43:40 1.988 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/29 07:13:00 1.989 @@ -1,3 +1,7 @@ +2006-10-29 Helmut Eller + + * slime.el (slime-global-variable-name-p): Simplified. + 2006-10-28 Matthias Koeppe Add completion for character names. From mbaringer at common-lisp.net Sun Oct 29 10:14:40 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Sun, 29 Oct 2006 05:14:40 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061029101440.09DB62B139@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30401 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/29 07:13:00 1.989 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/29 10:14:40 1.990 @@ -1,3 +1,8 @@ +2006-10-29 Attila Lendvai + + * slime.el (slime-global-variable-name-p): Use defun* instead of + defun. + 2006-10-29 Helmut Eller * slime.el (slime-global-variable-name-p): Simplified. From mbaringer at common-lisp.net Sun Oct 29 10:15:09 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Sun, 29 Oct 2006 05:15:09 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061029101509.91B4F3E004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30513 Modified Files: slime.el Log Message: (slime-global-variable-name-p): Use defun* instead of defun. --- /project/slime/cvsroot/slime/slime.el 2006/10/29 07:11:50 1.679 +++ /project/slime/cvsroot/slime/slime.el 2006/10/29 10:15:09 1.680 @@ -5669,7 +5669,7 @@ (when-let (name (slime-symbol-name-at-point)) (if (slime-global-variable-name-p name) name))) -(defun slime-global-variable-name-p (name) +(defun* slime-global-variable-name-p (name) "Is NAME a global variable? Globals are recognised purely by *this-naming-convention*." (string-match "^\\(.*:\\)?\\([*+]\\).+\\2$" name)) From heller at common-lisp.net Mon Oct 30 13:59:24 2006 From: heller at common-lisp.net (heller) Date: Mon, 30 Oct 2006 08:59:24 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030135924.B81F74C3E8@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6464 Modified Files: slime.el Log Message: (slime-global-variable-name-p): Oops... need to handle very long strings. --- /project/slime/cvsroot/slime/slime.el 2006/10/29 10:15:09 1.680 +++ /project/slime/cvsroot/slime/slime.el 2006/10/30 13:59:24 1.681 @@ -5669,10 +5669,11 @@ (when-let (name (slime-symbol-name-at-point)) (if (slime-global-variable-name-p name) name))) -(defun* slime-global-variable-name-p (name) +(defun slime-global-variable-name-p (name) "Is NAME a global variable? Globals are recognised purely by *this-naming-convention*." - (string-match "^\\(.*:\\)?\\([*+]\\).+\\2$" name)) + (and (< (length name) 80) ; avoid overflows in regexp matcher + (string-match "^\\(.*:\\)?\\([*+]\\).+\\2$" name))) (defun slime-get-cached-autodoc (symbol-name) "Return the cached autodoc documentation for SYMBOL-NAME, or nil." From heller at common-lisp.net Mon Oct 30 13:59:32 2006 From: heller at common-lisp.net (heller) Date: Mon, 30 Oct 2006 08:59:32 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030135932.DED954E001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6525 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/10/29 10:14:40 1.990 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/30 13:59:32 1.991 @@ -1,3 +1,8 @@ +2006-10-30 Helmut Eller + + * slime.el (slime-global-variable-name-p): Oops... need to handle + very long strings. + 2006-10-29 Attila Lendvai * slime.el (slime-global-variable-name-p): Use defun* instead of From mbaringer at common-lisp.net Mon Oct 30 14:57:48 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 30 Oct 2006 09:57:48 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030145748.AA3665400F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17164 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/30 13:59:32 1.991 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/30 14:57:48 1.992 @@ -1,3 +1,8 @@ +2006-10-30 Marco Baringer + + * slime.el (slime-global-variable-name-regexp): New variable. + (slime-global-variable-name-p): Use slime-global-variable-name-regexp. + 2006-10-30 Helmut Eller * slime.el (slime-global-variable-name-p): Oops... need to handle From mbaringer at common-lisp.net Mon Oct 30 14:59:25 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 30 Oct 2006 09:59:25 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030145925.8401E5400F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17319 Modified Files: slime.el Log Message: (slime-global-variable-name-regexp): New variable. (slime-global-variable-name-p): Use slime-global-variable-name-regexp. --- /project/slime/cvsroot/slime/slime.el 2006/10/30 13:59:24 1.681 +++ /project/slime/cvsroot/slime/slime.el 2006/10/30 14:59:25 1.682 @@ -5669,11 +5669,18 @@ (when-let (name (slime-symbol-name-at-point)) (if (slime-global-variable-name-p name) name))) +(defcustom slime-global-variable-name-regexp "^\\(.*:\\)?\\([*+]\\).+\\2$" + "Regexp used to check if a symbol name is a global variable. + +Default value assumes +this+ or *that* naming conventions." + :type 'regexp + :group 'slime) + (defun slime-global-variable-name-p (name) "Is NAME a global variable? Globals are recognised purely by *this-naming-convention*." (and (< (length name) 80) ; avoid overflows in regexp matcher - (string-match "^\\(.*:\\)?\\([*+]\\).+\\2$" name))) + (string-match slime-global-variable-name-regexp name))) (defun slime-get-cached-autodoc (symbol-name) "Return the cached autodoc documentation for SYMBOL-NAME, or nil." From mbaringer at common-lisp.net Mon Oct 30 16:24:50 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 30 Oct 2006 11:24:50 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030162450.3784B1A09F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv29974 Modified Files: slime.el Log Message: (slime-global-variable-name-regexp): New variable. (slime-global-variable-name-p): Use slime-global-variable-name-regexp. ("swank-version"): Load swank-version.el to get the wire protocol version. (slime-set-connection-info): Check the wire protocol version. --- /project/slime/cvsroot/slime/slime.el 2006/10/30 14:59:25 1.682 +++ /project/slime/cvsroot/slime/slime.el 2006/10/30 16:24:49 1.683 @@ -64,6 +64,8 @@ (require 'overlay)) (require 'easymenu) +(load "swank-version") + (defvar slime-use-autodoc-mode nil "When non-nil always enable slime-autodoc-mode in slime-mode.") @@ -2254,7 +2256,12 @@ "Initialize CONNECTION with INFO received from Lisp." (let ((slime-dispatching-connection connection)) (destructuring-bind (&key pid style lisp-implementation machine - features package) info + features package wire-protocol-version) + info + (assert (eql wire-protocol-version *swank-wire-protocol-version*) + nil + "Version mismatch. slime.el expects %S but swank.lisp uses %S, please reload." + *swank-wire-protocol-version* wire-protocol-version) (setf (slime-pid) pid (slime-communication-style) style (slime-lisp-features) features) From mbaringer at common-lisp.net Mon Oct 30 16:25:09 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 30 Oct 2006 11:25:09 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030162509.AAEC01F009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30090 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/10/30 14:57:48 1.992 +++ /project/slime/cvsroot/slime/ChangeLog 2006/10/30 16:25:09 1.993 @@ -1,7 +1,19 @@ 2006-10-30 Marco Baringer + * swank.lisp (*dont-close*): New variable. + (defpackage :swank): Export *dont-close*. + (start-server, create-server): Use *dont-close* as the default + value of the :dont-close parameter. + (connection-info): Send the wire-protocol-version (supplied by the + swank-version.el file) to slime when connecting. + (wire-protocol-version): New function. + * slime.el (slime-global-variable-name-regexp): New variable. - (slime-global-variable-name-p): Use slime-global-variable-name-regexp. + (slime-global-variable-name-p): Use + slime-global-variable-name-regexp. + ("swank-version"): Load swank-version.el to get the wire protocol + version. + (slime-set-connection-info): Check the wire protocol version. 2006-10-30 Helmut Eller From mbaringer at common-lisp.net Mon Oct 30 16:25:18 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 30 Oct 2006 11:25:18 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030162518.465E42B139@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30117 Added Files: swank-version.el Log Message: --- /project/slime/cvsroot/slime/swank-version.el 2006/10/30 16:25:18 NONE +++ /project/slime/cvsroot/slime/swank-version.el 2006/10/30 16:25:18 1.1 ;;; This is the value for *swank-wire-protocol-version*. NB: This file ;;; will be loaded by BOTH emacs and lisp, so the syntax used must ;;; remain compatable between the two dialects. You can assume that ;;; cl:*package* will be bound to (find-package :SWANK). (setf *swank-wire-protocol-version* 1) From mbaringer at common-lisp.net Mon Oct 30 16:25:28 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 30 Oct 2006 11:25:28 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061030162528.C9A1C30018@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30137 Modified Files: swank.lisp Log Message: (*dont-close*): New variable. (defpackage :swank): Export *dont-close*. (start-server, create-server): Use *dont-close* as the default value of the :dont-close parameter. (connection-info): Send the wire-protocol-version (supplied by the swank-version.el file) to slime when connecting. (wire-protocol-version): New function. --- /project/slime/cvsroot/slime/swank.lisp 2006/10/28 17:42:19 1.412 +++ /project/slime/cvsroot/slime/swank.lisp 2006/10/30 16:25:28 1.413 @@ -24,6 +24,7 @@ #:run-after-init-hook ;; These are user-configurable variables: #:*communication-style* + #:*dont-close* #:*log-events* #:*log-output* #:*use-dedicated-output-stream* @@ -405,13 +406,18 @@ (defvar *communication-style* (preferred-communication-style)) +(defvar *dont-close* nil + "Default value of :dont-close argument to start-server and + create-server.") + (defvar *dedicated-output-stream-buffering* (if (eq *communication-style* :spawn) :full :none) "The buffering scheme that should be used for the output stream. Valid values are :none, :line, and :full.") (defun start-server (port-file &key (style *communication-style*) - dont-close (external-format *coding-system*)) + (dont-close *dont-close*) + (external-format *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 () @@ -424,7 +430,7 @@ (defun create-server (&key (port default-server-port) (style *communication-style*) - dont-close (external-format *coding-system*)) + (dont-close *dont-close*) (external-format *coding-system*)) "Start a SWANK server on PORT running in STYLE. If DONT-CLOSE is true then the listen socket will accept multiple connections, otherwise it will be closed after the first." @@ -1213,12 +1219,13 @@ (defslimefun connection-info () "Return a key-value list of the form: -\(&key PID STYLE LISP-IMPLEMENTATION MACHINE FEATURES PACKAGE) +\(&key PID STYLE LISP-IMPLEMENTATION MACHINE FEATURES PACKAGE WIRE-PROTOCOL-VERSION) PID: is the process-id of Lisp process (or nil, depending on the STYLE) STYLE: the communication style LISP-IMPLEMENTATION: a list (&key TYPE NAME VERSION) FEATURES: a list of keywords -PACKAGE: a list (&key NAME PROMPT)" +PACKAGE: a list (&key NAME PROMPT) +WIRE-PROTOCOL-VERSION: a number" (setq *slime-features* *features*) `(:pid ,(getpid) :style ,(connection.communication-style *emacs-connection*) :lisp-implementation (:type ,(lisp-implementation-type) @@ -1229,7 +1236,8 @@ :version ,(machine-version)) :features ,(features-for-emacs) :package (:name ,(package-name *package*) - :prompt ,(package-string-for-prompt *package*)))) + :prompt ,(package-string-for-prompt *package*)) + :wire-protocol-version ,(wire-protocol-version))) (defslimefun io-speed-test (&optional (n 5000) (m 1)) (let* ((s *standard-output*) @@ -1246,6 +1254,11 @@ (finish-output *trace-output*) nil)) +(defun wire-protocol-version () + (let ((*package* (find-package :swank))) + (load (merge-pathnames "swank-version.el" swank-loader::*source-directory*)) + (symbol-value '*swank-wire-protocol-version*))) + ;;;; Reading and printing