From heller at common-lisp.net Mon Dec 5 20:19:42 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 5 Dec 2005 21:19:42 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051205201942.9D32D880D9@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv9637 Modified Files: slime.el Log Message: (slime-find-coding-system): Use check-coding-system only if it's actually fbound. Date: Mon Dec 5 21:19:40 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.566 slime/slime.el:1.567 --- slime/slime.el:1.566 Tue Nov 22 21:42:19 2005 +++ slime/slime.el Mon Dec 5 21:19:40 2005 @@ -1662,11 +1662,13 @@ The result is either an element in `slime-net-valid-coding-systems' of nil." (let* ((probe (assq name slime-net-valid-coding-systems))) - (if (and probe (ignore-errors (check-coding-system (car probe)))) + (if (and probe (if (fboundp 'check-coding-system) + (ignore-errors (check-coding-system (car probe))) + (eq (car probe) 'binary))) probe))) (defvar slime-net-coding-system - (find-if 'slime-find-coding-system + (find-if 'slime-find-coding-system '(iso-latin-1-unix iso-8859-1-unix binary)) "*Coding system used for network connections. See also `slime-net-valid-coding-systems'.") @@ -4842,7 +4844,8 @@ (slime-forward-sexp) (beginning-of-sexp))) ((:line start &optional end) - (goto-line start)) + (goto-line start) + (skip-chars-forward " \t")) ((:function-name name) (let ((case-fold-search t) (name (regexp-quote name))) From heller at common-lisp.net Mon Dec 5 20:20:44 2005 From: heller at common-lisp.net (Helmut Eller) Date: Mon, 5 Dec 2005 21:20:44 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051205202044.65067880D9@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv9768 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Mon Dec 5 21:20:43 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.814 slime/ChangeLog:1.815 --- slime/ChangeLog:1.814 Tue Nov 22 21:44:14 2005 +++ slime/ChangeLog Mon Dec 5 21:20:43 2005 @@ -1,3 +1,8 @@ +2005-12-05 Helmut Eller + + * slime.el (slime-find-coding-system): Use check-coding-system + only if it's actually fbound. + 2005-11-22 Marco Monteiro * slime.el (slime-connect): Use slime-net-coding system if the From jsnellman at common-lisp.net Mon Dec 5 23:01:57 2005 From: jsnellman at common-lisp.net (Juho Snellman) Date: Tue, 6 Dec 2005 00:01:57 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/swank-sbcl.lisp Message-ID: <20051205230157.CB682880D9@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv22909 Modified Files: ChangeLog swank-sbcl.lisp Log Message: 2005-12-06 Juho Snellman * swank-sbcl.lisp (function-source-location, safe-function-source-location): Oops, define these functions also for the >0.9.6 case. Fixes broken sldb-show-source on SBCL 0.9.7. Date: Tue Dec 6 00:01:55 2005 Author: jsnellman Index: slime/ChangeLog diff -u slime/ChangeLog:1.815 slime/ChangeLog:1.816 --- slime/ChangeLog:1.815 Mon Dec 5 21:20:43 2005 +++ slime/ChangeLog Tue Dec 6 00:01:49 2005 @@ -1,3 +1,9 @@ +2005-12-06 Juho Snellman + * swank-sbcl.lisp (function-source-location, + safe-function-source-location): Oops, define these functions + also for the >0.9.6 case. Fixes broken sldb-show-source on + SBCL 0.9.7. + 2005-12-05 Helmut Eller * slime.el (slime-find-coding-system): Use check-coding-system Index: slime/swank-sbcl.lisp diff -u slime/swank-sbcl.lisp:1.150 slime/swank-sbcl.lisp:1.151 --- slime/swank-sbcl.lisp:1.150 Sat Nov 12 00:43:43 2005 +++ slime/swank-sbcl.lisp Tue Dec 6 00:01:50 2005 @@ -400,10 +400,14 @@ ;;; As of SBCL 0.9.7 most of the gritty details of source location handling ;;; are supported reasonably well by SB-INTROSPECT. -;;; SBCL > 0.9.6 -#+#.(cl:if (cl:find-symbol "FIND-DEFINITION-SOURCES-BY-NAME" "SB-INTROSPECT") +(eval-when (:compile-toplevel :load-toplevel :execute) + (defun new-definition-source-p () + (if (find-symbol "FIND-DEFINITION-SOURCES-BY-NAME" "SB-INTROSPECT") '(and) - '(or)) + '(or)))) + +;;; SBCL > 0.9.6 +#+#.(swank-backend::new-definition-source-p) (progn (defparameter *definition-types* @@ -491,13 +495,22 @@ (with-input-from-string (s source) (read-snippet s position)))) +(defun function-source-location (function &optional name) + (declare (type function function)) + (let ((location (sb-introspect:find-definition-source function))) + (make-definition-source-location location :function name))) + +(defun safe-function-source-location (fun name) + (if *debug-definition-finding* + (function-source-location fun name) + (handler-case (function-source-location fun name) + (error (e) + (list :error (format nil "Error: ~A" e)))))) ) ;; End >0.9.6 ;;; Support for SBCL 0.9.6 and earlier. Feel free to delete this ;;; after January 2006. -#-#.(cl:if (cl:find-symbol "FIND-DEFINITION-SOURCES-BY-NAME" "SB-INTROSPECT") - '(and) - '(or)) +#-#.(swank-backend::new-definition-source-p) (progn (defimplementation find-definitions (name) (append (function-definitions name) From mkoeppe at common-lisp.net Wed Dec 7 13:15:14 2005 From: mkoeppe at common-lisp.net (Matthias Koeppe) Date: Wed, 7 Dec 2005 14:15:14 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051207131514.128D288554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv2434 Modified Files: slime.el Log Message: (slime-load-file): Change the default to be the buffer file name with extension. This is more convenient for files like .asd files that do not have the default source file extension. (slime-save-some-lisp-buffers, slime-update-modeline-package): Handle all files with major mode in slime-lisp-modes, not just lisp-mode. Date: Wed Dec 7 14:15:10 2005 Author: mkoeppe Index: slime/slime.el diff -u slime/slime.el:1.567 slime/slime.el:1.568 --- slime/slime.el:1.567 Mon Dec 5 21:19:40 2005 +++ slime/slime.el Wed Dec 7 14:15:10 2005 @@ -484,7 +484,7 @@ (defun slime-update-modeline-package () (ignore-errors (when (and slime-update-modeline-package - (eq major-mode 'lisp-mode) + (memq major-mode slime-lisp-modes) slime-mode) (let ((package (slime-current-package))) (when package @@ -3979,7 +3979,7 @@ (defun slime-save-some-lisp-buffers () (if slime-repl-only-save-lisp-buffers (save-some-buffers nil (lambda () - (and (eq major-mode 'lisp-mode) + (and (memq major-mode slime-lisp-modes) (not (null buffer-file-name))))) (save-some-buffers))) @@ -6523,9 +6523,8 @@ (interactive (list (read-file-name "Load file: " nil nil nil (if (buffer-file-name) - (file-name-sans-extension - (file-name-nondirectory - (buffer-file-name))))))) + (file-name-nondirectory + (buffer-file-name)))))) (let ((lisp-filename (slime-to-lisp-filename (expand-file-name filename)))) (slime-eval-with-transcript `(swank:load-file ,lisp-filename)))) From mkoeppe at common-lisp.net Wed Dec 7 13:16:59 2005 From: mkoeppe at common-lisp.net (Matthias Koeppe) Date: Wed, 7 Dec 2005 14:16:59 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051207131659.1D9D588554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv2907 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Wed Dec 7 14:16:58 2005 Author: mkoeppe Index: slime/ChangeLog diff -u slime/ChangeLog:1.816 slime/ChangeLog:1.817 --- slime/ChangeLog:1.816 Tue Dec 6 00:01:49 2005 +++ slime/ChangeLog Wed Dec 7 14:16:58 2005 @@ -1,8 +1,17 @@ +2005-12-07 Matthias Koeppe + + * slime.el (slime-load-file): Change the default to be the buffer + file name with extension. This is more convenient for files like + .asd files that do not have the default source file extension. + (slime-save-some-lisp-buffers, slime-update-modeline-package): + Handle all files with major mode in slime-lisp-modes, not just + lisp-mode. + 2005-12-06 Juho Snellman - * swank-sbcl.lisp (function-source-location, - safe-function-source-location): Oops, define these functions - also for the >0.9.6 case. Fixes broken sldb-show-source on - SBCL 0.9.7. + + * swank-sbcl.lisp (function-source-location, + safe-function-source-location): Oops, define these functions also + for the >0.9.6 case. Fixes broken sldb-show-source on SBCL 0.9.7. 2005-12-05 Helmut Eller From mkoeppe at common-lisp.net Wed Dec 7 17:47:13 2005 From: mkoeppe at common-lisp.net (Matthias Koeppe) Date: Wed, 7 Dec 2005 18:47:13 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank-allegro.lisp Message-ID: <20051207174713.B43D688592@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv23785 Modified Files: swank-allegro.lisp Log Message: (find-definition-in-file) (find-fspec-location, fspec-definition-locations): Allegro CL properly records all definitions made by arbitrary macros whose names start with "def". Use excl::find-source-file and scm:find-definition-in-definition-group (rather than scm:find-definition-in-file) to find them. Date: Wed Dec 7 18:47:12 2005 Author: mkoeppe Index: slime/swank-allegro.lisp diff -u slime/swank-allegro.lisp:1.80 slime/swank-allegro.lisp:1.81 --- slime/swank-allegro.lisp:1.80 Sat Nov 12 00:43:43 2005 +++ slime/swank-allegro.lisp Wed Dec 7 18:47:12 2005 @@ -352,10 +352,17 @@ (when (<= pos 0) (return cr-count)))))) -(defun find-definition-in-file (fspec type file) - (let* ((start (or (scm:find-definition-in-file fspec type file) - (scm:find-definition-in-file (fspec-primary-name fspec) - type file))) +(defun find-definition-in-file (fspec type file top-level) + (let* ((part + (or (scm::find-definition-in-definition-group + fspec type (scm:section-file :file file) + :top-level top-level) + (scm::find-definition-in-definition-group + (fspec-primary-name fspec) + type (scm:section-file :file file) + :top-level top-level))) + (start (and part + (scm::source-part-start part))) (pos (if start (list :position (1+ (- start (count-cr file start)))) (list :function-name (string (fspec-primary-name fspec)))))) @@ -368,29 +375,15 @@ (list :buffer (subseq filename 0 pos)) (list :position (parse-integer (subseq filename (1+ pos))))))) -(defun find-fspec-location (fspec type) - (multiple-value-bind (file err) (ignore-errors (excl:source-file fspec type)) - (etypecase file - (pathname - (find-definition-in-file fspec type file)) - ((member :top-level) - (list :error (format nil "Defined at toplevel: ~A" - (fspec->string fspec)))) - (string - (find-definition-in-buffer file)) - (null - (list :error (if err - (princ-to-string err) - (format nil "Unknown source location for ~A" - (fspec->string fspec))))) - (cons - (destructuring-bind ((type . filename)) file - (assert (member type '(:operator))) - (etypecase filename - (pathname - (find-definition-in-file fspec type filename)) - (string - (find-definition-in-buffer filename)))))))) +(defun find-fspec-location (fspec type file top-level) + (etypecase file + (pathname + (find-definition-in-file fspec type file top-level)) + ((member :top-level) + (list :error (format nil "Defined at toplevel: ~A" + (fspec->string fspec)))) + (string + (find-definition-in-buffer file)))) (defun fspec->string (fspec) (etypecase fspec @@ -402,10 +395,16 @@ (prin1-to-string (second fspec))))))) (defun fspec-definition-locations (fspec) - (let ((defs (excl::find-multiple-definitions fspec))) - (loop for (fspec type) in defs - collect (list (list type fspec) - (find-fspec-location fspec type))))) + (let ((defs (excl::find-source-file fspec))) + (if (null defs) + (list + (list (list nil fspec) + (list :error + (format nil "Unknown source location for ~A" + (fspec->string fspec))))) + (loop for (fspec type file top-level) in defs + collect (list (list type fspec) + (find-fspec-location fspec type file top-level)))))) (defimplementation find-definitions (symbol) (fspec-definition-locations symbol)) From mkoeppe at common-lisp.net Wed Dec 7 17:51:42 2005 From: mkoeppe at common-lisp.net (Matthias Koeppe) Date: Wed, 7 Dec 2005 18:51:42 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051207175142.34F5788592@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv23833 Modified Files: ChangeLog Log Message: *** empty log message *** Date: Wed Dec 7 18:51:41 2005 Author: mkoeppe Index: slime/ChangeLog diff -u slime/ChangeLog:1.817 slime/ChangeLog:1.818 --- slime/ChangeLog:1.817 Wed Dec 7 14:16:58 2005 +++ slime/ChangeLog Wed Dec 7 18:51:41 2005 @@ -1,5 +1,12 @@ 2005-12-07 Matthias Koeppe + * swank-allegro.lisp (find-definition-in-file) + (find-fspec-location, fspec-definition-locations): Allegro CL + properly records all definitions made by arbitrary macros whose + names start with "def". Use excl::find-source-file and + scm:find-definition-in-definition-group (rather than + scm:find-definition-in-file) to find them. + * slime.el (slime-load-file): Change the default to be the buffer file name with extension. This is more convenient for files like .asd files that do not have the default source file extension. From mbaringer at common-lisp.net Fri Dec 16 11:42:36 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Fri, 16 Dec 2005 12:42:36 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/slime.el Message-ID: <20051216114236.BD58888446@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv7495 Modified Files: slime.el Log Message: (slime-display-edit-hilights): New variable. (slime-display-edit-face): New face. (slime-compile-file, slime-compile-defun, slime-compile-region): Remove edits overlay. (slime-remove-edits): New function. (slime-self-insert-command): New function. (slime-mode-hook): Rebind simple characters to slime-self-insert-command. Date: Fri Dec 16 12:42:35 2005 Author: mbaringer From mbaringer at common-lisp.net Fri Dec 16 11:43:43 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Fri, 16 Dec 2005 12:43:43 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/ChangeLog Message-ID: <20051216114343.CBB7588446@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv7535 Modified Files: ChangeLog Log Message: Date: Fri Dec 16 12:43:43 2005 Author: mbaringer From nsiivola at common-lisp.net Fri Dec 16 13:35:29 2005 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Fri, 16 Dec 2005 14:35:29 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el slime/swank.lisp slime/ChangeLog Message-ID: <20051216133529.29EAC88446@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv16632 Modified Files: slime.el swank.lisp ChangeLog Log Message: slime-selector tweak, robuster printing Date: Fri Dec 16 14:35:27 2005 Author: nsiivola Index: slime/slime.el diff -u slime/slime.el:1.569 slime/slime.el:1.570 --- slime/slime.el:1.569 Fri Dec 16 12:42:34 2005 +++ slime/slime.el Fri Dec 16 14:35:13 2005 @@ -8517,7 +8517,10 @@ (def-slime-selector-method ?r "SLIME Read-Eval-Print-Loop." - (slime-output-buffer)) + (cond ((slime-current-connection) + (slime-output-buffer)) + ((y-or-n-p "No connection: start Slime? ") + (slime-start)))) (def-slime-selector-method ?s "*slime-scratch* buffer." Index: slime/swank.lisp diff -u slime/swank.lisp:1.353 slime/swank.lisp:1.354 --- slime/swank.lisp:1.353 Mon Nov 21 00:27:26 2005 +++ slime/swank.lisp Fri Dec 16 14:35:14 2005 @@ -1156,10 +1156,16 @@ (defun to-string (object) "Write OBJECT in the *BUFFER-PACKAGE*. -The result may not be readable." +The result may not be readable. Handles problems with PRINT-OBJECT methods +gracefully." (with-buffer-syntax () (let ((*print-readably* nil)) - (prin1-to-string object)))) + (handler-case + (prin1-to-string object) + (error () + (with-output-to-string (s) + (print-unreadable-object (object s :type t :identity t) + (princ "<>" s)))))))) (defun from-string (string) "Read string in the *BUFFER-PACKAGE*" Index: slime/ChangeLog diff -u slime/ChangeLog:1.819 slime/ChangeLog:1.820 --- slime/ChangeLog:1.819 Fri Dec 16 12:43:42 2005 +++ slime/ChangeLog Fri Dec 16 14:35:14 2005 @@ -1,3 +1,12 @@ +2005-12-16 Nikodemus Siivola + + * slime.el (slime-selector-method: ?r): If no connection offer to + start Slime. + + * swank.lisp (to-string): Handle errors from printing objects. + Among other things makes the inspector more robust in the face of + objects with unbound slots and print-methods that fail to cope. + 2005-12-16 William Bland Added hilighting of tetx which has been edited but not yet From nsiivola at common-lisp.net Sun Dec 18 17:24:39 2005 From: nsiivola at common-lisp.net (Nikodemus Siivola) Date: Sun, 18 Dec 2005 18:24:39 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog slime/slime.el Message-ID: <20051218172439.E150D88545@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv1674 Modified Files: ChangeLog slime.el Log Message: Be more careful when adding slime-self-insert-command bindings Date: Sun Dec 18 18:24:37 2005 Author: nsiivola Index: slime/ChangeLog diff -u slime/ChangeLog:1.820 slime/ChangeLog:1.821 --- slime/ChangeLog:1.820 Fri Dec 16 14:35:14 2005 +++ slime/ChangeLog Sun Dec 18 18:24:36 2005 @@ -1,3 +1,12 @@ +2005-12-18 Nikodemus Siivola + + * slime.el (slime-mode-hook): Bind simple characters to + slime-self-insert-command only if there was no previous local + binding, and the major mode is _not_ slime-repl-mode. This + restores keybindings of slime-xref-mode and prevents us from + stomping on user bindings. The hilighting also makes no sense in + the REPL. + 2005-12-16 Nikodemus Siivola * slime.el (slime-selector-method: ?r): If no connection offer to Index: slime/slime.el diff -u slime/slime.el:1.570 slime/slime.el:1.571 --- slime/slime.el:1.570 Fri Dec 16 14:35:13 2005 +++ slime/slime.el Sun Dec 18 18:24:36 2005 @@ -239,7 +239,7 @@ (((class color) (background dark)) (:background "yellow")) (t (:background "yellow"))) - "Face for displaying edit but not compilide code." + "Face for displaying edit but not compiled code." :group 'slime-mode-faces) ;;;;; slime-mode-faces @@ -9889,7 +9889,7 @@ (interactive) (self-insert-command 1) (when (and slime-display-edit-hilights (slime-connected-p)) - (message "Settingup face.") + (message "Setting up face.") (let ((overlay (make-overlay (- (point) 1) (point)))) (flet ((putp (name value) (overlay-put overlay name value))) (putp 'face 'slime-display-edit-face) @@ -9897,9 +9897,12 @@ (add-hook 'slime-mode-hook (lambda () - (dotimes (i 127) - (when (> i 31) - (local-set-key (string i) 'slime-self-insert-command))))) + (unless (eq 'slime-repl-mode major-mode) + (dotimes (i 127) + (when (> i 31) + ;; Don't stomp on previous bindings! + (when (null (local-key-binding (string i))) + (local-set-key (string i) 'slime-self-insert-command))))))) ;;;; Finishing up From mbaringer at common-lisp.net Tue Dec 20 00:13:25 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Tue, 20 Dec 2005 01:13:25 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/slime.el Message-ID: <20051220001325.C33A488446@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv13552 Modified Files: slime.el Log Message: (slime-self-insert-command): Got rid of message about setting up face and skipping edit-hilights when in a comment. Date: Tue Dec 20 01:13:24 2005 Author: mbaringer From mbaringer at common-lisp.net Tue Dec 20 00:14:07 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Tue, 20 Dec 2005 01:14:07 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/ChangeLog Message-ID: <20051220001407.A036D88446@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv13593 Modified Files: ChangeLog Log Message: Date: Tue Dec 20 01:14:06 2005 Author: mbaringer From mbaringer at common-lisp.net Tue Dec 20 00:26:03 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Tue, 20 Dec 2005 01:26:03 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/ChangeLog Message-ID: <20051220002603.C56DF88446@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv14749 Modified Files: ChangeLog Log Message: Date: Tue Dec 20 01:26:00 2005 Author: mbaringer From mbaringer at common-lisp.net Tue Dec 20 00:26:26 2005 From: mbaringer at common-lisp.net (Marco Baringer) Date: Tue, 20 Dec 2005 01:26:26 +0100 (CET) Subject: [slime-cvs] CVS update: /slime/swank.lisp Message-ID: <20051220002626.E7A7B88446@common-lisp.net> Update of /project/slime/cvsroot//slime In directory common-lisp.net:/tmp/cvs-serv14778 Modified Files: swank.lisp Log Message: (all-slots-for-inspector): New function. (inspect-for-emacs): Use all-slots-for-inspector. Date: Tue Dec 20 01:26:25 2005 Author: mbaringer From heller at common-lisp.net Thu Dec 22 16:04:11 2005 From: heller at common-lisp.net (Helmut Eller) Date: Thu, 22 Dec 2005 17:04:11 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051222160411.1DC5F885A4@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv20076 Modified Files: slime.el Log Message: Make highlighting of modified text a minor mode. Also use after-change-functions instead of rebinding all self-inserting keys. (slime-highlight-edits-mode): New minor mode. (slime-self-insert-command): Deleted. (slime-before-compile-functions): New hook to decouple edit highlighting from compilation. (slime-highlight-edits-face): Renamed from slime-display-edit-face. Date: Thu Dec 22 17:03:43 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.572 slime/slime.el:1.573 --- slime/slime.el:1.572 Tue Dec 20 01:13:24 2005 +++ slime/slime.el Thu Dec 22 17:03:32 2005 @@ -67,12 +67,14 @@ (defvar slime-use-autodoc-mode nil "When non-nil always enabled slime-autodoc-mode in slime-mode.") -(defun* slime-setup (&key autodoc typeout-frame) +(defun* slime-setup (&key autodoc typeout-frame highlight-edits) "Setup Emacs so that lisp-mode buffers always use SLIME." (add-hook 'lisp-mode-hook 'slime-lisp-mode-hook) (when typeout-frame (add-hook 'slime-connected-hook 'slime-ensure-typeout-frame)) - (setq slime-use-autodoc-mode autodoc)) + (setq slime-use-autodoc-mode autodoc) + (when highlight-edits + (add-hook 'slime-mode-hook 'slime-highlight-edits-mode))) (defun slime-lisp-mode-hook () (slime-mode 1) @@ -228,20 +230,6 @@ :type 'string :group 'slime-mode) -(defcustom slime-display-edit-hilights t - "Hilight code that has been edited but not recompiled." - :type '(choice (const :tag "Enable" t) (const :tag "Disable" nil)) - :group 'slime-mode) - -(defface slime-display-edit-face - `((((class color) (background light)) - (:background "yellow")) - (((class color) (background dark)) - (:background "yellow")) - (t (:background "yellow"))) - "Face for displaying edit but not compiled code." - :group 'slime-mode-faces) - ;;;;; slime-mode-faces (defgroup slime-mode-faces nil @@ -4195,6 +4183,11 @@ ;;;; Compilation and the creation of compiler-note annotations +(defvar slime-before-compile-functions nil + "A list of function called before compiling a buffer or region. +The function receive two arguments: the beginning and the end of the +region that will be compiled.") + (defun slime-compile-and-load-file () "Compile and load the buffer's file and highlight compiler notes. @@ -4215,7 +4208,6 @@ See `slime-compile-and-load-file' for further details." (interactive) - (slime-remove-edits 1 (point-max)) (unless (memq major-mode slime-lisp-modes) (error "Only valid in lisp-mode")) (check-parens) @@ -4224,6 +4216,7 @@ (when (and (buffer-modified-p) (y-or-n-p (format "Save file %s? " (buffer-file-name)))) (save-buffer)) + (run-hook-with-args 'slime-before-compile-functions (point-min) (point-max)) (let ((lisp-filename (slime-to-lisp-filename (buffer-file-name)))) (slime-insert-transcript-delimiter (format "Compile file %s" lisp-filename)) @@ -4277,21 +4270,17 @@ (defun slime-compile-defun () "Compile the current toplevel form." (interactive) - (slime-compile-string (slime-defun-at-point) - (save-excursion - (end-of-defun) - (beginning-of-defun) - (point))) - (save-excursion - (beginning-of-defun) - (let ((start (point))) - (end-of-defun) - (slime-remove-edits start (point))))) + (destructuring-bind (start end) + (save-excursion + (beginning-of-defun) + (list (point) + (progn (end-of-defun) (point)))) + (slime-compile-region start end))) (defun slime-compile-region (start end) "Compile the region." (interactive "r") - (slime-remove-edits start end) + (run-hook-with-args 'slime-before-compile-functions start end) (slime-compile-string (buffer-substring-no-properties start end) start)) (defun slime-compile-string (string start-offset) @@ -4414,16 +4403,6 @@ (mapcar #'slime-merge-notes (slime-group-similar 'slime-notes-in-same-location-p notes))) -(defun slime-remove-edits (start end) - "Delete the existing Slime edit hilights in the current buffer." - (save-excursion - (goto-char start) - (while (< (point) end) - (dolist (o (overlays-at (point))) - (when (overlay-get o 'slime-edit) - (delete-overlay o))) - (goto-char (next-overlay-change (point)))))) - (defun slime-merge-notes (notes) "Merge NOTES together. Keep the highest severity, concatenate the messages." (let* ((new-severity (reduce #'slime-most-severe notes @@ -5173,7 +5152,7 @@ (when (and slime-space-information-p (slime-background-activities-enabled-p)) (slime-echo-arglist)) - (self-insert-command n))) + (self-insert-command n))) (defun slime-echo-arglist () "Display the arglist of the current form in the echo area." @@ -5400,6 +5379,68 @@ (slime-make-typeout-frame))) +;;;; edit highlighting + +(defface slime-highlight-edits-face + `((((class color) (background light)) + (:background "lightgray")) + (((class color) (background dark)) + (:background "dimgray")) + (t (:background "yellow"))) + "Face for displaying edit but not compiled code." + :group 'slime-mode-faces) + +(define-minor-mode slime-highlight-edits-mode + "Minor mode to highlight not-yet-compiled code." nil) + +(add-hook 'slime-highlight-edits-mode-on-hook + 'slime-highlight-edits-init-buffer) + +(add-hook 'slime-highlight-edits-mode-off-hook + 'slime-highlight-edits-reset-buffer) + +(defun slime-highlight-edits-init-buffer () + (make-local-variable 'after-change-functions) + (add-to-list 'after-change-functions + 'slime-highlight-edits) + (add-to-list 'slime-before-compile-functions + 'slime-highlight-edits-compile-hook)) + +(defun slime-highlight-edits-reset-buffer () + (setq after-change-functions + (remove 'slime-highlight-edits after-change-functions)) + (slime-remove-edits (point-min) (point-max))) + +(defun slime-highlight-edits (beg end &optional len) + (when (and (slime-connected-p) + (not (slime-inside-comment-p beg end))) + (let ((overlay (make-overlay beg end))) + (overlay-put overlay 'face 'slime-highlight-edits-face) + (overlay-put overlay 'slime-edit t)))) + +(defun slime-remove-edits (start end) + "Delete the existing Slime edit hilights in the current buffer." + (save-excursion + (goto-char start) + (while (< (point) end) + (dolist (o (overlays-at (point))) + (when (overlay-get o 'slime-edit) + (delete-overlay o))) + (goto-char (next-overlay-change (point)))))) + +(defun slime-highlight-edits-compile-hook (start end) + (when slime-highlight-edits-mode + (slime-remove-edits start end))) + +(defun slime-inside-comment-p (beg end) + "Is the region from BEG to END in a comment?" + (let* ((hs-c-start-regexp ";\\|#|") + (comment (hs-inside-comment-p))) + (and comment + (destructuring-bind (cbeg cend) comment + (and (<= cbeg beg) (<= end cend)))))) + + ;;;; Completion ;; XXX those long names are ugly to read; long names an indicator for @@ -9884,29 +9925,6 @@ (defun sldb-xemacs-post-command-hook () (when (get-text-property (point) 'point-entered) (funcall (get-text-property (point) 'point-entered)))) - -(defun slime-self-insert-command () - (interactive) - (self-insert-command 1) - (when (and slime-display-edit-hilights - (slime-connected-p) - (not (in-comment-p))) - (let ((overlay (make-overlay (- (point) 1) (point)))) - (flet ((putp (name value) (overlay-put overlay name value))) - (putp 'face 'slime-display-edit-face) - (putp 'slime-edit t))))) - -(defun in-comment-p () - (nth 4 (syntax-ppss (point)))) - -(add-hook 'slime-mode-hook - (lambda () - (unless (eq 'slime-repl-mode major-mode) - (dotimes (i 127) - (when (> i 31) - ;; Don't stomp on previous bindings! - (when (null (local-key-binding (string i))) - (local-set-key (string i) 'slime-self-insert-command))))))) ;;;; Finishing up From heller at common-lisp.net Thu Dec 22 16:06:50 2005 From: heller at common-lisp.net (Helmut Eller) Date: Thu, 22 Dec 2005 17:06:50 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051222160650.E892B885A4@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv20273 Modified Files: ChangeLog Log Message: Date: Thu Dec 22 17:06:50 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.823 slime/ChangeLog:1.824 --- slime/ChangeLog:1.823 Tue Dec 20 01:25:58 2005 +++ slime/ChangeLog Thu Dec 22 17:06:49 2005 @@ -1,3 +1,15 @@ +2005-12-22 Helmut Eller + + Make highlighting of modified text a minor mode. Also use + after-change-functions instead of rebinding all self-inserting + keys. + + * slime.el (slime-highlight-edits-mode): New minor mode. + (slime-self-insert-command): Deleted. + (slime-before-compile-functions): New hook to decouple edit + highlighting from compilation. + (slime-highlight-edits-face): Renamed from slime-display-edit-face. + 2005-12-20 Marco Baringer When inspecting classes, methods and generic functions show all From heller at common-lisp.net Thu Dec 22 21:21:47 2005 From: heller at common-lisp.net (Helmut Eller) Date: Thu, 22 Dec 2005 22:21:47 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051222212147.2C2558858F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv12477 Modified Files: slime.el Log Message: (slime-highlight-edits-compile-hook): Remove overlays also from surrounding whitespace. (slime-highlight-edits): Save match data. (slime-only-whitespace-p): New function. Date: Thu Dec 22 22:21:46 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.573 slime/slime.el:1.574 --- slime/slime.el:1.573 Thu Dec 22 17:03:32 2005 +++ slime/slime.el Thu Dec 22 22:21:45 2005 @@ -5412,11 +5412,13 @@ (slime-remove-edits (point-min) (point-max))) (defun slime-highlight-edits (beg end &optional len) - (when (and (slime-connected-p) - (not (slime-inside-comment-p beg end))) - (let ((overlay (make-overlay beg end))) - (overlay-put overlay 'face 'slime-highlight-edits-face) - (overlay-put overlay 'slime-edit t)))) + (save-match-data + (when (and (slime-connected-p) + (not (slime-inside-comment-p beg end)) + (not (slime-only-whitespace-p beg end))) + (let ((overlay (make-overlay beg end))) + (overlay-put overlay 'face 'slime-highlight-edits-face) + (overlay-put overlay 'slime-edit t))))) (defun slime-remove-edits (start end) "Delete the existing Slime edit hilights in the current buffer." @@ -5430,15 +5432,30 @@ (defun slime-highlight-edits-compile-hook (start end) (when slime-highlight-edits-mode - (slime-remove-edits start end))) + (let ((start (save-excursion (goto-char start) + (skip-chars-backward " \t\n\r") + (point))) + (end (save-excursion (goto-char end) + (skip-chars-forward " \t\n\r") + (point)))) + (slime-remove-edits start end)))) (defun slime-inside-comment-p (beg end) "Is the region from BEG to END in a comment?" - (let* ((hs-c-start-regexp ";\\|#|") - (comment (hs-inside-comment-p))) - (and comment - (destructuring-bind (cbeg cend) comment - (and (<= cbeg beg) (<= end cend)))))) + (save-excursion + (goto-char beg) + (let* ((hs-c-start-regexp ";\\|#|") + (comment (hs-inside-comment-p))) + (and comment + (destructuring-bind (cbeg cend) comment + (<= end cend)))))) + +(defun slime-only-whitespace-p (beg end) + "Contains the region from BEG to END only whitespace?" + (save-excursion + (goto-char beg) + (skip-chars-forward " \n\t\r" end) + (<= end (point)))) ;;;; Completion From heller at common-lisp.net Tue Dec 27 15:12:26 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 27 Dec 2005 16:12:26 +0100 (CET) Subject: [slime-cvs] CVS update: slime/swank.lisp Message-ID: <20051227151226.C491688161@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv14303 Modified Files: swank.lisp Log Message: (log-event): Record the event in the history buffer. (*event-history*, *event-history-index*, *enable-event-history*): Ring buffer for events. (dump-event-history, dump-event, escape-non-ascii, ascii-string-p) (ascii-char-p): New functions. (close-connection): Escape non-ascii strings and include the event history in the error message. Date: Tue Dec 27 16:12:23 2005 Author: heller Index: slime/swank.lisp diff -u slime/swank.lisp:1.355 slime/swank.lisp:1.356 --- slime/swank.lisp:1.355 Tue Dec 20 01:26:25 2005 +++ slime/swank.lisp Tue Dec 27 16:12:22 2005 @@ -323,14 +323,54 @@ (defvar *log-events* nil) (defvar *log-output* *error-output*) +(defvar *event-history* (make-array 40 :initial-element nil) + "A ring buffer to record events for better error messages.") +(defvar *event-history-index* 0) +(defvar *enable-event-history* t) (defun log-event (format-string &rest args) "Write a message to *terminal-io* when *log-events* is non-nil. Useful for low level debugging." + (when *enable-event-history* + (setf (aref *event-history* *event-history-index*) + (apply #'format nil format-string args)) + (setf *event-history-index* + (mod (1+ *event-history-index*) (length *event-history*)))) (when *log-events* (apply #'format *log-output* format-string args) (force-output *log-output*))) +(defun event-history-to-list () + "Return the list of events (older events first)." + (let ((arr *event-history*) + (idx *event-history-index*)) + (concatenate 'list (subseq arr idx) (subseq arr 0 idx)))) + +(defun dump-event-history (stream) + (dolist (e (event-history-to-list)) + (dump-event e stream))) + +(defun dump-event (event stream) + (cond ((stringp event) + (write-string (escape-non-ascii event) stream)) + ((null event)) + (t (format stream "Unexpected event: ~A~%" event)))) + +(defun escape-non-ascii (string) + "Return a string like STRING but with non-ascii chars escaped." + (cond ((ascii-string-p string) string) + (t (with-output-to-string (out) + (loop for c across string do + (cond ((ascii-char-p c) (write-char c out)) + (t (format out "\\x~4,'0X" (char-code c))))))))) + +(defun ascii-string-p (o) + (and (stringp o) + (every #'ascii-char-p o))) + +(defun ascii-char-p (c) + (<= (char-code c) 127)) + ;;;; TCP Server @@ -510,7 +550,19 @@ (setf *connections* (remove c *connections*)) (run-hook *connection-closed-hook* c) (when condition - (format *debug-io* "~&;; Connection to Emacs lost.~%;; [~A]~%" condition) + (finish-output *debug-io*) + (format *debug-io* "~&;; Event history start:~%") + (dump-event-history *debug-io*) + (format *debug-io* ";; Event history end.~%~ + ;; Connection to Emacs lost. [~%~ + ;; condition: ~A~%~ + ;; type: ~S~%~ + ;; encoding: ~S style: ~S dedicated: ~S]~%" + (escape-non-ascii (safe-condition-message condition) ) + (type-of condition) + (connection.external-format c) + (connection.communication-style c) + *use-dedicated-output-stream*) (finish-output *debug-io*))) (defmacro with-reader-error-handler ((connection) &body body) @@ -962,9 +1014,8 @@ (pos (read-sequence string stream))) (assert (= pos length) () "Short read: length=~D pos=~D" length pos) - (let ((form (read-form string))) - (log-event "READ: ~A~%" string) - form)) + (log-event "READ: ~S~%" string) + (read-form string)) (serious-condition (c) (error (make-condition 'slime-protocol-error :condition c)))))) From heller at common-lisp.net Tue Dec 27 15:14:44 2005 From: heller at common-lisp.net (Helmut Eller) Date: Tue, 27 Dec 2005 16:14:44 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051227151444.0598488574@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv14318 Modified Files: ChangeLog Log Message: Date: Tue Dec 27 16:14:44 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.824 slime/ChangeLog:1.825 --- slime/ChangeLog:1.824 Thu Dec 22 17:06:49 2005 +++ slime/ChangeLog Tue Dec 27 16:14:44 2005 @@ -1,3 +1,13 @@ +2005-12-27 Helmut Eller + + Keep a history of protocol events for better bug reports. + + * swank.lisp (log-event): Record the event in the history buffer. + (*event-history*): Buffer for events. + (dump-event-history): New function. + (close-connection): Escape non-ascii strings and include the event + history in the error message. + 2005-12-22 Helmut Eller Make highlighting of modified text a minor mode. Also use From heller at common-lisp.net Sat Dec 31 15:06:18 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 31 Dec 2005 16:06:18 +0100 (CET) Subject: [slime-cvs] CVS update: slime/slime.el Message-ID: <20051231150618.2B8DC88554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv564 Modified Files: slime.el Log Message: (slime-open-stream-to-lisp): Inherit the process-coding-system from the current connection. From Harald Hanche-Olsen. Date: Sat Dec 31 16:06:10 2005 Author: heller Index: slime/slime.el diff -u slime/slime.el:1.574 slime/slime.el:1.575 --- slime/slime.el:1.574 Thu Dec 22 22:21:45 2005 +++ slime/slime.el Sat Dec 31 16:06:09 2005 @@ -1,5 +1,5 @@ -;;; -*- outline-regexp: ";;;;+"; indent-tabs-mode: nil -*- ;; slime.el -- Superior Lisp Interaction Mode for Emacs +;; ;;;; License ;; Copyright (C) 2003 Eric Marsden, Luke Gorrie, Helmut Eller ;; Copyright (C) 2004,2005 Luke Gorrie, Helmut Eller @@ -2607,14 +2607,10 @@ (display-buffer (current-buffer))) (when (eobp) (slime-repl-show-maximum-output t))) - -(defun slime-flush-output () - (while (accept-process-output nil 0 20))) (defun slime-show-last-output () "Show the output from the last Lisp evaluation." (with-current-buffer (slime-output-buffer) - ;;(slime-flush-output) (let ((start slime-output-start) (end slime-output-end)) (funcall slime-show-last-output-function start end)))) @@ -2775,9 +2771,8 @@ (list* '("<" . slime-mark-presentation-start-handler) '(">" . slime-mark-presentation-end-handler) bridge-handlers))) - (set-process-coding-system stream - slime-net-coding-system - slime-net-coding-system) + (let ((pcs (process-coding-system (slime-current-connection)))) + (set-process-coding-system stream (car pcs) (cdr pcs))) (when-let (secret (slime-secret)) (slime-net-send secret stream)) stream)) @@ -3196,7 +3191,6 @@ "Goto to point max, insert RESULT and the prompt. Set slime-output-end to start of the inserted text slime-input-start to end end." - ;;(slime-flush-output) (goto-char (point-max)) (let ((start (point))) (unless (bolp) (insert "\n")) @@ -6269,19 +6263,20 @@ (destructuring-bind (output value) result (insert output value))))))) -(defun slime-eval-with-transcript (form &optional fn wait) +(defun slime-eval-with-transcript (form &optional fn) "Send FROM and PACKAGE to Lisp and pass the result to FN. Display the result in the message area, if FN is nil. Show the output buffer if the evaluation causes any output." (with-current-buffer (slime-output-buffer) - (slime-with-output-end-mark (slime-mark-output-start))) + (slime-with-output-end-mark + (slime-mark-output-start))) (with-lexical-bindings (fn) (slime-eval-async form (lambda (value) (with-current-buffer (slime-output-buffer) + (slime-show-last-output) (cond (fn (funcall fn value)) - (t (message "%s" value))) - (slime-show-last-output)))))) + (t (message "%s" value)))))))) (defun slime-eval-describe (form) "Evaluate FORM in Lisp and display the result in a new buffer." @@ -9091,6 +9086,7 @@ (setq slime-tests nil) (defun slime-check-top-level (&optional test-name) + (accept-process-output nil 0 50) (slime-check "At the top level (no debugging or pending RPCs)" (slime-at-top-level-p))) @@ -9336,6 +9332,7 @@ () "Test interrupting a loop that sends a lot of output to Emacs." '(()) + (accept-process-output nil 1) (slime-check-top-level) (slime-eval-async '(cl:loop :for i :from 0 :do (cl:progn (cl:print i) (cl:finish-output))) @@ -9346,7 +9343,7 @@ (lambda () (and (slime-sldb-level= 1) (get-buffer-window (sldb-get-default-buffer)))) - 20) + 30) (with-current-buffer (sldb-get-default-buffer) (sldb-quit)) (slime-sync-to-top-level 5)) @@ -9510,7 +9507,15 @@ SWANK> " nil) ("(princ 10)" ";;;; (princ 10) ... 10 +SWANK> " t) + ("(princ \"????????????????????????????\")" + ";;;; (princ \"????????????????????????????\") ... +???????????????????????????? SWANK> " t)) + (when (and (fboundp 'string-to-multibyte) + default-enable-multibyte-characters) + (setq input (funcall 'string-to-multibyte input)) + (setq result-contents (funcall 'string-to-multibyte result-contents))) (with-current-buffer (slime-output-buffer) (setf (slime-lisp-package-prompt-string) "SWANK")) (kill-buffer (slime-output-buffer)) @@ -9523,10 +9528,14 @@ visiblep (not (not (get-buffer-window (current-buffer))))))) +;; XXX this test should fail with :fd-handler style because +;; (sldb-quit) doesn't find the abort-request restart, but for some +;; reason it succeeds. (def-slime-test break () "Test if BREAK invokes SLDB." '(()) + (accept-process-output nil 1) (slime-check-top-level) (slime-compile-string (prin1-to-string '(cl:defun cl-user::foo () (cl:break))) @@ -9540,6 +9549,7 @@ 5) (with-current-buffer (sldb-get-default-buffer) (sldb-quit)) + (accept-process-output nil 1) (slime-sync-to-top-level 5)) @@ -9966,10 +9976,16 @@ slime-print-apropos slime-show-note-counts slime-insert-propertized - slime-tree-insert))) + slime-tree-insert))) (run-hooks 'slime-load-hook) (provide 'slime) +;; Local Variables: +;; outline-regexp: ";;;;+" +;; indent-tabs-mode: nil +;; coding: latin-1-unix +;; unibyte: t +;; End: ;;; slime.el ends here From heller at common-lisp.net Sat Dec 31 15:08:25 2005 From: heller at common-lisp.net (Helmut Eller) Date: Sat, 31 Dec 2005 16:08:25 +0100 (CET) Subject: [slime-cvs] CVS update: slime/ChangeLog Message-ID: <20051231150825.6DF5488554@common-lisp.net> Update of /project/slime/cvsroot/slime In directory common-lisp.net:/tmp/cvs-serv586 Modified Files: ChangeLog Log Message: Date: Sat Dec 31 16:08:22 2005 Author: heller Index: slime/ChangeLog diff -u slime/ChangeLog:1.825 slime/ChangeLog:1.826 --- slime/ChangeLog:1.825 Tue Dec 27 16:14:44 2005 +++ slime/ChangeLog Sat Dec 31 16:08:22 2005 @@ -1,3 +1,8 @@ +2005-12-31 Harald Hanche-Olsen + + * slime.el (slime-open-stream-to-lisp): Inherit the + process-coding-system from the current connection. + 2005-12-27 Helmut Eller Keep a history of protocol events for better bug reports.