From jsnellman at common-lisp.net Tue Dec 5 04:46:07 2006 From: jsnellman at common-lisp.net (jsnellman) Date: Mon, 4 Dec 2006 23:46:07 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205044607.4FFC72E1BE@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30892 Modified Files: ChangeLog swank-sbcl.lisp Log Message: Xref support for SBCL (requires SBCL 1.0.0.18). * swank-sbcl.lisp (who-calls): New function, fetch xref data from sb-introspect. (who-binds): Ditto. (who-sets): Ditto. (who-references): Ditto. (who-macroexpands): Ditto. (defxref): New macro, create the above functions. (source-location-for-xref-data): New, map from sb-introspect xref format to the Swank xref format. (sanitize-xrefs): Map PCL method names to something more readable. (string-path-snippet): New function, finds a more accurate source snippet for definition source locations which have both an :emacs-string and a full source path available. Otherwise the xref location would point to the toplevel form rather than the exact form for functions compiled with C-c C-c. (source-file-position): New function, somewhat like source-path-file-position but uses the source-file cache, handles missing form-paths more gracefully. (make-definition-source-location): use the above two functions (sbcl-with-xref-p): new function, detect whether SBCL has xref support for backwards compability --- /project/slime/cvsroot/slime/ChangeLog 2006/11/26 18:08:30 1.1009 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/05 04:46:06 1.1010 @@ -1,3 +1,28 @@ +2006-12-05 Juho Snellman + Real xref support for SBCL (requires SBCL 1.0.0.18). + + * swank-sbcl.lisp (who-calls): New function, fetch xref data from + sb-introspect. + (who-binds): Ditto. + (who-sets): Ditto. + (who-references): Ditto. + (who-macroexpands): Ditto. + (defxref): New macro, create the above functions. + (source-location-for-xref-data): New, map from sb-introspect xref + format to the Swank xref format. + (sanitize-xrefs): Map PCL method names to something more readable. + (string-path-snippet): New function, finds a more accurate source + snippet for definition source locations which have both an + :emacs-string and a full source path available. Otherwise the xref + location would point to the toplevel form rather than the exact + form for functions compiled with C-c C-c. + (source-file-position): New function, somewhat like + source-path-file-position but uses the source-file cache, handles + missing form-paths more gracefully. + (make-definition-source-location): Use the above two functions. + (sbcl-with-xref-p): New function, detect whether SBCL has xref support + for backwards compability. + 2006-11-26 Juho Snellman * swank-source-file-cache.lisp (buffer-first-change): Check --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/11/19 21:33:03 1.171 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/12/05 04:46:06 1.172 @@ -35,6 +35,11 @@ (defun sbcl-with-weak-hash-tables () (if (find-symbol "HASH-TABLE-WEAKNESS" "SB-EXT") '(and) + '(or))) + ;; And for xref support (1.0.1) + (defun sbcl-with-xref-p () + (if (find-symbol "WHO-CALLS" "SB-INTROSPECT") + '(and) '(or)))) ;;; swank-mop @@ -485,35 +490,46 @@ plist (cond (emacs-buffer - (let ((pos (if form-path - (with-debootstrapping - (source-path-string-position - form-path emacs-string)) - character-offset))) + (let* ((pos (if form-path + (with-debootstrapping + (source-path-string-position form-path emacs-string)) + character-offset)) + (snippet (string-path-snippet emacs-string form-path pos))) (make-location `(:buffer ,emacs-buffer) `(:position ,(+ pos emacs-position)) - `(:snippet ,emacs-string)))) + `(:snippet ,snippet)))) ((not pathname) `(:error ,(format nil "Source of ~A ~A not found" (string-downcase type) name))) (t (let* ((namestring (namestring (translate-logical-pathname pathname))) - (*readtable* (guess-readtable-for-filename namestring)) - (pos (1+ (with-debootstrapping - ;; Some internal functions have no source path - ;; or offset available, just the file (why?). - ;; In these cases we can at least try to open - ;; the right file. - (if form-path - (source-path-file-position form-path - pathname) - 0)))) - (snippet (source-hint-snippet namestring - file-write-date pos))) + (pos (source-file-position namestring file-write-date form-path + character-offset)) + (snippet (source-hint-snippet namestring file-write-date pos))) (make-location `(:file ,namestring) `(:position ,pos) `(:snippet ,snippet)))))))) +(defun string-path-snippet (string form-path position) + (if form-path + ;; If we have a form-path, use it to derive a more accurate + ;; snippet, so that we can point to the individual form rather + ;; than just the toplevel form. + (multiple-value-bind (data end) + (let ((*read-suppress* t)) + (read-from-string string nil nil :start position)) + (declare (ignore data)) + (subseq string position end)) + string)) + +(defun source-file-position (filename write-date form-path character-offset) + (let ((source (get-source-code filename write-date)) + (*readtable* (guess-readtable-for-filename filename))) + (1+ (with-debootstrapping + (if form-path + (source-path-string-position form-path source) + (or character-offset 0)))))) + (defun source-hint-snippet (filename write-date position) (let ((source (get-source-code filename write-date))) (with-input-from-string (s source) @@ -576,6 +592,30 @@ (describe (find-class symbol))) (:type (describe (sb-kernel:values-specifier-type symbol))))) + +#+#.(swank-backend::sbcl-with-xref-p) +(progn + (defmacro defxref (name) + `(defimplementation ,name (what) + (sanitize-xrefs + (mapcar #'source-location-for-xref-data + (,(find-symbol (symbol-name name) "SB-INTROSPECT") + what))))) + (defxref who-calls) + (defxref who-binds) + (defxref who-sets) + (defxref who-references) + (defxref who-macroexpands)) + +(defun source-location-for-xref-data (xref-data) + (let ((name (car xref-data)) + (source-location (cdr xref-data))) + (list name + (handler-case (make-definition-source-location source-location + 'function + name) + (error (e) + (list :error (format nil "Error: ~A" e))))))) (defimplementation list-callers (symbol) (let ((fn (fdefinition symbol))) @@ -587,11 +627,20 @@ (sanitize-xrefs (mapcar #'function-dspec (sb-introspect:find-function-callees fn))))) -(defun sanitize-xrefs (x) +(defun sanitize-xrefs (xrefs) (remove-duplicates (remove-if (lambda (f) (member f (ignored-xref-function-names))) - x + (loop for entry in xrefs + for name = (car entry) + collect (if (and (consp name) + (member (car name) + '(sb-pcl::fast-method + sb-pcl::slow-method + sb-pcl::method))) + (cons (cons 'defmethod (cdr name)) + (cdr entry)) + entry)) :key #'car) :test (lambda (a b) (and (eq (first a) (first b)) From heller at common-lisp.net Tue Dec 5 12:57:57 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 07:57:57 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205125757.0574159001@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16931 Modified Files: swank-backend.lisp Log Message: (guess-external-format): Return nil if the file can't be opened. Previusly we wrongly read from stdin. --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/11/19 21:33:03 1.109 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/05 12:57:57 1.110 @@ -421,21 +421,22 @@ (with-open-file (s filename :if-does-not-exist nil :external-format (or (find-external-format "latin-1-unix") :default)) - (or (let* ((line (read-line s nil)) - (p (search "-*-" line))) - (when p - (let* ((start (+ p (length "-*-"))) - (end (search "-*-" line :start2 start))) - (when end - (%search-coding line start end))))) - (let* ((len (file-length s)) - (buf (make-string (min len 3000)))) - (file-position s (- len (length buf))) - (read-sequence buf s) - (let ((start (search "Local Variables:" buf :from-end t)) - (end (search "End:" buf :from-end t))) - (and start end (< start end) - (%search-coding buf start end))))))) + (if s + (or (let* ((line (read-line s nil)) + (p (search "-*-" line))) + (when p + (let* ((start (+ p (length "-*-"))) + (end (search "-*-" line :start2 start))) + (when end + (%search-coding line start end))))) + (let* ((len (file-length s)) + (buf (make-string (min len 3000)))) + (file-position s (- len (length buf))) + (read-sequence buf s) + (let ((start (search "Local Variables:" buf :from-end t)) + (end (search "End:" buf :from-end t))) + (and start end (< start end) + (%search-coding buf start end)))))))) (defun %search-coding (str start end) (let ((p (search "coding:" str :start2 start :end2 end))) From heller at common-lisp.net Tue Dec 5 12:58:12 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 07:58:12 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205125812.A6ACA5F004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16990 Modified Files: swank-source-file-cache.lisp Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/11/26 18:08:30 1.6 +++ /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/12/05 12:58:12 1.7 @@ -41,8 +41,7 @@ (defimplementation buffer-first-change (filename) "Load a file into the cache when the user modifies its buffer. This is a win if the user then saves the file and tries to M-. into it." - (unless (or (source-cached-p filename) - (not (ignore-errors (probe-file filename)))) + (unless (source-cached-p filename) (ignore-errors (source-cache-get filename (file-write-date filename))))) From heller at common-lisp.net Tue Dec 5 12:58:43 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 07:58:43 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205125843.10E9C6D06B@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17049 Modified Files: slime.el Log Message: (slime-first-change-hook): Don't do anything if buffers file doesn't exist. --- /project/slime/cvsroot/slime/slime.el 2006/11/26 18:03:11 1.693 +++ /project/slime/cvsroot/slime/slime.el 2006/12/05 12:58:41 1.694 @@ -6810,6 +6810,7 @@ (save-excursion (save-match-data (when (and (buffer-file-name) + (file-exists-p (buffer-file-name)) (slime-background-activities-enabled-p)) (let ((filename (slime-to-lisp-filename (buffer-file-name)))) (slime-eval-async `(swank:buffer-first-change ,filename))))))) From heller at common-lisp.net Tue Dec 5 13:00:42 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 08:00:42 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205130042.0F37E5F004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20755 Modified Files: swank-source-file-cache.lisp Log Message: (buffer-first-change): Always return nil. --- /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/12/05 12:58:12 1.7 +++ /project/slime/cvsroot/slime/swank-source-file-cache.lisp 2006/12/05 13:00:42 1.8 @@ -43,7 +43,8 @@ This is a win if the user then saves the file and tries to M-. into it." (unless (source-cached-p filename) (ignore-errors - (source-cache-get filename (file-write-date filename))))) + (source-cache-get filename (file-write-date filename)))) + nil) (defun get-source-code (filename code-date) "Return the source code for FILENAME as written on DATE in a string. From heller at common-lisp.net Tue Dec 5 13:01:24 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 08:01:24 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205130124.6BBEE6301A@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv21375 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/05 04:46:06 1.1010 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/05 13:01:23 1.1011 @@ -1,4 +1,16 @@ +2006-12-05 Helmut Eller + + * slime.el (slime-first-change-hook): Don't do anything if buffers + file doesn't exist. + + * swank-source-file-cache.lisp (buffer-first-change): Always + return nil and remove the now redundant test with probe-file. + + * swank-backend.lisp (guess-external-format): Return nil if the + file can't be opened. Previusly we wrongly read from stdin. + 2006-12-05 Juho Snellman + Real xref support for SBCL (requires SBCL 1.0.0.18). * swank-sbcl.lisp (who-calls): New function, fetch xref data from From heller at common-lisp.net Tue Dec 5 13:06:37 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 08:06:37 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205130637.5CFD556006@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv23586 Modified Files: slime.el Log Message: (match-string-no-properties): Define it for XEmacs compatibility. --- /project/slime/cvsroot/slime/slime.el 2006/12/05 12:58:41 1.694 +++ /project/slime/cvsroot/slime/slime.el 2006/12/05 13:06:37 1.695 @@ -10848,6 +10848,14 @@ (set-text-properties 0 (- end start) nil string) string)) +(slime-defun-if-undefined match-string-no-properties (num &optional string) + (if (match-beginning num) + (if string + (substring-no-properties string (match-beginning num) + (match-end num)) + (substring-no-properties (match-beginning num) + (match-end num))))) + (slime-defun-if-undefined set-window-text-height (window height) (let ((delta (- height (window-text-height window)))) (unless (zerop delta) From heller at common-lisp.net Tue Dec 5 13:54:34 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 08:54:34 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205135434.B865736009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv32480 Modified Files: swank.lisp Log Message: (create-swank-server): Deleted. Use create-server instead. --- /project/slime/cvsroot/slime/swank.lisp 2006/11/21 20:35:44 1.419 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/05 13:54:34 1.420 @@ -16,7 +16,6 @@ (:use :common-lisp :swank-backend) (:export #:startup-multiprocessing #:start-server - #:create-swank-server #:create-server #:ed-in-emacs #:print-indentation-lossage @@ -440,12 +439,6 @@ (or (find-external-format coding-system) (error "Unsupported coding system: ~s" coding-system))) -(defun create-swank-server (&optional (port default-server-port) - (style *communication-style*) - (announce-fn #'simple-announce-function) - dont-close (external-format *coding-system*)) - (setup-server port announce-fn style dont-close external-format)) - (defparameter *loopback-interface* "127.0.0.1") (defun setup-server (port announce-fn style dont-close external-format) From heller at common-lisp.net Tue Dec 5 13:54:51 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 08:54:51 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205135451.A4C3C7C036@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv32601 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/05 13:01:23 1.1011 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/05 13:54:50 1.1012 @@ -1,5 +1,8 @@ 2006-12-05 Helmut Eller + * swank.lisp (create-swank-server): Removed. Use create-server + instead. + * slime.el (slime-first-change-hook): Don't do anything if buffers file doesn't exist. From heller at common-lisp.net Tue Dec 5 14:36:04 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 09:36:04 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205143604.5C69437011@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8591 Modified Files: slime.el Log Message: (slime-start, slime-set-connection-info): Add support for a :init-function which is called after the usual initialization of the connection is completed. --- /project/slime/cvsroot/slime/slime.el 2006/12/05 13:06:37 1.695 +++ /project/slime/cvsroot/slime/slime.el 2006/12/05 14:36:04 1.696 @@ -1528,9 +1528,11 @@ (coding-system slime-net-coding-system) (init 'slime-init-command) name - (buffer "*inferior-lisp*")) + (buffer "*inferior-lisp*") + init-function) (let ((args (list :program program :program-args program-args :buffer buffer - :coding-system coding-system :init init :name name))) + :coding-system coding-system :init init :name name + :init-function init-function))) (slime-check-coding-system coding-system) (when (or (not (slime-bytecode-stale-p)) (slime-urge-bytecode-recompile)) @@ -2284,14 +2286,17 @@ (destructuring-bind (&key instance type version) machine (setf (slime-machine-instance) instance))) (setq slime-state-name "") ; FIXME - (when-let (p (slime-inferior-process)) - (when-let (name (plist-get (slime-inferior-lisp-args p) ':name)) + (let ((args (when-let (p (slime-inferior-process)) + (slime-inferior-lisp-args p)))) + (when-let (name (plist-get args ':name)) (unless (string= (slime-lisp-implementation-name) name) (setf (slime-connection-name) - (slime-generate-connection-name (symbol-name name)))))) - (slime-hide-inferior-lisp-buffer) - (slime-init-output-buffer connection) - (run-hooks 'slime-connected-hook) + (slime-generate-connection-name (symbol-name name))))) + (slime-hide-inferior-lisp-buffer) + (slime-init-output-buffer connection) + (run-hooks 'slime-connected-hook) + (when-let (fun (plist-get args ':init-function)) + (funcall fun))) (message "Connected. %s" (slime-random-words-of-encouragement)))) (defun slime-generate-connection-name (lisp-name) @@ -10853,8 +10858,8 @@ (if string (substring-no-properties string (match-beginning num) (match-end num)) - (substring-no-properties (match-beginning num) - (match-end num))))) + (buffer-substring-no-properties (match-beginning num) + (match-end num))))) (slime-defun-if-undefined set-window-text-height (window height) (let ((delta (- height (window-text-height window)))) From heller at common-lisp.net Tue Dec 5 14:36:34 2006 From: heller at common-lisp.net (heller) Date: Tue, 5 Dec 2006 09:36:34 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061205143634.5EFD93C005@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8656 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/05 13:54:50 1.1012 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/05 14:36:34 1.1013 @@ -5,6 +5,9 @@ * slime.el (slime-first-change-hook): Don't do anything if buffers file doesn't exist. + (slime-start, slime-set-connection-info): Add support for a + :init-function which is called after the usual initialization of the + connection is completed. * swank-source-file-cache.lisp (buffer-first-change): Always return nil and remove the now redundant test with probe-file. From mbaringer at common-lisp.net Wed Dec 6 11:36:10 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Wed, 6 Dec 2006 06:36:10 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061206113610.AEF6E19007@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26689 Modified Files: swank.lisp Log Message: --- /project/slime/cvsroot/slime/swank.lisp 2006/12/05 13:54:34 1.420 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/06 11:36:10 1.421 @@ -3460,8 +3460,7 @@ (parse-completion-arguments string default-package-name) (flet ((convert (vector &optional converter) (when vector - (loop for idx :upfrom 0 - while (< idx (length vector)) + (loop for idx below (length vector) for el = (aref vector idx) do (setf (aref vector idx) (convert-fuzzy-completion-result el converter internal-p package-name)))))) From mbaringer at common-lisp.net Wed Dec 6 11:36:23 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Wed, 6 Dec 2006 06:36:23 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061206113623.7B0782104C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26729 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/12/05 14:36:34 1.1013 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/06 11:36:23 1.1014 @@ -1,3 +1,8 @@ +2006-12-06 Johan Bockg?rd + + * swank.lisp (fuzzy-completion-set): Don't mix for clauses and + body clauses in loop. + 2006-12-05 Helmut Eller * swank.lisp (create-swank-server): Removed. Use create-server From mbaringer at common-lisp.net Wed Dec 6 11:50:36 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Wed, 6 Dec 2006 06:50:36 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061206115036.B340734002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30134 Modified Files: slime.el Log Message: (slime-search-buffer-package): Don't call match-string-no-properties if it's not defined (as is on some xemacs') (slime-repl-clear-buffer): Added optional prefix argument specifying how many lines to leave. --- /project/slime/cvsroot/slime/slime.el 2006/12/05 14:36:04 1.696 +++ /project/slime/cvsroot/slime/slime.el 2006/12/06 11:50:36 1.697 @@ -2514,7 +2514,11 @@ (save-excursion (when (or (re-search-backward regexp nil t) (re-search-forward regexp nil t)) - (let ((string (match-string-no-properties 2))) + (let ((string (if (fboundp 'match-string-no-properties) + (match-string-no-properties 2) + (buffer-substring-no-properties + (match-beginning 2) + (match-end 2))))) (cond ((string-match "^\"" string) (ignore-errors (read string))) ((string-match "^#?:" string) (substring string (match-end 0))) (t string))))))) @@ -3898,14 +3902,31 @@ (goto-char slime-repl-input-start-mark) (line-beginning-position))) -(defun slime-repl-clear-buffer () - "Delete the entire output generated by the Lisp process." - (interactive) - (slime-eval-async `(swank:clear-repl-results)) - (set-marker slime-repl-last-input-start-mark nil) - (let ((inhibit-read-only t)) - (delete-region (point-min) (slime-repl-input-line-beginning-position)) - (goto-char slime-repl-input-start-mark))) +(defun slime-repl-clear-buffer (&optional num-lines) + "Delete the output generated by the Lisp process. + +NUM-LINES, if provided, specifies the number of lines before the +repl's input line to leave. Specifying NUM-LINES causes swank to +remember the repl results so some memory leaking is possible." + (interactive "P") + (let ((effective-num-lines (cond + ((null num-lines) nil) + ((consp num-lines) (first num-lines)) + ((integerp num-lines) num-lines) + ((eql '- num-lines) -1)))) + (unless effective-num-lines + (slime-eval-async `(swank:clear-repl-results))) + (set-marker slime-repl-last-input-start-mark nil) + (let ((inhibit-read-only t)) + (delete-region (point-min) + (if num-lines + (save-excursion + (goto-char slime-repl-input-start-mark) + (forward-line (- effective-num-lines)) + (beginning-of-line) + (point)) + (slime-repl-input-line-beginning-position))) + (goto-char slime-repl-input-start-mark)))) (defun slime-repl-clear-output () "Delete the output inserted since the last input." From mbaringer at common-lisp.net Wed Dec 6 11:51:00 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Wed, 6 Dec 2006 06:51:00 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061206115100.DA4CB38004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30188 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/12/06 11:36:23 1.1014 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/06 11:51:00 1.1015 @@ -1,3 +1,11 @@ +2006-12-06 Marco Baringer + + * slime.el (slime-search-buffer-package): Don't call + match-string-no-properties if it's not defined (as is on some + xemacs') + (slime-repl-clear-buffer): Added optional prefix argument + specifying how many lines to leave. + 2006-12-06 Johan Bockg?rd * swank.lisp (fuzzy-completion-set): Don't mix for clauses and From heller at common-lisp.net Thu Dec 7 07:36:54 2006 From: heller at common-lisp.net (heller) Date: Thu, 7 Dec 2006 02:36:54 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061207073654.CEA1B100D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30078 Modified Files: hyperspec.el Log Message: (common-lisp-hyperspec): Strip all text properties from the symbol-at-point to avoid problems with read-only text. Patch from Paul Collins . --- /project/slime/cvsroot/slime/hyperspec.el 2006/10/28 08:44:41 1.10 +++ /project/slime/cvsroot/slime/hyperspec.el 2006/12/07 07:36:54 1.11 @@ -86,9 +86,10 @@ (interactive (list (let* ((symbol-at-point (thing-at-point 'symbol)) (stripped-symbol (and symbol-at-point - (downcase - (common-lisp-hyperspec-strip-cl-package - symbol-at-point))))) + (substring-no-properties + (downcase + (common-lisp-hyperspec-strip-cl-package + symbol-at-point)))))) (if (and stripped-symbol (intern-soft stripped-symbol common-lisp-hyperspec-symbols)) From heller at common-lisp.net Thu Dec 7 07:37:04 2006 From: heller at common-lisp.net (heller) Date: Thu, 7 Dec 2006 02:37:04 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061207073704.DBAC8A0FF@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30137 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/06 11:51:00 1.1015 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/07 07:37:04 1.1016 @@ -1,3 +1,8 @@ +2006-12-07 Paul Collins + + * hyperspec.el (common-lisp-hyperspec): Strip all text properties + from the symbol-at-point to avoid problems with read-only text. + 2006-12-06 Marco Baringer * slime.el (slime-search-buffer-package): Don't call From mbaringer at common-lisp.net Thu Dec 7 11:08:59 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 7 Dec 2006 06:08:59 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061207110859.D369732011@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv2599 Modified Files: slime.el Log Message: (slime-inspect): If a prefix argument is provided pass :eval nil to swank:init-inspector. --- /project/slime/cvsroot/slime/slime.el 2006/12/06 11:50:36 1.697 +++ /project/slime/cvsroot/slime/slime.el 2006/12/07 11:08:57 1.698 @@ -9020,9 +9020,15 @@ (defvar slime-saved-window-config) (defun slime-inspect (form &optional no-reset) - "Eval an expression and inspect the result." - (interactive (list (slime-read-object "Inspect value (evaluated): "))) - (slime-eval-async `(swank:init-inspector ,form ,(not no-reset)) + "Eval an expression and inspect the result. + +If called with a prefix argument the value will not be evaluated." + (interactive (list (slime-read-object (if current-prefix-arg + "Inspect value: " + "Inspect value (evaluated): ")))) + (slime-eval-async `(swank:init-inspector ,form + :reset ,(not no-reset) + :eval ,(null current-prefix-arg)) 'slime-open-inspector)) (defun slime-read-object (prompt) From mbaringer at common-lisp.net Thu Dec 7 11:09:19 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 7 Dec 2006 06:09:19 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061207110919.5A6DB3C006@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv2654 Modified Files: swank.lisp Log Message: (init-inspector): Added eval parameter. If NIL we don't eval FORM but limit our selves to cl:read'ing it and inspecting that value. --- /project/slime/cvsroot/slime/swank.lisp 2006/12/06 11:36:10 1.421 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/07 11:09:19 1.422 @@ -4763,11 +4763,15 @@ *inspectee-actions* (make-array 10 :adjustable t :fill-pointer 0) *inspector-history* (make-array 10 :adjustable t :fill-pointer 0))) -(defslimefun init-inspector (string &optional (reset t)) +(defslimefun init-inspector (string &key (reset t) (eval t)) (with-buffer-syntax () (when reset (reset-inspector)) - (inspect-object (eval (read-from-string string))))) + (let* ((form (read-from-string string)) + (value (if eval + (eval form) + form))) + (inspect-object value)))) (defun print-part-to-string (value) (let ((string (to-string value)) From mbaringer at common-lisp.net Thu Dec 7 11:09:46 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 7 Dec 2006 06:09:46 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061207110946.3F3167E00D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv2693 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/12/07 07:37:04 1.1016 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/07 11:09:46 1.1017 @@ -1,3 +1,12 @@ +2006-12-07 mb + + * swank.lisp (init-inspector): Added eval parameter. If NIL we + don't eval FORM but limit our selves to cl:read'ing it and + inspecting that value. + + * slime.el (slime-inspect): If a prefix argument is provided pass + :eval nil to swank:init-inspector. + 2006-12-07 Paul Collins * hyperspec.el (common-lisp-hyperspec): Strip all text properties From mbaringer at common-lisp.net Fri Dec 8 13:32:45 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Fri, 8 Dec 2006 08:32:45 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061208133245.888F74057@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30230 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/12/07 11:09:46 1.1017 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/08 13:32:45 1.1018 @@ -1,4 +1,4 @@ -2006-12-07 mb +2006-12-07 Marco Baringer * swank.lisp (init-inspector): Added eval parameter. If NIL we don't eval FORM but limit our selves to cl:read'ing it and From alendvai at common-lisp.net Mon Dec 11 12:29:37 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:29:37 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211122937.E94D222018@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27052 Modified Files: slime.el Log Message: Use a hashtable to remove duplicates in slime-repl-merge-histories --- /project/slime/cvsroot/slime/slime.el 2006/12/07 11:08:57 1.698 +++ /project/slime/cvsroot/slime/slime.el 2006/12/11 12:29:37 1.699 @@ -4085,19 +4085,16 @@ (defun slime-repl-merge-histories (old-hist new-hist) "Merge entries from OLD-HIST and NEW-HIST." ;; Newer items in each list are at the beginning. - (append - ;; first the new unique elements... - (remove-if #'(lambda (entry) - (member entry old-hist)) - new-hist) - ;; then the old unique elements... - (remove-if #'(lambda (entry) - (member entry new-hist)) - old-hist) - ;; and finally elements existing in both lists - (remove-if #'(lambda (entry) - (not (member entry old-hist))) - new-hist))) + (let* ((ht (make-hash-table :test #'equal)) + (delete-tester #'(lambda (entry) + (if (gethash entry ht) + t + (progn + (puthash entry t ht) + nil))))) + (append + (remove-if delete-tester new-hist) + (remove-if delete-tester old-hist)))) (defun slime-repl-load-history (&optional filename) "Set the current SLIME REPL history. From alendvai at common-lisp.net Mon Dec 11 12:35:08 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:35:08 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211123508.9DF392E1BA@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27562 Modified Files: slime.el Log Message: slime-repl-kill-input kills the entire input when point is at the prompt and resets the history navigation state --- /project/slime/cvsroot/slime/slime.el 2006/12/11 12:29:37 1.699 +++ /project/slime/cvsroot/slime/slime.el 2006/12/11 12:35:08 1.700 @@ -3888,10 +3888,15 @@ (delete-region slime-repl-input-start-mark slime-repl-input-end-mark)) (defun slime-repl-kill-input () - "Kill all text from last stuff output by the Lisp process to point." - (interactive) - (when (> (point) (marker-position slime-repl-input-start-mark)) - (kill-region slime-repl-input-start-mark (point)))) + "Kill all text from the prompt to point and reset repl history +navigation state. If point is right after the prompt then delete +the entire input." + (interactive) + (cond ((> (point) (marker-position slime-repl-input-start-mark)) + (kill-region slime-repl-input-start-mark (point))) + ((= (point) (marker-position slime-repl-input-start-mark)) + (slime-repl-delete-current-input))) + (setf slime-repl-input-history-position -1)) (defun slime-repl-replace-input (string) (slime-repl-delete-current-input) From alendvai at common-lisp.net Mon Dec 11 12:38:51 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:38:51 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211123851.6306432015@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv27850 Modified Files: slime.el Log Message: Added slime-repl-delete-from-input-history that deletes the current history entry when no input is supplied --- /project/slime/cvsroot/slime/slime.el 2006/12/11 12:35:08 1.700 +++ /project/slime/cvsroot/slime/slime.el 2006/12/11 12:38:50 1.701 @@ -3620,6 +3620,23 @@ (push string slime-repl-input-history)) (setq slime-repl-input-history-position -1)) +(defun slime-repl-delete-from-input-history (&optional string) + "Delete STRING from the repl input history. When string is not +provided then clear the current repl input and use it as an input. +This is useful to get rid of unwanted repl history entries while +navigating the repl history." + (interactive) + (unless string + (setf string (slime-repl-current-input)) + (slime-repl-delete-current-input)) + (let ((file slime-repl-history-file)) + (message "saving history...") + (let ((merged-history (slime-repl-merge-histories slime-repl-input-history + (slime-repl-read-history file t)))) + (setf slime-repl-input-history (delete* string merged-history :test 'string=)) + (slime-repl-save-history file slime-repl-input-history))) + (slime-repl-jump-to-history-item)) + (defun slime-repl-eval-string (string) (slime-rex () ((list 'swank:listener-eval string) (slime-lisp-package)) @@ -4215,6 +4232,7 @@ ((kbd "C-") 'slime-repl-next-input) ("\M-r" 'slime-repl-previous-matching-input) ("\M-s" 'slime-repl-next-matching-input) + ("\M-\C-d" 'slime-repl-delete-from-input-history) ("\C-c\C-c" 'slime-interrupt) ("\C-c\C-b" 'slime-interrupt) ("\C-c:" 'slime-interactive-eval) From alendvai at common-lisp.net Mon Dec 11 12:44:02 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:44:02 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211124402.84E3334000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv29539 Modified Files: .cvsignore swank.lisp Log Message: FIX: Drop #\. and add #\, to escaped symbol chars --- /project/slime/cvsroot/slime/.cvsignore 2004/09/15 11:29:05 1.3 +++ /project/slime/cvsroot/slime/.cvsignore 2006/12/11 12:44:02 1.4 @@ -2,3 +2,4 @@ *.fasl *.dfsl *.elc +_darcs --- /project/slime/cvsroot/slime/swank.lisp 2006/12/07 11:09:19 1.422 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/11 12:44:02 1.423 @@ -3264,7 +3264,7 @@ (case-converter-with-escaping (completion-output-case-converter input t))) (lambda (str) (if (some (lambda (el) - (member el '(#\: #\. #\ #\Newline #\Tab))) + (member el '(#\: #\, #\ #\Newline #\Tab))) str) (concatenate 'string "|" (funcall case-converter-with-escaping str) "|") (funcall case-converter str))))) From alendvai at common-lisp.net Mon Dec 11 12:50:50 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:50:50 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211125050.8CA5B34000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30005 Modified Files: slime.el Log Message: FIX: slime-symbol-name-at-point for symbols like foo::|bar::baz| --- /project/slime/cvsroot/slime/slime.el 2006/12/11 12:38:50 1.701 +++ /project/slime/cvsroot/slime/slime.el 2006/12/11 12:50:50 1.702 @@ -10657,7 +10657,7 @@ (while (slime-point-moves-p (skip-syntax-backward "w_") (when (eq (char-before) ?|) - (backward-sexp))))) + (backward-char))))) (when (eq (char-before) ?#) ; special case for things like "# Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30109 Modified Files: swank-backend.lisp swank.lisp Log Message: Added inspect-slot-for-emacs to let users customize it. Use all-slots-for-inspector everywhere, render link to both the effective and direct slots when both are available. Dropped slot-value-using-class-for-inspector and friends. Added slot-makunbound-using-class to the swank-mop package and added a [make-unbound] action to the standard slot presentation. --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/05 12:57:57 1.110 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/11 12:51:59 1.111 @@ -88,6 +88,7 @@ #:slot-definition-writers #:slot-boundp-using-class #:slot-value-using-class + #:slot-makunbound-using-class ;; generic function protocol #:compute-applicable-methods-using-classes #:finalize-inheritance)) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/11 12:44:02 1.423 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/11 12:51:59 1.424 @@ -21,6 +21,8 @@ #:print-indentation-lossage #:swank-debugger-hook #:run-after-init-hook + #:inspect-for-emacs + #:inspect-slot-for-emacs ;; These are user-configurable variables: #:*communication-style* #:*dont-close* @@ -4358,20 +4360,11 @@ (method-specializers-for-inspect method))) (defmethod inspect-for-emacs ((o standard-object) inspector) - (declare (ignore inspector)) (let ((c (class-of o))) (values "An object." `("Class: " (:value ,c) (:newline) "Slots:" (:newline) - ,@(loop for slotd in (swank-mop:class-slots c) - for name = (swank-mop:slot-definition-name slotd) - collect `(:value ,slotd ,(string name)) - collect " = " - collect (if (slot-boundp-using-class-for-inspector c o slotd) - `(:value ,(slot-value-using-class-for-inspector - c o slotd)) - "#") - collect '(:newline)))))) + ,@(all-slots-for-inspector o inspector))))) (defvar *gf-method-getter* 'methods-by-applicability "This function is called to get the methods of a generic function. @@ -4408,13 +4401,13 @@ maxlen (length doc)))) -(defgeneric slot-value-using-class-for-inspector (class object slot) - (:method (class object slot) - (swank-mop:slot-value-using-class class object slot))) - -(defgeneric slot-boundp-using-class-for-inspector (class object slot) +(defgeneric inspect-slot-for-emacs (class object slot) (:method (class object slot) - (swank-mop:slot-boundp-using-class class object slot))) + (if (swank-mop:slot-boundp-using-class class object slot) + `((:value ,(swank-mop:slot-value-using-class class object slot)) + " " (:action "[make unbound]" + ,(lambda () (swank-mop:slot-makunbound-using-class class object slot)))) + '("#")))) (defgeneric all-slots-for-inspector (object inspector) (:method ((object standard-object) inspector) @@ -4422,25 +4415,16 @@ (append '("------------------------------" (:newline) "All Slots:" (:newline)) (loop - with class = (class-of object) with direct-slots = (swank-mop:class-direct-slots (class-of object)) - for slot in (swank-mop:class-slots (class-of object)) - for slot-def = (or (find-if (lambda (a) - ;; find the direct slot - ;; with the same name - ;; as SLOT (an - ;; effective slot). - (eql (swank-mop:slot-definition-name a) - (swank-mop:slot-definition-name slot))) - direct-slots) - slot) - collect `(:value ,slot-def ,(inspector-princ (swank-mop:slot-definition-name slot-def))) + for effective-slot :in (swank-mop:class-slots (class-of object)) + for direct-slot = (find (swank-mop:slot-definition-name effective-slot) + direct-slots :key #'swank-mop:slot-definition-name) + collect `(:value ,(if direct-slot + (list direct-slot effective-slot) + effective-slot) + ,(inspector-princ (swank-mop:slot-definition-name effective-slot))) collect " = " - if (slot-boundp-using-class-for-inspector class object slot) - collect `(:value ,(slot-value-using-class-for-inspector - (class-of object) object slot)) - else - collect "#" + append (inspect-slot-for-emacs (class-of object) object effective-slot) collect '(:newline))))) (defmethod inspect-for-emacs ((gf standard-generic-function) inspector) From alendvai at common-lisp.net Mon Dec 11 12:54:15 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:54:15 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211125415.9D2BA7E003@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30221 Modified Files: slime.el Log Message: Fix/smarten up temp-buffer-quit Now it tries its best to remember the original window config and restore it at slime-temp-buffer-quit unless it was changed meanwhile. IOW, fix "q" after macroexpand in a macroexpand buffer not closing the temp window. Also fix the compiler notes usage of the temp buffer. --- /project/slime/cvsroot/slime/slime.el 2006/12/11 12:50:50 1.702 +++ /project/slime/cvsroot/slime/slime.el 2006/12/11 12:54:15 1.703 @@ -1307,17 +1307,30 @@ If REUSEP is true and a buffer does already exist with name NAME, then the buffer will be reused instead of being killed." - (let ((window-config (current-window-configuration))) - (when (and (get-buffer name) (not reusep)) (kill-buffer name)) - (with-current-buffer (get-buffer-create name) - (when mode (funcall mode)) + (let ((window-config (current-window-configuration)) + (buffer (get-buffer name))) + (when (and buffer (not reusep)) + (kill-buffer name) + (setq buffer nil)) + (with-current-buffer (or buffer (get-buffer-create name)) + (when mode + (let ((original-configuration slime-temp-buffer-saved-window-configuration) + (original-fingerprint slime-temp-buffer-fingerprint)) + (funcall mode) + (setq slime-temp-buffer-saved-window-configuration original-configuration) + (setq slime-temp-buffer-fingerprint original-fingerprint))) (slime-temp-buffer-mode 1) - (setq slime-temp-buffer-saved-window-configuration window-config) - (let ((window (if noselectp - (display-buffer (current-buffer) t) - (pop-to-buffer (current-buffer)) - (selected-window)))) - (setq slime-temp-buffer-fingerprint (slime-window-config-fingerprint))) + (let ((window (get-buffer-window (current-buffer)))) + (if window + (unless noselectp + (select-window window)) + (progn + (if noselectp + (display-buffer (current-buffer) t) + (pop-to-buffer (current-buffer)) + (selected-window)) + (setq slime-temp-buffer-saved-window-configuration window-config) + (setq slime-temp-buffer-fingerprint (slime-window-config-fingerprint))))) (current-buffer)))) ;; Interface @@ -1349,25 +1362,20 @@ '(("q" . slime-temp-buffer-quit))) ;; Interface -(defun slime-temp-buffer-quit () - "Kill the current (temp) buffer without asking. To restore the -window configuration without killing the buffer see -`slime-dismiss-temp-buffer'." - (interactive) - (let* ((buffer (current-buffer)) - (window (get-buffer-window buffer))) - (kill-buffer buffer) - (when window - (delete-window window)))) - -;; Interface -(defun slime-dismiss-temp-buffer () - "Dismiss the current temp buffer and restore previous window config. -Don't change the window configuration if it has been significantly -changed since the temp buffer was displayed." - (when (equalp (slime-window-config-fingerprint) - slime-temp-buffer-fingerprint) - (set-window-configuration slime-temp-buffer-saved-window-configuration))) +(defun slime-temp-buffer-quit (&optional kill-buffer-p) + "Get rid of the current (temp) buffer without asking. Restore the +window configuration unless it was changed since we last activated the buffer." + (interactive) + (let ((saved-window-config slime-temp-buffer-saved-window-configuration) + (temp-buffer (current-buffer))) + (setq slime-temp-buffer-saved-window-configuration nil) + (if (and saved-window-config + (equalp (slime-window-config-fingerprint) + slime-temp-buffer-fingerprint)) + (set-window-configuration saved-window-config) + (bury-buffer)) + (when kill-buffer-p + (kill-buffer temp-buffer)))) (defun slime-window-config-fingerprint (&optional frame) "Return a fingerprint of the current window configuration. @@ -4958,7 +4966,7 @@ (slime-define-keys slime-compiler-notes-mode-map ((kbd "RET") 'slime-compiler-notes-default-action-or-show-details) ([mouse-2] 'slime-compiler-notes-default-action-or-show-details/mouse) - ("q" 'slime-compiler-notes-quit)) + ("q" 'slime-temp-buffer-quit)) (defun slime-compiler-notes-default-action-or-show-details/mouse (event) "Invoke the action pointed at by the mouse, or show details." @@ -4976,12 +4984,6 @@ (let ((fn (get-text-property (point) 'slime-compiler-notes-default-action))) (if fn (funcall fn) (slime-compiler-notes-show-details)))) -(defun slime-compiler-notes-quit () - (interactive) - (let ((config slime-temp-buffer-saved-window-configuration)) - (kill-buffer (current-buffer)) - (set-window-configuration config))) - (defun slime-compiler-notes-show-details () (interactive) (let* ((tree (slime-tree-at-point)) @@ -7115,14 +7117,13 @@ (defun slime-edit-value-callback (form-string current-value package) (let ((name (generate-new-buffer-name (format "*Edit %s*" form-string)))) (with-current-buffer (slime-get-temp-buffer-create name :mode 'lisp-mode) - (slime-mode 1) - (slime-temp-buffer-mode -1) ; don't want binding of 'q' - (slime-edit-value-mode 1) - (setq slime-edit-form-string form-string) - (setq slime-buffer-connection (slime-connection)) - (setq slime-buffer-package package) - (insert current-value) - (pop-to-buffer (current-buffer))))) + (slime-mode 1) + (slime-temp-buffer-mode -1) ; don't want binding of 'q' + (slime-edit-value-mode 1) + (setq slime-edit-form-string form-string) + (setq slime-buffer-connection (slime-connection)) + (setq slime-buffer-package package) + (insert current-value)))) (defun slime-edit-value-commit () "Commit the edited value to the Lisp image. @@ -7136,8 +7137,7 @@ ,value) (lambda (_) (with-current-buffer buffer - (slime-dismiss-temp-buffer) - (kill-buffer buffer)))))))) + (slime-temp-buffer-quit t)))))))) ;;;; Tracing From alendvai at common-lisp.net Mon Dec 11 12:55:55 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 07:55:55 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211125555.8AA7D7E005@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv30412 Modified Files: slime.el Log Message: Work on repl history navigation, restore old M-p/M-n behaviour due to #lisp demand Also print the current regexp in the minibuffer messages. M-p/M-n takes the repl input up to the point not the entire input as it did before. slime-repl-previous/next-input-starting-with-current-input: new names for the old M-p/M-n commands History navigation commands jump to the end of buffer when point is before the prompt. --- /project/slime/cvsroot/slime/slime.el 2006/12/11 12:54:15 1.703 +++ /project/slime/cvsroot/slime/slime.el 2006/12/11 12:55:55 1.704 @@ -3574,12 +3574,15 @@ (goto-char (point-max)) (recenter -1)))))) -(defun slime-repl-current-input () +(defun slime-repl-current-input (&optional until-point-p) "Return the current input as string. The input is the region from after the last prompt to the end of buffer. Presentations of old results are expanded into code." (slime-buffer-substring-with-reified-output slime-repl-input-start-mark - slime-repl-input-end-mark)) + (if (and until-point-p + (<= (point) slime-repl-input-end-mark)) + (point) + slime-repl-input-end-mark))) (defun slime-presentation-expression (presentation) "Return a string that contains a CL s-expression accessing @@ -4002,6 +4005,18 @@ (defvar slime-repl-history-map (make-sparse-keymap) "Map active while in the minibuffer reading repl search regexp.") +(defvar slime-repl-history-navigation-neutral-commands + '(slime-repl-previous-matching-input + slime-repl-next-matching-input + slime-repl-previous-input-starting-with-current-input + slime-repl-next-input-starting-with-current-input + slime-repl-delete-from-input-history)) + +(defun* slime-repl-jump-to-history-item (&optional (pos slime-repl-input-history-position)) + (when (>= pos 0) + (slime-repl-replace-input (nth pos slime-repl-input-history)) + (message "History item: %d, current regexp: %s" pos slime-repl-history-pattern))) + (defun* slime-repl-history-replace (direction &optional regexp delete-at-end-p) "Replace the current input with the next line in DIRECTION matching REGEXP. DIRECTION is 'forward' or 'backward' (in the history list). @@ -4021,16 +4036,16 @@ (when (and pos (or (< pos 0) (>= pos history-length))) - (setf pos nil)) (cond (pos - (slime-repl-replace-input (nth pos slime-repl-input-history)) (setq slime-repl-input-history-position pos) - (message "History item: %d" pos)) + (slime-repl-jump-to-history-item)) ((and delete-at-end-p (not slime-repl-wrap-history)) (cond (forward (slime-repl-replace-input "") - (message "End of history")) - (t (message "Beginning of history"))) + (message "End of history; current regexp: %s" + slime-repl-history-pattern)) + (t (message "Beginning of history; current regexp: %s" + slime-repl-history-pattern))) (setq slime-repl-input-history-position (if forward -1 history-length))) ((and delete-at-end-p slime-repl-wrap-history) @@ -4038,7 +4053,8 @@ (setq slime-repl-input-history-position (if forward history-length -1))) (t - (message "End of history; no matching item") + (message "End of history; no matching item; current regexp: %s" + slime-repl-history-pattern) (return-from slime-repl-history-replace nil)))) t) @@ -4059,13 +4075,31 @@ (not (string= string (slime-repl-current-input)))) (return pos)))))) +(defun slime-repl-previous-or-next-input (direction) + (when (< (point) (marker-position slime-repl-input-start-mark)) + (goto-char (point-max))) + (slime-repl-history-replace direction nil t)) + (defun slime-repl-previous-input () (interactive) - (slime-repl-history-replace 'backward nil t)) + (slime-repl-previous-or-next-input 'backward)) (defun slime-repl-next-input () (interactive) - (slime-repl-history-replace 'forward nil t)) + (slime-repl-previous-or-next-input 'forward)) + +(defun slime-repl-starting-with-current-input-regexp () + (if (memq last-command slime-repl-history-navigation-neutral-commands) + slime-repl-history-pattern + (concat "^" (regexp-quote (slime-repl-current-input t))))) + +(defun slime-repl-previous-input-starting-with-current-input () + (interactive) + (slime-repl-history-replace 'backward (slime-repl-starting-with-current-input-regexp) t)) + +(defun slime-repl-next-input-starting-with-current-input () + (interactive) + (slime-repl-history-replace 'forward (slime-repl-starting-with-current-input-regexp) t)) (defun slime-repl-matching-input-regexp () (if (memq last-command @@ -4087,17 +4121,18 @@ (throw 'continue slime-repl-history-pattern))) (defun slime-repl-previous-or-next-matching-input (regexp direction prompt) + (when (< (point) (marker-position slime-repl-input-start-mark)) + (goto-char (point-max))) (let ((command this-command)) (unless regexp (setf regexp (if (and slime-repl-history-pattern - (memq last-command - '(slime-repl-previous-matching-input slime-repl-next-matching-input))) + (memq last-command slime-repl-history-navigation-neutral-commands)) slime-repl-history-pattern (catch 'continue (slime-read-from-minibuffer prompt (slime-symbol-name-at-point) slime-repl-history-map))))) (when (and regexp (> (length regexp) 0)) - (when (slime-repl-history-replace direction regexp) + (when (slime-repl-history-replace direction regexp t) (setf this-command command))))) (defun slime-repl-previous-matching-input () From alendvai at common-lisp.net Mon Dec 11 14:12:14 2006 From: alendvai at common-lisp.net (alendvai) Date: Mon, 11 Dec 2006 09:12:14 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061211141214.EF2895F000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13060 Modified Files: swank.lisp Log Message: Added [set value] command for slot inspecting --- /project/slime/cvsroot/slime/swank.lisp 2006/12/11 12:51:59 1.424 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/11 14:12:14 1.425 @@ -4403,11 +4403,24 @@ (defgeneric inspect-slot-for-emacs (class object slot) (:method (class object slot) - (if (swank-mop:slot-boundp-using-class class object slot) - `((:value ,(swank-mop:slot-value-using-class class object slot)) - " " (:action "[make unbound]" - ,(lambda () (swank-mop:slot-makunbound-using-class class object slot)))) - '("#")))) + (let ((slot-name (swank-mop:slot-definition-name slot))) + `(,@(if (swank-mop:slot-boundp-using-class class object slot) + `((:value ,(swank-mop:slot-value-using-class class object slot)) + " " (:action "[make unbound]" + ,(lambda () (swank-mop:slot-makunbound-using-class class object slot)))) + '("#")) + " " (:action "[set value]" + ,(lambda () (with-simple-restart + (abort "Abort setting slot ~S" slot-name) + (let ((value-string (eval-in-emacs + `(condition-case c + (slime-read-object + ,(format nil "Set slot ~S to (evaluated) : " slot-name)) + (quit nil))))) + (when (and value-string + (not (string= value-string ""))) + (setf (swank-mop:slot-value-using-class class object slot) + (eval (read-from-string value-string)))))))))))) (defgeneric all-slots-for-inspector (object inspector) (:method ((object standard-object) inspector) From nsiivola at common-lisp.net Tue Dec 12 15:40:23 2006 From: nsiivola at common-lisp.net (nsiivola) Date: Tue, 12 Dec 2006 10:40:23 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061212154023.B32936D078@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6807 Modified Files: ChangeLog slime.el swank-backend.lisp swank.lisp Log Message: Implement INSPECT-IN-EMACS, tweak inspection of integers. --- /project/slime/cvsroot/slime/ChangeLog 2006/12/08 13:32:45 1.1018 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/12 15:40:19 1.1019 @@ -1,3 +1,20 @@ +2006-12-12 Nikodemus Siivola + + * swank.lisp (inspect-for-emacs integer): Pad the hex formatted + value to eight digits, "Code-char:" instead of "Corresponding + character:", "Integer-length:" instead of "Length:", + "Universal-time:" instead of "As time". + (inspect-object): Use TYPE-FOR-EMACS instead of TYPE-OF. + (inspect-in-emacs): New function, analogous to ED-IN-EMACS. + + * swank-backend.lisp (type-for-emacs): New generic function, + defaults to TYPE-OF for non-integers, and returns FIXNUM or BIGNUM + for integers. + + * slime.el (destructure-case): Indicate in the error message that + it was the Elisp destructure-case that failed to avoid confusion. + (slime-check-eval-in-emacs-enabled): More verbose error message. + 2006-12-07 Marco Baringer * swank.lisp (init-inspector): Added eval parameter. If NIL we --- /project/slime/cvsroot/slime/slime.el 2006/12/11 12:55:55 1.704 +++ /project/slime/cvsroot/slime/slime.el 2006/12/12 15:40:19 1.705 @@ -1122,7 +1122,7 @@ patterns) ,@(if (eq (caar (last patterns)) t) '() - `((t (error "destructure-case failed: %S" ,tmp)))))))) + `((t (error "Elisp destructure-case failed: %S" ,tmp)))))))) (put 'destructure-case 'lisp-indent-function 1) @@ -2687,14 +2687,16 @@ ((:open-dedicated-output-stream port) (slime-open-stream-to-lisp port)) ((:eval-no-wait fun args) - (slime-check-eval-in-emacs-enabled) (apply (intern fun) args)) ((:eval thread tag form-string) + (slime-check-eval-in-emacs-enabled) (slime-eval-for-lisp thread tag form-string)) ((:emacs-return thread tag value) (slime-send `(:emacs-return ,thread ,tag ,value))) ((:ed what) (slime-ed what)) + ((:inspect what) + (slime-open-inspector what)) ((:background-message message) (slime-background-message "%s" message)) ((:debug-condition thread message) @@ -6921,7 +6923,7 @@ (defun slime-check-eval-in-emacs-enabled () "Raise an error if `slime-enable-evaluate-in-emacs' isn't true." (unless slime-enable-evaluate-in-emacs - (error "eval-in-emacs not enabled"))) + (error "slime-eval-in-emacs disabled for security. Set slime-enable-evaluate-in-emacs true to enable it."))) ;;;; `ED' --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/11 12:51:59 1.111 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/12 15:40:23 1.112 @@ -38,6 +38,7 @@ #:fancy-inspection #:label-value-line #:label-value-line* + #:type-for-emacs )) (defpackage :swank-mop @@ -880,6 +881,20 @@ ` (append ,@(loop for (label value) in label-values collect `(label-value-line ,label ,value)))) +(defgeneric type-for-emacs (object) + (:documentation + "Return a type specifier suitable for display in the Emacs inspector.") + (:method (object) + (type-of object)) + (:method ((object integer)) + ;; Some lisps report integer types as (MOD ...), which while nice + ;; in a sense doesn't answer the often more immediate question of + ;; fixnumness. + (if (typep object 'fixnum) + 'fixnum + 'bignum))) + + (definterface describe-primitive-type (object) "Return a string describing the primitive type of object." (declare (ignore object)) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/11 14:12:14 1.425 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/12 15:40:23 1.426 @@ -18,6 +18,7 @@ #:start-server #:create-server #:ed-in-emacs + #:inspect-in-emacs #:print-indentation-lossage #:swank-debugger-hook #:run-after-init-hook @@ -730,7 +731,7 @@ (send (find-thread thread-id) `(take-input ,tag ,value))) (((:write-string :presentation-start :presentation-end :new-package :new-features :ed :%apply :indentation-update - :eval-no-wait :background-message) + :eval-no-wait :background-message :inspect) &rest _) (declare (ignore _)) (encode-message event socket-io)))) @@ -872,7 +873,7 @@ (((:write-string :new-package :new-features :debug-condition :presentation-start :presentation-end :indentation-update :ed :%apply :eval-no-wait - :background-message) + :background-message :inspect) &rest _) (declare (ignore _)) (send event))))) @@ -2666,6 +2667,19 @@ (send-oob-to-emacs `(:ed ,target)))) (t nil))))) +(defslimefun inspect-in-emacs (what) + "Inspect WHAT in Emacs." + (flet ((send-it () + (with-buffer-syntax () + (reset-inspector) + (send-oob-to-emacs `(:inspect ,(inspect-object what)))))) + (cond + (*emacs-connection* + (send-it)) + ((default-connection) + (with-connection ((default-connection)) + (send-it)))))) + (defslimefun value-for-editing (form) "Return a readable value of FORM for editing in Emacs. FORM is expected, but not required, to be SETF'able." @@ -4668,16 +4682,15 @@ (defmethod inspect-for-emacs ((i integer) inspector) (declare (ignore inspector)) (values "A number." - (append - `(,(format nil "Value: ~D = #x~X = #o~O = #b~,,' ,8:B = ~E" + (append + `(,(format nil "Value: ~D = #x~8,'0X = #o~O = #b~,,' ,8:B = ~E" i i i i i) (:newline)) - (if (< -1 i char-code-limit) - (label-value-line "Corresponding character" (code-char i))) - (label-value-line "Length" (integer-length i)) + (when (< -1 i char-code-limit) + (label-value-line "Code-char" (code-char i))) + (label-value-line "Integer-length" (integer-length i)) (ignore-errors - (list "As time: " - (format-iso8601-time i t)))))) + (label-value-line "Universal-time" (format-iso8601-time i t)))))) (defmethod inspect-for-emacs ((c complex) inspector) (declare (ignore inspector)) @@ -4814,7 +4827,7 @@ (multiple-value-bind (title content) (inspect-for-emacs object inspector) (list :title title - :type (to-string (type-of object)) + :type (to-string (type-for-emacs object)) :content (inspector-content-for-emacs content) :id (assign-index object *inspectee-parts*))))) From alendvai at common-lisp.net Wed Dec 13 16:57:47 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 13 Dec 2006 11:57:47 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061213165747.45B1247196@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv23070 Modified Files: swank.lisp Log Message: FIX: fuzzy completion for M-V-B. Fix by Madhu. --- /project/slime/cvsroot/slime/swank.lisp 2006/12/12 15:40:23 1.426 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/13 16:57:47 1.427 @@ -3253,7 +3253,7 @@ INPUT is used to guess the preferred case." (ecase (readtable-case *readtable*) (:upcase (cond ((or with-escaping-p - (every #'upper-case-p input)) + (not (some #'lower-case-p input))) #'identity) (t #'string-downcase))) (:invert (lambda (output) @@ -3263,7 +3263,7 @@ (upper (string-downcase output)) (t output))))) (:downcase (cond ((or with-escaping-p - (every #'lower-case-p input)) + (not (some #'upper-case-p input))) #'identity) (t #'string-upcase))) (:preserve #'identity))) From heller at common-lisp.net Thu Dec 14 15:58:12 2006 From: heller at common-lisp.net (heller) Date: Thu, 14 Dec 2006 10:58:12 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061214155812.8C6D33A019@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14694 Modified Files: ChangeLog Log Message: Update ChangeLog with Lendvai's commit messages. --- /project/slime/cvsroot/slime/ChangeLog 2006/12/12 15:40:19 1.1019 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/14 15:58:12 1.1020 @@ -1,3 +1,7 @@ +2006-12-13 Attila Lendvai + + * swank.lisp: FIX: fuzzy completion for M-V-B. Fix by Madhu. + 2006-12-12 Nikodemus Siivola * swank.lisp (inspect-for-emacs integer): Pad the hex formatted @@ -15,6 +19,52 @@ it was the Elisp destructure-case that failed to avoid confusion. (slime-check-eval-in-emacs-enabled): More verbose error message. +2006-12-11 Attila Lendvai + + * swank.lisp: Added [set value] command for slot inspecting + + * slime.el: Work on repl history navigation, restore old M-p/M-n + behaviour due to #lisp demand + + Also print the current regexp in the minibuffer messages. M-p/M-n + takes the repl input up to the point not the entire input as it + did before. + slime-repl-previous/next-input-starting-with-current-input: new + names for the old M-p/M-n commands History navigation commands + jump to the end of buffer when point is before the prompt. + + * slime.el: Fix/smarten up temp-buffer-quit + + Now it tries its best to remember the original window config and + restore it at slime-temp-buffer-quit unless it was changed + meanwhile. IOW, fix "q" after macroexpand in a macroexpand buffer + not closing the temp window. + Also fix the compiler notes usage of the temp buffer. + + * swank-backend.lisp, swank.lisp: + Added inspect-slot-for-emacs to let users customize it. + + Use all-slots-for-inspector everywhere, render link to both the + effective and direct slots when both are available. Dropped + slot-value-using-class-for-inspector and friends. Added + slot-makunbound-using-class to the swank-mop package and added + a [make-unbound] action to the standard slot presentation. + + * slime.el: FIX: slime-symbol-name-at-point for symbols like + foo::|bar::baz| + + * .cvsignore, swank.lisp: FIX: Drop #\. and add #\, to escaped + symbol chars + + * slime.el: Added slime-repl-delete-from-input-history that + deletes the current history entry when no input is supplied + + * slime.el: slime-repl-kill-input kills the entire input when + point is at the prompt and resets the history navigation state + + * slime.el: + Use a hashtable to remove duplicates in slime-repl-merge-histories + 2006-12-07 Marco Baringer * swank.lisp (init-inspector): Added eval parameter. If NIL we From heller at common-lisp.net Thu Dec 14 16:05:12 2006 From: heller at common-lisp.net (heller) Date: Thu, 14 Dec 2006 11:05:12 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061214160512.4CFEC7D002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16731 Modified Files: slime.el Log Message: (slime-repl-output-mouseover-face): Fix a pair of extra parens. Patch by Madhu . (slime-search-buffer-package): Remove Xemacs special casing. There's already a compatibility defun for match-string-no-properties. --- /project/slime/cvsroot/slime/slime.el 2006/12/12 15:40:19 1.705 +++ /project/slime/cvsroot/slime/slime.el 2006/12/14 16:05:12 1.706 @@ -505,7 +505,7 @@ (:box (:line-width 1 :color "black" :style released-button) :inherit - (slime-repl-inputed-output-face)))) + slime-repl-inputed-output-face))) '((t (:box (:line-width 1 :color "black")))))) "Face for Lisp output in the SLIME REPL, when the mouse hovers over it" :group 'slime-repl) @@ -2522,11 +2522,7 @@ (save-excursion (when (or (re-search-backward regexp nil t) (re-search-forward regexp nil t)) - (let ((string (if (fboundp 'match-string-no-properties) - (match-string-no-properties 2) - (buffer-substring-no-properties - (match-beginning 2) - (match-end 2))))) + (let ((string (match-string-no-properties 2))) (cond ((string-match "^\"" string) (ignore-errors (read string))) ((string-match "^#?:" string) (substring string (match-end 0))) (t string))))))) From heller at common-lisp.net Thu Dec 14 16:08:35 2006 From: heller at common-lisp.net (heller) Date: Thu, 14 Dec 2006 11:08:35 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061214160835.DC52048000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16913 Modified Files: swank-cmucl.lisp Log Message: (remove-gc-hooks): The variables EXT:*GC-NOTIFY-AFTER* and EXT:*NOTIFY-BEFORE* should hold functions and should be NIL. This affects the function REMOVE-GC-HOOKS in swank-cmucl.lisp which sets them to NIL, (should one happen to use it). Set them back to the original parameters. Patch by Madhu --- /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/11/23 23:13:27 1.168 +++ /project/slime/cvsroot/slime/swank-cmucl.lisp 2006/12/14 16:08:35 1.169 @@ -2178,8 +2178,8 @@ (setq ext:*gc-notify-after* #'post-gc-hook)) (defun remove-gc-hooks () - (setq ext:*gc-notify-before* nil) - (setq ext:*gc-notify-after* nil)) + (setq ext:*gc-notify-before* #'lisp::default-gc-notify-before) + (setq ext:*gc-notify-after* #'lisp::default-gc-notify-after)) (defvar *install-gc-hooks* t "If non-nil install GC hooks") From heller at common-lisp.net Thu Dec 14 16:13:11 2006 From: heller at common-lisp.net (heller) Date: Thu, 14 Dec 2006 11:13:11 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061214161311.10E8348000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17267 Modified Files: slime.el Log Message: (slime-expand-abbreviations-and-complete): Emacs `choose-completion' (choosing a completion from the *Completions* buffer) always replaces text upto (point). So the code which figures out an `unambiguous-completion-length' and places the point there in `slime-expand-abbreviations-and-complete' causes problems: the replacement text gets garbled. Get rid of the bogus `unambiguous-completion-length'. Patch by Madhu --- /project/slime/cvsroot/slime/slime.el 2006/12/14 16:05:12 1.706 +++ /project/slime/cvsroot/slime/slime.el 2006/12/14 16:13:10 1.707 @@ -6151,15 +6151,10 @@ (set-window-start window (point-min) nil) (let ((other-window-scroll-buffer (window-buffer window))) - (scroll-other-window))))) - (let ((unambiguous-completion-length - (loop for c in completion-set - minimizing (or (mismatch completed-prefix c) - (length completed-prefix))))) - (goto-char (+ beg unambiguous-completion-length)) - (slime-display-completion-list completion-set - completed-prefix) - (slime-complete-delay-restoration)))))))) + (scroll-other-window))))) ; madhu + (slime-display-completion-list completion-set + completed-prefix) + (slime-complete-delay-restoration))))))) (defun slime-complete-symbol*-fancy-bit () "Do fancy tricks after completing a symbol. From heller at common-lisp.net Thu Dec 14 16:17:36 2006 From: heller at common-lisp.net (heller) Date: Thu, 14 Dec 2006 11:17:36 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061214161736.D3B8549032@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17713 Modified Files: swank.lisp Log Message: (*sldb-printer-bindings*): *PRINT-LINES* is in effect only if *PRINT-PRETTY* is non-NIL, so it better to enable the pretty printer. Suggested by Madhu . --- /project/slime/cvsroot/slime/swank.lisp 2006/12/13 16:57:47 1.427 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/14 16:17:36 1.428 @@ -90,7 +90,7 @@ Redirection is done while Lisp is processing a request for Emacs.") (defvar *sldb-printer-bindings* - `((*print-pretty* . nil) + `((*print-pretty* . t) (*print-level* . 4) (*print-length* . 10) (*print-circle* . t) @@ -100,7 +100,7 @@ (*print-base* . 10) (*print-radix* . nil) (*print-array* . t) - (*print-lines* . 200) + (*print-lines* . 10) (*print-escape* . t)) "A set of printer variables used in the debugger.") From heller at common-lisp.net Thu Dec 14 16:18:18 2006 From: heller at common-lisp.net (heller) Date: Thu, 14 Dec 2006 11:18:18 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061214161818.C7DD249032@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17779 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/14 15:58:12 1.1020 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/14 16:18:18 1.1021 @@ -1,3 +1,33 @@ +2006-12-14 Helmut Eller + + * swank.lisp (*sldb-printer-bindings*): *PRINT-LINES* is in + effect only if *PRINT-PRETTY* is non-NIL, so it better to enable + the pretty printer. Suggested by Madhu . + + * slime.el (slime-expand-abbreviations-and-complete): Emacs + `choose-completion' (choosing a completion from the *Completions* + buffer) always replaces text upto (point). So the code which + figures out an `unambiguous-completion-length' and places the + point there in `slime-expand-abbreviations-and-complete' causes + problems: the replacement text gets garbled. Get rid of the bogus + `unambiguous-completion-length'. Patch by Madhu + + * swank-cmucl.lisp (remove-gc-hooks): The variables + EXT:*GC-NOTIFY-AFTER* and EXT:*NOTIFY-BEFORE* should hold + functions and should be NIL. This affects the function + REMOVE-GC-HOOKS in swank-cmucl.lisp which sets them to + NIL, (should one happen to use it). Set them back to the original + parameters. Patch by Madhu + + * slime.el (slime-repl-output-mouseover-face): Fix a pair of extra + parens. Patch by Madhu + +2006-12-14 Helmut Eller + + * slime.el (slime-search-buffer-package): Remove Xemacs special + casing. There's already a compatibility defun for + match-string-no-properties. + 2006-12-13 Attila Lendvai * swank.lisp: FIX: fuzzy completion for M-V-B. Fix by Madhu. From eweitz at common-lisp.net Fri Dec 15 12:40:47 2006 From: eweitz at common-lisp.net (eweitz) Date: Fri, 15 Dec 2006 07:40:47 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061215124047.7FA7F111CC@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9487 Modified Files: ChangeLog swank-lispworks.lisp Log Message: weak hash tables for LispWorks --- /project/slime/cvsroot/slime/ChangeLog 2006/12/14 16:18:18 1.1021 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/15 12:40:47 1.1022 @@ -1,3 +1,9 @@ +2006-12-15 Edi Weitz + + * swank-lispworks.lisp (make-weak-key-hash-table): Weak hash + tables for Lispworks. + (make-weak-value-hash-table): Ditto. + 2006-12-14 Helmut Eller * swank.lisp (*sldb-printer-bindings*): *PRINT-LINES* is in --- /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/11/19 21:33:03 1.88 +++ /project/slime/cvsroot/slime/swank-lispworks.lisp 2006/12/15 12:40:47 1.89 @@ -788,3 +788,11 @@ (defmethod env-internals:confirm-p ((e slime-env) &optional msg &rest args) (apply (swank-sym :y-or-n-p-in-emacs) msg args)) + +;;;; Weak hashtables + +(defimplementation make-weak-key-hash-table (&rest args) + (apply #'make-hash-table :weak-kind :key args)) + +(defimplementation make-weak-value-hash-table (&rest args) + (apply #'make-hash-table :weak-kind :value args)) From mbaringer at common-lisp.net Mon Dec 18 16:44:21 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 18 Dec 2006 11:44:21 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061218164421.B9A7E1F003@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv21829 Modified Files: slime.el Log Message: (slime-region-for-defun-at-point): end-of-defun and beginning-of-defun modify match-data, so we should save it. --- /project/slime/cvsroot/slime/slime.el 2006/12/14 16:13:10 1.707 +++ /project/slime/cvsroot/slime/slime.el 2006/12/18 16:44:21 1.708 @@ -10674,10 +10674,11 @@ (defun slime-region-for-defun-at-point () "Return the start and end position of the toplevel form at point." (save-excursion - (end-of-defun) - (let ((end (point))) - (beginning-of-defun) - (list (point) end)))) + (save-match-data + (end-of-defun) + (let ((end (point))) + (beginning-of-defun) + (list (point) end))))) (defun slime-beginning-of-symbol () "Move point to the beginning of the current symbol." From mbaringer at common-lisp.net Mon Dec 18 16:45:15 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Mon, 18 Dec 2006 11:45:15 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061218164515.7BA8F7B01B@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv22110 Modified Files: ChangeLog Log Message: --- /project/slime/cvsroot/slime/ChangeLog 2006/12/15 12:40:47 1.1022 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/18 16:45:15 1.1023 @@ -1,3 +1,9 @@ +2006-12-18 Marco Baringer + + * slime.el (slime-region-for-defun-at-point): end-of-defun and + beginning-of-defun modify match-data, added a save-match-data to + prevent this. + 2006-12-15 Edi Weitz * swank-lispworks.lisp (make-weak-key-hash-table): Weak hash From alendvai at common-lisp.net Tue Dec 19 09:58:52 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 04:58:52 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219095852.191456D06E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9203 Modified Files: slime.el Log Message: Convert some inspector defuns to defun* and use keywords. Other minor cleanups. --- /project/slime/cvsroot/slime/slime.el 2006/12/18 16:44:21 1.708 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 09:58:52 1.709 @@ -2267,7 +2267,7 @@ ;; from a timer then it mysteriously uses the wrong keymap for the ;; first command. (slime-eval-async '(swank:connection-info) - (lexical-let ((proc proc)) + (with-lexical-bindings (proc) (lambda (info) (slime-set-connection-info proc info))))) @@ -9067,14 +9067,14 @@ (defvar slime-inspector-mark-stack '()) (defvar slime-saved-window-config) -(defun slime-inspect (form &optional no-reset) +(defun* slime-inspect (form &key no-reset (eval (not current-prefix-arg)) thread) "Eval an expression and inspect the result. If called with a prefix argument the value will not be evaluated." (interactive (list (slime-read-object (if current-prefix-arg "Inspect value: " "Inspect value (evaluated): ")))) - (slime-eval-async `(swank:init-inspector ,form + (slime-eval-async `(swank:init-inspector ,form :reset ,(not no-reset) :eval ,(null current-prefix-arg)) 'slime-open-inspector)) @@ -9108,7 +9108,7 @@ (defmacro slime-inspector-fontify (face string) `(slime-add-face ',(intern (format "slime-inspector-%s-face" face)) ,string)) -(defun slime-open-inspector (inspected-parts &optional point) +(defun* slime-open-inspector (inspected-parts &key point thread) "Display INSPECTED-PARTS in a new inspector window. Optionally set point to POINT." (with-current-buffer (slime-inspector-buffer) @@ -9149,7 +9149,7 @@ string))))) (defun slime-inspector-operate-on-point () - "If point is on a value then recursivly call the inspcetor on + "If point is on a value then recursivly call the inspector on that value. If point is on an action then call that action." (interactive) (let ((part-number (get-text-property (point) 'slime-part-number)) @@ -9162,7 +9162,7 @@ (slime-eval-async `(swank::inspector-call-nth-action ,action-number) (lexical-let ((point (point))) (lambda (parts) - (slime-open-inspector parts point)))))))) + (slime-open-inspector parts :point point)))))))) (defun slime-inspector-operate-on-click (event) "Inspect the value at the clicked-at position or invoke an action." @@ -9189,7 +9189,7 @@ `(swank:inspector-pop) (lambda (result) (cond (result - (slime-open-inspector result (pop slime-inspector-mark-stack))) + (slime-open-inspector result :point (pop slime-inspector-mark-stack))) (t (message "No previous object") (ding)))))) From alendvai at common-lisp.net Tue Dec 19 10:09:56 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:09:56 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219100956.637F0232B9@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11591 Modified Files: slime.el Log Message: FIX: operate the inspector in the debug thread when started from sldb --- /project/slime/cvsroot/slime/slime.el 2006/12/19 09:58:52 1.709 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:09:56 1.710 @@ -8690,7 +8690,9 @@ (let ((frame (sldb-frame-number-at-point)) (var (sldb-var-number-at-point))) (slime-eval-async `(swank:inspect-frame-var ,frame ,var) - 'slime-open-inspector))) + (with-lexical-bindings (slime-current-thread) + (lambda (thing) + (slime-open-inspector thing :thread slime-current-thread)))))) (defun sldb-list-locals () "List local variables in selected frame." @@ -9076,8 +9078,10 @@ "Inspect value (evaluated): ")))) (slime-eval-async `(swank:init-inspector ,form :reset ,(not no-reset) - :eval ,(null current-prefix-arg)) - 'slime-open-inspector)) + :eval ,eval) + (with-lexical-bindings (thread) + (lambda (thing) + (slime-open-inspector thing :thread thread))))) (defun slime-read-object (prompt) "Read a Common Lisp expression from the minibuffer, providing @@ -9113,6 +9117,8 @@ Optionally set point to POINT." (with-current-buffer (slime-inspector-buffer) (setq slime-buffer-connection (slime-current-connection)) + (when thread + (setq slime-current-thread thread)) (let ((inhibit-read-only t)) (erase-buffer) (destructuring-bind (&key title type content id) inspected-parts From alendvai at common-lisp.net Tue Dec 19 10:11:57 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:11:57 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219101157.8B71F2D01D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11951 Modified Files: slime.el Log Message: Added (cons row col) addressing to slime-open-inspector, use in slime-inspector-operate-on-point --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:09:56 1.710 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:11:57 1.711 @@ -9136,7 +9136,11 @@ (mapc #'slime-inspector-insert-ispec content)) (pop-to-buffer (current-buffer)) (when point - (goto-char (min (point-max) point)))))))) + (if (consp point) + (progn + (goto-line (min (count-lines 1 (point-max)) (car point))) + (move-to-column (cdr point))) + (goto-char (min (point-max) point))))))))) (defun slime-inspector-insert-ispec (ispec) (if (stringp ispec) @@ -9166,7 +9170,7 @@ (push (point) slime-inspector-mark-stack)) (action-number (slime-eval-async `(swank::inspector-call-nth-action ,action-number) - (lexical-let ((point (point))) + (lexical-let ((point (cons (line-number) (current-column)))) (lambda (parts) (slime-open-inspector parts :point point)))))))) @@ -9281,7 +9285,10 @@ (defun slime-inspector-reinspect () (interactive) - (slime-eval-async `(swank:inspector-reinspect) 'slime-open-inspector)) + (slime-eval-async `(swank:inspector-reinspect) + (lexical-let ((point (cons (line-number) (current-column)))) + (lambda (parts) + (slime-open-inspector parts :point point))))) (slime-define-keys slime-inspector-mode-map ([return] 'slime-inspector-operate-on-point) From alendvai at common-lisp.net Tue Dec 19 10:13:24 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:13:24 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219101324.384B72E1BD@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12112 Modified Files: slime.el Log Message: Set slime-fuzzy-completion-in-place enabled by default --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:11:57 1.711 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:13:24 1.712 @@ -277,7 +277,7 @@ :group 'slime-mode :type 'boolean) -(defcustom slime-fuzzy-completion-in-place nil +(defcustom slime-fuzzy-completion-in-place t "When non-NIL the fuzzy symbol completion is done in place as opposed to moving the point to the completion buffer." :group 'slime-mode From alendvai at common-lisp.net Tue Dec 19 10:21:33 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:21:33 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219102133.57B8636002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14515 Modified Files: swank.lisp Log Message: Add (expt 1.2 length) higher scores for longer matches in fuzzy completion. A good example: puts "make-instance" before "make-string-input-stream" while completing "make-ins" --- /project/slime/cvsroot/slime/swank.lisp 2006/12/14 16:17:36 1.428 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:21:32 1.429 @@ -3627,9 +3627,10 @@ Once a word has been completely matched, the chunks are pushed onto the special variable *ALL-CHUNKS* and the function returns." - (declare ;;(optimize speed) + (declare (optimize speed) (fixnum short-index initial-full-index) (simple-string short full) + (type list *all-chunks*) (special *all-chunks*)) (flet ((short-cur () "Returns the next letter from the abbreviation, or NIL @@ -3738,7 +3739,8 @@ (if (zerop chunk-pos) base-score (max base-score - (* (score-char (1- pos) (1- chunk-pos)) 0.85)))) + (+ (* (score-char (1- pos) (1- chunk-pos)) 0.85) + (expt 1.2 chunk-pos))))) (score-char (pos chunk-pos) (score-or-percentage-of-previous (cond ((at-beginning-p pos) 10) From alendvai at common-lisp.net Tue Dec 19 10:26:53 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:26:53 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219102653.6C10A4717E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv15354 Modified Files: slime.el Log Message: Make slime-fuzzy-complete-symbol the default in the belife that it's better for new users --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:13:24 1.712 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:26:53 1.713 @@ -260,7 +260,7 @@ :group 'slime-mode :type 'boolean) -(defcustom slime-complete-symbol-function 'slime-complete-symbol* +(defcustom slime-complete-symbol-function 'slime-fuzzy-complete-symbol "*Function to perform symbol completion." :group 'slime-mode :type '(choice (const :tag "Simple" slime-simple-complete-symbol) From alendvai at common-lisp.net Tue Dec 19 10:29:44 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:29:44 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219102944.C5CDE4D043@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv15780 Modified Files: slime.el swank.lisp Log Message: Added dwim-mode to slime-inspect that tries to be smart unless prefixed --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:26:53 1.713 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:29:42 1.714 @@ -9070,20 +9070,24 @@ (defvar slime-saved-window-config) (defun* slime-inspect (form &key no-reset (eval (not current-prefix-arg)) thread) - "Eval an expression and inspect the result. + "Take an expression and inspect it trying to be smart about what was the intention. -If called with a prefix argument the value will not be evaluated." - (interactive (list (slime-read-object (if current-prefix-arg - "Inspect value: " - "Inspect value (evaluated): ")))) +If called with a prefix argument the value will be evaluated and inspected +without any magic in behind the stage." + (interactive + (list (slime-read-object (if current-prefix-arg + "Inspect value (evaluated): " + "Inspect value (dwim mode): ") + :return-names-unconfirmed (not current-prefix-arg)))) (slime-eval-async `(swank:init-inspector ,form :reset ,(not no-reset) - :eval ,eval) + :eval ,(not (null current-prefix-arg)) + :dwim-mode ,(not current-prefix-arg)) (with-lexical-bindings (thread) (lambda (thing) (slime-open-inspector thing :thread thread))))) -(defun slime-read-object (prompt) +(defun* slime-read-object (prompt &key return-names-unconfirmed) "Read a Common Lisp expression from the minibuffer, providing defaults from the s-expression at point. If point is within a presentation, don't prompt, just return the presentation." @@ -9091,8 +9095,14 @@ (slime-presentation-around-point (point)) (if presentation (slime-presentation-expression presentation) - (slime-read-from-minibuffer prompt - (slime-sexp-at-point))))) + (let ((sexp (slime-sexp-at-point))) + (if (and sexp + return-names-unconfirmed + ;; an string with alphanumeric chars and hyphens only? + (and (string-match "\\([\-|0-9|a-z|A-Z]*\\)" sexp) + (= (match-end 0) (length sexp)))) + sexp + (slime-read-from-minibuffer prompt sexp)))))) (define-derived-mode slime-inspector-mode fundamental-mode "Slime-Inspector" (set-syntax-table lisp-mode-syntax-table) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:21:32 1.429 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:29:44 1.430 @@ -4775,14 +4775,30 @@ *inspectee-actions* (make-array 10 :adjustable t :fill-pointer 0) *inspector-history* (make-array 10 :adjustable t :fill-pointer 0))) -(defslimefun init-inspector (string &key (reset t) (eval t)) +(defslimefun init-inspector (string &key (reset t) (eval t) (dwim-mode nil)) (with-buffer-syntax () (when reset (reset-inspector)) (let* ((form (read-from-string string)) - (value (if eval - (eval form) - form))) + (value (cond (dwim-mode + (typecase form + (symbol (or (and (fboundp form) + (fdefinition form)) + (and (boundp form) + (symbol-value form)) + (find-class form nil) + form)) + (atom form) + (t (if (fboundp (first form)) + (eval form) + form)))) + (eval (eval form)) + (t form)))) + (when (and dwim-mode + form) + ;; push the form to the inspector stack, so you can go back to it + ;; with slime-inspector-pop if dwim missed the intention + (push form *inspector-stack*)) (inspect-object value)))) (defun print-part-to-string (value) From alendvai at common-lisp.net Tue Dec 19 10:32:26 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:32:26 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219103226.BB49154122@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16289 Modified Files: swank.lisp Log Message: Small: get rid of notes and warnings --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:29:44 1.430 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:32:26 1.431 @@ -3627,10 +3627,9 @@ Once a word has been completely matched, the chunks are pushed onto the special variable *ALL-CHUNKS* and the function returns." - (declare (optimize speed) + (declare ;(optimize speed) (fixnum short-index initial-full-index) (simple-string short full) - (type list *all-chunks*) (special *all-chunks*)) (flet ((short-cur () "Returns the next letter from the abbreviation, or NIL From alendvai at common-lisp.net Tue Dec 19 10:36:49 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:36:49 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219103649.30B0B61026@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16973 Modified Files: slime.el Log Message: FIX: Properly keep track of slime-buffer-package in the inspector --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:29:42 1.714 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:36:49 1.715 @@ -8616,9 +8616,13 @@ "Prompt for an expression and inspect it in the selected frame." (interactive (list (slime-read-object "Inspect in frame (evaluated): "))) - (let ((number (sldb-frame-number-at-point))) - (slime-eval-async `(swank:inspect-in-frame ,string ,number) - 'slime-open-inspector))) + (slime-eval-async `(swank:inspect-in-frame ,string ,(sldb-frame-number-at-point)) + (with-lexical-bindings (slime-current-thread + slime-buffer-package) + (lambda (thing) + (slime-open-inspector thing + :thread slime-current-thread + :package slime-buffer-package))))) (defun sldb-inspect-condition () "Inspect the current debugger condition." @@ -8690,9 +8694,12 @@ (let ((frame (sldb-frame-number-at-point)) (var (sldb-var-number-at-point))) (slime-eval-async `(swank:inspect-frame-var ,frame ,var) - (with-lexical-bindings (slime-current-thread) + (lexical-let ((thread slime-current-thread) + (package (slime-current-package))) (lambda (thing) - (slime-open-inspector thing :thread slime-current-thread)))))) + (slime-open-inspector thing + :thread thread + :package package)))))) (defun sldb-list-locals () "List local variables in selected frame." @@ -9069,7 +9076,8 @@ (defvar slime-inspector-mark-stack '()) (defvar slime-saved-window-config) -(defun* slime-inspect (form &key no-reset (eval (not current-prefix-arg)) thread) +(defun* slime-inspect (form &key no-reset (eval (not current-prefix-arg)) thread + (package (slime-current-package))) "Take an expression and inspect it trying to be smart about what was the intention. If called with a prefix argument the value will be evaluated and inspected @@ -9083,9 +9091,11 @@ :reset ,(not no-reset) :eval ,(not (null current-prefix-arg)) :dwim-mode ,(not current-prefix-arg)) - (with-lexical-bindings (thread) + (with-lexical-bindings (thread package) (lambda (thing) - (slime-open-inspector thing :thread thread))))) + (slime-open-inspector thing + :thread thread + :package package))))) (defun* slime-read-object (prompt &key return-names-unconfirmed) "Read a Common Lisp expression from the minibuffer, providing @@ -9122,13 +9132,15 @@ (defmacro slime-inspector-fontify (face string) `(slime-add-face ',(intern (format "slime-inspector-%s-face" face)) ,string)) -(defun* slime-open-inspector (inspected-parts &key point thread) +(defun* slime-open-inspector (inspected-parts &key point thread package) "Display INSPECTED-PARTS in a new inspector window. Optionally set point to POINT." (with-current-buffer (slime-inspector-buffer) (setq slime-buffer-connection (slime-current-connection)) (when thread (setq slime-current-thread thread)) + (when package + (setq slime-buffer-package package)) (let ((inhibit-read-only t)) (erase-buffer) (destructuring-bind (&key title type content id) inspected-parts @@ -9173,16 +9185,17 @@ that value. If point is on an action then call that action." (interactive) (let ((part-number (get-text-property (point) 'slime-part-number)) - (action-number (get-text-property (point) 'slime-action-number))) + (action-number (get-text-property (point) 'slime-action-number)) + (opener (lexical-let ((point (cons (line-number) (current-column)))) + (lambda (parts) + (slime-open-inspector parts :point point))))) (cond (part-number (slime-eval-async `(swank:inspect-nth-part ,part-number) - 'slime-open-inspector) + opener) (push (point) slime-inspector-mark-stack)) (action-number (slime-eval-async `(swank::inspector-call-nth-action ,action-number) - (lexical-let ((point (cons (line-number) (current-column)))) - (lambda (parts) - (slime-open-inspector parts :point point)))))))) + opener))))) (defun slime-inspector-operate-on-click (event) "Inspect the value at the clicked-at position or invoke an action." From alendvai at common-lisp.net Tue Dec 19 10:38:24 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:38:24 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219103824.5DA3A61035@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17210 Modified Files: slime.el Log Message: FIX: slime-sexp-at-point for foo::|bar::baz| --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:36:49 1.715 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:38:24 1.716 @@ -10769,7 +10769,8 @@ (defun slime-sexp-at-point () "Return the sexp at point as a string, otherwise nil." - (let ((string (thing-at-point 'sexp))) + (let ((string (or (slime-symbol-name-at-point) + (thing-at-point 'sexp)))) (if string (substring-no-properties string) nil))) (defun slime-sexp-at-point-or-error () From alendvai at common-lisp.net Tue Dec 19 10:40:11 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:40:11 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219104011.5081265003@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv17412 Modified Files: slime.el swank.lisp Log Message: FIX dwim inspecting to handle (setf some-fun) functions, too --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:38:24 1.716 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:40:11 1.717 @@ -9109,7 +9109,7 @@ (if (and sexp return-names-unconfirmed ;; an string with alphanumeric chars and hyphens only? - (and (string-match "\\([\-|0-9|a-z|A-Z]*\\)" sexp) + (and (string-match "\\([-|:0-9a-zA-Z]*\\)" sexp) (= (match-end 0) (length sexp)))) sexp (slime-read-from-minibuffer prompt sexp)))))) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:32:26 1.431 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:40:11 1.432 @@ -4774,23 +4774,39 @@ *inspectee-actions* (make-array 10 :adjustable t :fill-pointer 0) *inspector-history* (make-array 10 :adjustable t :fill-pointer 0))) +(defun valid-function-name-p (form) + (or (and (not (null form)) + (not (eq form t)) + (symbolp form)) + (and (consp form) + (second form) + (not (third form)) + (eq (first form) 'setf)))) + (defslimefun init-inspector (string &key (reset t) (eval t) (dwim-mode nil)) (with-buffer-syntax () (when reset (reset-inspector)) (let* ((form (read-from-string string)) (value (cond (dwim-mode - (typecase form - (symbol (or (and (fboundp form) - (fdefinition form)) - (and (boundp form) - (symbol-value form)) - (find-class form nil) - form)) - (atom form) - (t (if (fboundp (first form)) - (eval form) - form)))) + ;; TODO: here we _may_ want to present the + ;; multiple possibilities when available + ;; instead of this hardcoded order. + (cond ((and (symbolp form) + (boundp form)) + (symbol-value form)) + ((and (valid-function-name-p form) + (fboundp form)) + (fdefinition form)) + ((and (symbolp form) + (find-class form nil)) + (find-class form)) + ((atom form) + form) + (t (if (and (valid-function-name-p (first form)) + (fboundp (first form))) + (eval form) + form)))) (eval (eval form)) (t form)))) (when (and dwim-mode From alendvai at common-lisp.net Tue Dec 19 10:45:37 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:45:37 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219104537.B73EE6A004@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv19695 Modified Files: swank.lisp Log Message: Hashtable inspecting: added [clear hashtable] and [remove entry] actions --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:40:11 1.432 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:45:37 1.433 @@ -4186,15 +4186,21 @@ ("Test" (hash-table-test ht)) ("Rehash size" (hash-table-rehash-size ht)) ("Rehash threshold" (hash-table-rehash-threshold ht))) - '("Contents: " (:newline)) + (unless (zerop (hash-table-count ht)) + `((:action "[clear hashtable]" ,(lambda () (clrhash ht))) (:newline) + "Contents: " (:newline))) (if (and *slime-inspect-contents-limit* (>= (hash-table-count ht) *slime-inspect-contents-limit*)) (inspect-bigger-piece-actions ht (hash-table-count ht)) nil) (loop for key being the hash-keys of ht - for value being the hash-values of ht - repeat (or *slime-inspect-contents-limit* most-positive-fixnum) - append `((:value ,key) " = " (:value ,value) (:newline)))))) + for value being the hash-values of ht + repeat (or *slime-inspect-contents-limit* most-positive-fixnum) + append `((:value ,key) " = " (:value ,value) + " " (:action "[remove entry]" + ,(let ((key key)) + (lambda () (remhash key ht)))) + (:newline)))))) (defmethod inspect-bigger-piece-actions (thing size) (append From alendvai at common-lisp.net Tue Dec 19 10:47:37 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:47:37 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219104737.25555100D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv19944 Modified Files: swank-allegro.lisp swank-backend.lisp swank-openmcl.lisp swank-sbcl.lisp swank.lisp Log Message: Added hash-table-weakness and use it in hash-table-inspecting --- /project/slime/cvsroot/slime/swank-allegro.lisp 2006/11/19 21:33:03 1.94 +++ /project/slime/cvsroot/slime/swank-allegro.lisp 2006/12/19 10:47:36 1.95 @@ -764,6 +764,11 @@ (defimplementation make-weak-value-hash-table (&rest args) (apply #'make-hash-table :values :weak args)) +(defimplementation hash-table-weakness (hashtable) + (cond ((excl:hash-table-weak-keys hashtable) :key) + ((eq (excl:hash-table-values hashtable) :weak) :value))) + + ;;;; Character names --- /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/12 15:40:23 1.112 +++ /project/slime/cvsroot/slime/swank-backend.lisp 2006/12/19 10:47:36 1.113 @@ -1015,6 +1015,11 @@ "Like MAKE-HASH-TABLE, but weak w.r.t. the values." (apply #'make-hash-table args)) +(definterface hash-table-weakness (hashtable) + "Return nil or one of :key :value :key-or-value :key-and-value" + (declare (ignore hashtable)) + nil) + ;;;; Character names --- /project/slime/cvsroot/slime/swank-openmcl.lisp 2006/11/19 21:33:03 1.113 +++ /project/slime/cvsroot/slime/swank-openmcl.lisp 2006/12/19 10:47:36 1.114 @@ -930,3 +930,5 @@ (defimplementation make-weak-value-hash-table (&rest args) (apply #'make-hash-table :weak :value args)) +(defimplementation hash-table-weakness (hashtable) + (ccl::hash-table-weak-p ht)) --- /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/12/05 04:46:06 1.172 +++ /project/slime/cvsroot/slime/swank-sbcl.lisp 2006/12/19 10:47:36 1.173 @@ -1245,3 +1245,7 @@ (apply #'make-hash-table :weakness :value args) #-#.(swank-backend::sbcl-with-weak-hash-tables) (apply #'make-hash-table args)) + +(defimplementation hash-table-weakness (hashtable) + #+#.(swank-backend::sbcl-with-weak-hash-tables) + (sb-ext:hash-table-weakness hashtable)) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:45:37 1.433 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:47:36 1.434 @@ -4186,6 +4186,9 @@ ("Test" (hash-table-test ht)) ("Rehash size" (hash-table-rehash-size ht)) ("Rehash threshold" (hash-table-rehash-threshold ht))) + (let ((weakness (hash-table-weakness ht))) + (when weakness + `("Weakness: " (:value ,weakness) (:newline)))) (unless (zerop (hash-table-count ht)) `((:action "[clear hashtable]" ,(lambda () (clrhash ht))) (:newline) "Contents: " (:newline))) From alendvai at common-lisp.net Tue Dec 19 10:49:44 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:49:44 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219104944.1521F301F@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20267 Modified Files: slime.el Log Message: Smarten up the sldb heuristic that drops swank frames --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:40:11 1.717 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:49:43 1.718 @@ -8378,10 +8378,13 @@ (defun sldb-prune-initial-frames (frames) "Return the prefix of FRAMES to initially present to the user. Regexp heuristics are used to avoid showing SWANK-internal frames." - (or (loop for frame in frames + (or (loop with winner = -1 + for frame in frames + for idx from 0 for (number string) = frame - until (string-match "^(*\\(SWANK\\|swank\\)\\>" string) - collect frame) + while (string-match "^\\((\\|LAMBDA \\|lambda \\)*\\(SWANK\\|swank\\)\\>" string) + do (setf winner idx) + finally (return (subseq frames (1+ winner)))) frames)) (defun sldb-insert-frame (frame &optional detailedp) From alendvai at common-lisp.net Tue Dec 19 10:51:06 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:51:06 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219105106.78246A0F6@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20633 Modified Files: swank.lisp Log Message: Properly bind *sldb-printer-bindings* and turn off right margin while printing stuff in sldb --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:47:36 1.434 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:51:03 1.435 @@ -2760,9 +2760,8 @@ (*sldb-stepping-p* nil) (*swank-state-stack* (cons :swank-debugger-hook *swank-state-stack*))) (force-user-output) - (with-bindings *sldb-printer-bindings* - (call-with-debugging-environment - (lambda () (sldb-loop *sldb-level*)))))) + (call-with-debugging-environment + (lambda () (sldb-loop *sldb-level*))))) (defun sldb-loop (level) (unwind-protect @@ -2814,12 +2813,6 @@ collect (list (princ-to-string (restart-name restart)) (princ-to-string restart)))) -(defun frame-for-emacs (n frame) - (let* ((label (format nil " ~2D: " n)) - (string (with-output-to-string (stream) - (princ label stream) - (print-frame frame stream)))) - (subseq string (length label)))) ;;;;; SLDB entry points @@ -2830,9 +2823,13 @@ (defslimefun backtrace (start end) "Return a list ((I FRAME) ...) of frames from START to END. I is an integer describing and FRAME a string." - (loop for frame in (compute-backtrace start end) - for i from start - collect (list i (frame-for-emacs i frame)))) + (with-bindings *sldb-printer-bindings* + ;; we don't want newlines in the backtrace, that makes it unreadable + (let ((*print-right-margin* most-positive-fixnum)) + (loop for frame in (compute-backtrace start end) + for i from start + collect (list i (with-output-to-string (stream) + (print-frame frame stream))))))) (defslimefun debugger-info-for-emacs (start end) "Return debugger state, with stack frames from START to END. @@ -2865,10 +2862,11 @@ (\"ABORT\" \"Return to Top-Level.\")) ((0 \"(KERNEL::INTEGER-/-INTEGER 1 0)\")) (4))" - (list (debugger-condition-for-emacs) - (format-restarts-for-emacs) - (backtrace start end) - *pending-continuations*)) + (with-bindings *sldb-printer-bindings* + (list (debugger-condition-for-emacs) + (format-restarts-for-emacs) + (backtrace start end) + *pending-continuations*))) (defun nth-restart (index) (nth index *sldb-restarts*)) From alendvai at common-lisp.net Tue Dec 19 10:55:24 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:55:24 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219105524.770517B019@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv21302 Modified Files: slime.el Log Message: Fix slime-insert-presentation to handle multi-line presentations better (use insert-rectangle) --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:49:43 1.718 +++ /project/slime/cvsroot/slime/slime.el 2006/12/19 10:55:24 1.719 @@ -3015,13 +3015,24 @@ (delete-overlay overlay))))) (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))))) - + (flet ((insert-it () + (let ((lines (split-string string "\n"))) + (if (cdr lines) + (progn + (save-excursion + (dolist (line lines) + (newline))) + (insert-rectangle lines) + (forward-char) + (delete-backward-char 1)) + (insert string))))) + (cond ((not slime-repl-enable-presentations) + (insert-it)) + (t + (let ((start (point))) + (insert-it) + (slime-add-presentation-properties start (point) output-id t)))))) + (defun slime-open-stream-to-lisp (port) (let ((stream (open-network-stream "*lisp-output-stream*" (slime-with-connection-buffer () @@ -8691,7 +8702,7 @@ (slime-insert-presentation (in-sldb-face local-value value) `(:frame-var ,frame ,i))) - (insert "\n")))) + (newline)))) (defun sldb-inspect-var () (let ((frame (sldb-frame-number-at-point)) From alendvai at common-lisp.net Tue Dec 19 10:57:40 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 05:57:40 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219105740.ADE6F2D01D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv21698 Modified Files: swank.lisp Log Message: In all-slots-for-inspector pad slot names to be equal length, so the result is more readable --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:51:03 1.435 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:57:40 1.436 @@ -4449,18 +4449,37 @@ (declare (ignore inspector)) (append '("------------------------------" (:newline) "All Slots:" (:newline)) - (loop - with direct-slots = (swank-mop:class-direct-slots (class-of object)) - for effective-slot :in (swank-mop:class-slots (class-of object)) - for direct-slot = (find (swank-mop:slot-definition-name effective-slot) - direct-slots :key #'swank-mop:slot-definition-name) - collect `(:value ,(if direct-slot - (list direct-slot effective-slot) - effective-slot) - ,(inspector-princ (swank-mop:slot-definition-name effective-slot))) - collect " = " - append (inspect-slot-for-emacs (class-of object) object effective-slot) - collect '(:newline))))) + (let* ((class (class-of object)) + (direct-slots (swank-mop:class-direct-slots class)) + (effective-slots (swank-mop:class-slots class)) + (slot-presentations (loop for effective-slot :in effective-slots + collect (inspect-slot-for-emacs + class object effective-slot))) + (longest-slot-name-length + (loop for slot :in effective-slots + maximize (length (symbol-name + (swank-mop:slot-definition-name slot)))))) + (loop + for effective-slot :in effective-slots + for slot-presentation :in slot-presentations + for direct-slot = (find (swank-mop:slot-definition-name effective-slot) + direct-slots :key #'swank-mop:slot-definition-name) + for slot-name = (inspector-princ + (swank-mop:slot-definition-name effective-slot)) + for padding-length = (- longest-slot-name-length + (length (symbol-name + (swank-mop:slot-definition-name + effective-slot)))) + collect `(:value ,(if direct-slot + (list direct-slot effective-slot) + effective-slot) + ,slot-name) + collect (make-array padding-length + :element-type 'character + :initial-element #\Space) + collect " = " + append slot-presentation + collect '(:newline)))))) (defmethod inspect-for-emacs ((gf standard-generic-function) inspector) (flet ((lv (label value) (label-value-line label value))) From alendvai at common-lisp.net Tue Dec 19 11:03:58 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 06:03:58 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219110358.B0E427E003@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv24486 Modified Files: HACKING Log Message: Added useful init.el piece into HACKING about update-change-log --- /project/slime/cvsroot/slime/HACKING 2004/07/19 14:15:45 1.6 +++ /project/slime/cvsroot/slime/HACKING 2006/12/19 11:03:58 1.7 @@ -35,6 +35,18 @@ http://www.gnu.org/software/emacs/manual/html_node/emacs_333.html#SEC333 http://www.gnu.org/software/emacs/manual/html_node/emacs_156.html#SEC156 +** You may want to add this to your init.el + +(defun update-change-log () + (interactive) + (vc-update-change-log "-u" "alendvai Attila Lendvai attila.lendvai at gmail.com" + "-u" "mbaringer Marco Baringer mb at bese.it" + "-u" "heller Helmut Eller heller at common-lisp.net")) + +(add-hook 'change-log-mode-hook + (lambda () + (define-key change-log-mode-map (kbd "C-M-u") 'update-change-log))) + * Sending Patches If you would like to send us improvements you can create a patch with From alendvai at common-lisp.net Tue Dec 19 11:11:43 2006 From: alendvai at common-lisp.net (alendvai) Date: Tue, 19 Dec 2006 06:11:43 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061219111143.887CF4D046@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv25546 Modified Files: ChangeLog Log Message: Updated changelog --- /project/slime/cvsroot/slime/ChangeLog 2006/12/18 16:45:15 1.1023 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/19 11:11:43 1.1024 @@ -1,3 +1,62 @@ +2006-12-19 Attila Lendvai + + * HACKING: + Added useful init.el piece into HACKING about update-change-log + + * swank.lisp: + In all-slots-for-inspector pad slot names to be equal length, so the result is more readable + + * slime.el: + Fix slime-insert-presentation to handle multi-line presentations better (use insert-rectangle) + + * swank.lisp: + Properly bind *sldb-printer-bindings* and turn off right margin while printing stuff in sldb + + * slime.el: Smarten up the sldb heuristic that drops swank frames + + * swank-allegro.lisp, swank-backend.lisp, swank-openmcl.lisp, swank-sbcl.lisp, swank.lisp: + Added hash-table-weakness and use it in hash-table-inspecting + + * swank.lisp: + Hashtable inspecting: added [clear hashtable] and [remove entry] actions + + * slime.el, swank.lisp: + FIX dwim inspecting to handle (setf some-fun) functions, too + + * slime.el: FIX: slime-sexp-at-point for foo::|bar::baz| + + * slime.el: + FIX: Properly keep track of slime-buffer-package in the inspector + + * swank.lisp: Small: get rid of notes and warnings + + * slime.el, swank.lisp: + Added dwim-mode to slime-inspect that tries to be smart unless prefixed + + * slime.el: + Make slime-fuzzy-complete-symbol the default in the belife that it's better for new users + + * swank.lisp: + Add (expt 1.2 length) higher scores for longer matches in fuzzy completion. + + A good example: puts "make-instance" before "make-string-input-stream" while completing "make-ins" + + * slime.el: Set slime-fuzzy-completion-in-place enabled by default + + * slime.el: + Added (cons row col) addressing to slime-open-inspector, use in slime-inspector-operate-on-point + + * slime.el: + FIX: operate the inspector in the debug thread when started from sldb + + * slime.el: + Convert some inspector defuns to defun* and use keywords. Other minor cleanups. + +2006-12-18 Marco Baringer + + * slime.el (slime-region-for-defun-at-point): end-of-defun and + beginning-of-defun modify match-data, so we should save it. + 2006-12-18 Marco Baringer * slime.el (slime-region-for-defun-at-point): end-of-defun and From alendvai at common-lisp.net Wed Dec 20 14:12:04 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:12:04 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220141204.566793D006@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv11953 Modified Files: swank.lisp Log Message: Turn off right margin for restart printing, too --- /project/slime/cvsroot/slime/swank.lisp 2006/12/19 10:57:40 1.436 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:12:04 1.437 @@ -2809,9 +2809,10 @@ (defun format-restarts-for-emacs () "Return a list of restarts for *swank-debugger-condition* in a format suitable for Emacs." - (loop for restart in *sldb-restarts* - collect (list (princ-to-string (restart-name restart)) - (princ-to-string restart)))) + (let ((*print-right-margin* most-positive-fixnum)) + (loop for restart in *sldb-restarts* + collect (list (princ-to-string (restart-name restart)) + (princ-to-string restart))))) ;;;;; SLDB entry points From alendvai at common-lisp.net Wed Dec 20 14:24:02 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:24:02 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220142402.3542F72083@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv15417 Modified Files: swank.lisp Log Message: Return the inspected object when inspecting from the lisp side. --- /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:12:04 1.437 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:24:02 1.438 @@ -2678,7 +2678,8 @@ (send-it)) ((default-connection) (with-connection ((default-connection)) - (send-it)))))) + (send-it)))) + what)) (defslimefun value-for-editing (form) "Return a readable value of FORM for editing in Emacs. From alendvai at common-lisp.net Wed Dec 20 14:26:47 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:26:47 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220142647.A946F16035@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv15843 Modified Files: swank.lisp Log Message: Added present-in-emacs that prints a presentation of the given object in the repl --- /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:24:02 1.438 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:26:46 1.439 @@ -1218,6 +1218,27 @@ ((:ok value) value) ((:abort) (abort))))))) +(defun present-in-emacs (value-or-values &key (separated-by " ")) + "Present VALUE in the Emacs repl buffer of the current thread." + (unless (consp value-or-values) + (setf value-or-values (list value-or-values))) + (flet ((present (value) + (if (stringp value) + (send-to-emacs `(:write-string ,value)) + (let ((id (save-presented-object value))) + (send-to-emacs `(:presentation-start ,id)) + (send-to-emacs `(:write-string ,(prin1-to-string value))) + (send-to-emacs `(:presentation-end ,id)))))) + (map nil (let ((first-time-p t)) + (lambda (value) + (when (and (not first-time-p) + separated-by) + (present separated-by)) + (present value) + (setf first-time-p nil))) + value-or-values)) + (values)) + (defvar *swank-wire-protocol-version* nil "The version of the swank/slime communication protocol.") From alendvai at common-lisp.net Wed Dec 20 14:29:09 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:29:09 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220142909.764C322023@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16101 Modified Files: slime.el swank.lisp Log Message: Extend :write-string with and &optional presentation id and use this in present-in-emacs --- /project/slime/cvsroot/slime/slime.el 2006/12/19 10:55:24 1.719 +++ /project/slime/cvsroot/slime/slime.el 2006/12/20 14:29:09 1.720 @@ -2628,8 +2628,12 @@ (defun slime-dispatch-event (event &optional process) (let ((slime-dispatching-connection (or process (slime-connection)))) (destructure-case event - ((:write-string output) - (slime-write-string output)) + ((:write-string output &optional id) + (if id + (with-current-buffer (slime-output-buffer) + (slime-with-output-end-mark + (slime-insert-presentation output id))) + (slime-write-string output))) ((:presentation-start id) (slime-mark-presentation-start id)) ((:presentation-end id) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:26:46 1.439 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:29:09 1.440 @@ -1226,9 +1226,7 @@ (if (stringp value) (send-to-emacs `(:write-string ,value)) (let ((id (save-presented-object value))) - (send-to-emacs `(:presentation-start ,id)) - (send-to-emacs `(:write-string ,(prin1-to-string value))) - (send-to-emacs `(:presentation-end ,id)))))) + (send-to-emacs `(:write-string ,(prin1-to-string value) ,id)))))) (map nil (let ((first-time-p t)) (lambda (value) (when (and (not first-time-p) From alendvai at common-lisp.net Wed Dec 20 14:32:44 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:32:44 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220143244.CEC8A7B019@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv16768 Modified Files: slime.el Log Message: FIX: slime-fuzzy-target-buffer-completions-mode's keymap must always precede other keymaps --- /project/slime/cvsroot/slime/slime.el 2006/12/20 14:29:09 1.720 +++ /project/slime/cvsroot/slime/slime.el 2006/12/20 14:32:44 1.721 @@ -576,7 +576,7 @@ (call-interactively 'isearch-forward))) ;; some unconditional direct bindings - (dolist (key (list (kbd "RET") (kbd "") "(" ")" "[" "]")) + (dolist (key (list (kbd "") (kbd "RET") (kbd "") "(" ")" "[" "]")) (define-key map key 'slime-fuzzy-select-and-process-event-in-target-buffer))) map ) @@ -638,6 +638,14 @@ "The Lisp package to show in the modeline. This is automatically updated based on the buffer/point.")) +;; Make sure slime-fuzzy-target-buffer-completions-mode's map is +;; before everything else. +(setf minor-mode-map-alist + (stable-sort minor-mode-map-alist + (lambda (a b) + (eq a 'slime-fuzzy-target-buffer-completions-mode)) + :key #'car)) + (defun slime-update-modeline-package () (ignore-errors (when (and slime-update-modeline-package From alendvai at common-lisp.net Wed Dec 20 14:44:11 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:44:11 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220144411.D287236002@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv19654 Modified Files: slime.el Log Message: FIX: inspecting presentations from the right click menu broke in the inspect refactor --- /project/slime/cvsroot/slime/slime.el 2006/12/20 14:32:44 1.721 +++ /project/slime/cvsroot/slime/slime.el 2006/12/20 14:44:11 1.722 @@ -3420,7 +3420,7 @@ (with-current-buffer buffer (not (eq major-mode 'slime-inspector-mode))))) (slime-inspect (slime-presentation-expression presentation) - (not reset-p))))) + :no-reset (not reset-p))))) (defun slime-copy-presentation-at-mouse (event) (interactive "e") From alendvai at common-lisp.net Wed Dec 20 14:54:53 2006 From: alendvai at common-lisp.net (alendvai) Date: Wed, 20 Dec 2006 09:54:53 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061220145453.4A5315D00B@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20826 Modified Files: ChangeLog Log Message: updated changelog --- /project/slime/cvsroot/slime/ChangeLog 2006/12/19 11:11:43 1.1024 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/20 14:54:52 1.1025 @@ -1,27 +1,54 @@ +2006-12-20 Attila Lendvai + + * slime.el: + FIX: inspecting presentations from the right click menu broke in + the inspect refactor + + * slime.el: + FIX: slime-fuzzy-target-buffer-completions-mode's keymap must + always precede other keymaps + + * slime.el, swank.lisp: Extend :write-string with and &optional + presentation id and use this in present-in-emacs + + * swank.lisp: + Added present-in-emacs that prints a presentation of the given + object in the repl + + * swank.lisp: + Return the inspected object when inspecting from the lisp side. + + * swank.lisp: Turn off right margin for restart printing, too + 2006-12-19 Attila Lendvai * HACKING: Added useful init.el piece into HACKING about update-change-log * swank.lisp: - In all-slots-for-inspector pad slot names to be equal length, so the result is more readable + In all-slots-for-inspector pad slot names to be equal length, so + the result is more readable * slime.el: - Fix slime-insert-presentation to handle multi-line presentations better (use insert-rectangle) + Fix slime-insert-presentation to handle multi-line presentations + better (use insert-rectangle) * swank.lisp: - Properly bind *sldb-printer-bindings* and turn off right margin while printing stuff in sldb + Properly bind *sldb-printer-bindings* and turn off right margin + while printing stuff in sldb * slime.el: Smarten up the sldb heuristic that drops swank frames - * swank-allegro.lisp, swank-backend.lisp, swank-openmcl.lisp, swank-sbcl.lisp, swank.lisp: - Added hash-table-weakness and use it in hash-table-inspecting + * swank-allegro.lisp, swank-backend.lisp, swank-openmcl.lisp, + swank-sbcl.lisp, swank.lisp: Added hash-table-weakness and use it + in hash-table-inspecting * swank.lisp: - Hashtable inspecting: added [clear hashtable] and [remove entry] actions + Hashtable inspecting: added [clear hashtable] and [remove entry] + actions - * slime.el, swank.lisp: - FIX dwim inspecting to handle (setf some-fun) functions, too + * slime.el, swank.lisp: FIX dwim inspecting to handle (setf + some-fun) functions, too * slime.el: FIX: slime-sexp-at-point for foo::|bar::baz| @@ -30,27 +57,98 @@ * swank.lisp: Small: get rid of notes and warnings - * slime.el, swank.lisp: - Added dwim-mode to slime-inspect that tries to be smart unless prefixed + * slime.el, swank.lisp: Added dwim-mode to slime-inspect that + tries to be smart unless prefixed * slime.el: - Make slime-fuzzy-complete-symbol the default in the belife that it's better for new users + Make slime-fuzzy-complete-symbol the default in the belife that + it's better for new users * swank.lisp: - Add (expt 1.2 length) higher scores for longer matches in fuzzy completion. + Add (expt 1.2 length) higher scores for longer matches in fuzzy + completion. + + A good example: puts "make-instance" before + "make-string-input-stream" while completing "make-ins" + + * slime.el: Set slime-fuzzy-completion-in-place enabled by default + + * slime.el: + Added (cons row col) addressing to slime-open-inspector, use in + slime-inspector-operate-on-point + + * slime.el: + FIX: operate the inspector in the debug thread when started from + sldb + + * slime.el: + Convert some inspector defuns to defun* and use keywords. Other + minor cleanups. + +2006-12-19 Attila Lendvai + + * HACKING: + Added useful init.el piece into HACKING about update-change-log + + * swank.lisp: + In all-slots-for-inspector pad slot names to be equal length, so + the result is more readable + + * slime.el: + Fix slime-insert-presentation to handle multi-line presentations + better (use insert-rectangle) + + * swank.lisp: + Properly bind *sldb-printer-bindings* and turn off right margin + while printing stuff in sldb + + * slime.el: Smarten up the sldb heuristic that drops swank frames + + * swank-allegro.lisp, swank-backend.lisp, swank-openmcl.lisp, + swank-sbcl.lisp, swank.lisp: Added hash-table-weakness and use it + in hash-table-inspecting + + * swank.lisp: + Hashtable inspecting: added [clear hashtable] and [remove entry] + actions + + * slime.el, swank.lisp: FIX dwim inspecting to handle (setf + some-fun) functions, too + + * slime.el: FIX: slime-sexp-at-point for foo::|bar::baz| + + * slime.el: + FIX: Properly keep track of slime-buffer-package in the inspector + + * swank.lisp: Small: get rid of notes and warnings + + * slime.el, swank.lisp: Added dwim-mode to slime-inspect that + tries to be smart unless prefixed + + * slime.el: + Make slime-fuzzy-complete-symbol the default in the belife that + it's better for new users + + * swank.lisp: + Add (expt 1.2 length) higher scores for longer matches in fuzzy + completion. - A good example: puts "make-instance" before "make-string-input-stream" while completing "make-ins" + A good example: puts "make-instance" before + "make-string-input-stream" while completing "make-ins" * slime.el: Set slime-fuzzy-completion-in-place enabled by default * slime.el: - Added (cons row col) addressing to slime-open-inspector, use in slime-inspector-operate-on-point + Added (cons row col) addressing to slime-open-inspector, use in + slime-inspector-operate-on-point * slime.el: - FIX: operate the inspector in the debug thread when started from sldb + FIX: operate the inspector in the debug thread when started from + sldb * slime.el: - Convert some inspector defuns to defun* and use keywords. Other minor cleanups. + Convert some inspector defuns to defun* and use keywords. Other + minor cleanups. 2006-12-18 Marco Baringer From mbaringer at common-lisp.net Thu Dec 21 18:15:52 2006 From: mbaringer at common-lisp.net (mbaringer) Date: Thu, 21 Dec 2006 13:15:52 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061221181552.37FB52E1BB@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv12101 Modified Files: ChangeLog Log Message: Fix mauled ChangeLog entries. --- /project/slime/cvsroot/slime/ChangeLog 2006/12/20 14:54:52 1.1025 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/21 18:15:51 1.1026 @@ -1,41 +1,35 @@ 2006-12-20 Attila Lendvai - * slime.el: - FIX: inspecting presentations from the right click menu broke in - the inspect refactor + * slime.el: FIX: inspecting presentations from the right click + menu broke in the inspect refactor - * slime.el: - FIX: slime-fuzzy-target-buffer-completions-mode's keymap must - always precede other keymaps + * slime.el: FIX: slime-fuzzy-target-buffer-completions-mode's + keymap must always precede other keymaps * slime.el, swank.lisp: Extend :write-string with and &optional presentation id and use this in present-in-emacs - * swank.lisp: - Added present-in-emacs that prints a presentation of the given - object in the repl + * swank.lisp: Added present-in-emacs that prints a presentation of + the given object in the repl - * swank.lisp: - Return the inspected object when inspecting from the lisp side. + * swank.lisp: Return the inspected object when inspecting from the + lisp side. * swank.lisp: Turn off right margin for restart printing, too 2006-12-19 Attila Lendvai - * HACKING: - Added useful init.el piece into HACKING about update-change-log + * HACKING: Added useful init.el piece into HACKING about + update-change-log - * swank.lisp: - In all-slots-for-inspector pad slot names to be equal length, so - the result is more readable + * swank.lisp: In all-slots-for-inspector pad slot names to be + equal length, so the result is more readable - * slime.el: - Fix slime-insert-presentation to handle multi-line presentations - better (use insert-rectangle) + * slime.el: Fix slime-insert-presentation to handle multi-line + presentations better (use insert-rectangle) - * swank.lisp: - Properly bind *sldb-printer-bindings* and turn off right margin - while printing stuff in sldb + * swank.lisp: Properly bind *sldb-printer-bindings* and turn off + right margin while printing stuff in sldb * slime.el: Smarten up the sldb heuristic that drops swank frames @@ -43,123 +37,46 @@ swank-sbcl.lisp, swank.lisp: Added hash-table-weakness and use it in hash-table-inspecting - * swank.lisp: - Hashtable inspecting: added [clear hashtable] and [remove entry] - actions + * swank.lisp: Hashtable inspecting: added [clear hashtable] + and [remove entry] actions * slime.el, swank.lisp: FIX dwim inspecting to handle (setf some-fun) functions, too * slime.el: FIX: slime-sexp-at-point for foo::|bar::baz| - * slime.el: - FIX: Properly keep track of slime-buffer-package in the inspector + * slime.el: FIX: Properly keep track of slime-buffer-package in + the inspector * swank.lisp: Small: get rid of notes and warnings * slime.el, swank.lisp: Added dwim-mode to slime-inspect that tries to be smart unless prefixed - * slime.el: - Make slime-fuzzy-complete-symbol the default in the belife that - it's better for new users - - * swank.lisp: - Add (expt 1.2 length) higher scores for longer matches in fuzzy - completion. + * slime.el: Make slime-fuzzy-complete-symbol the default in the + belife that it's better for new users - A good example: puts "make-instance" before - "make-string-input-stream" while completing "make-ins" + * swank.lisp: Add (expt 1.2 length) higher scores for longer + matches in fuzzy completion. A good example: puts "make-instance" + before "make-string-input-stream" while completing "make-ins" * slime.el: Set slime-fuzzy-completion-in-place enabled by default - * slime.el: - Added (cons row col) addressing to slime-open-inspector, use in - slime-inspector-operate-on-point - - * slime.el: - FIX: operate the inspector in the debug thread when started from - sldb - - * slime.el: - Convert some inspector defuns to defun* and use keywords. Other - minor cleanups. - -2006-12-19 Attila Lendvai - - * HACKING: - Added useful init.el piece into HACKING about update-change-log - - * swank.lisp: - In all-slots-for-inspector pad slot names to be equal length, so - the result is more readable - - * slime.el: - Fix slime-insert-presentation to handle multi-line presentations - better (use insert-rectangle) - - * swank.lisp: - Properly bind *sldb-printer-bindings* and turn off right margin - while printing stuff in sldb - - * slime.el: Smarten up the sldb heuristic that drops swank frames + * slime.el: Added (cons row col) addressing to + slime-open-inspector, use in slime-inspector-operate-on-point - * swank-allegro.lisp, swank-backend.lisp, swank-openmcl.lisp, - swank-sbcl.lisp, swank.lisp: Added hash-table-weakness and use it - in hash-table-inspecting + * slime.el: FIX: operate the inspector in the debug thread when + started from sldb - * swank.lisp: - Hashtable inspecting: added [clear hashtable] and [remove entry] - actions - - * slime.el, swank.lisp: FIX dwim inspecting to handle (setf - some-fun) functions, too - - * slime.el: FIX: slime-sexp-at-point for foo::|bar::baz| - - * slime.el: - FIX: Properly keep track of slime-buffer-package in the inspector - - * swank.lisp: Small: get rid of notes and warnings - - * slime.el, swank.lisp: Added dwim-mode to slime-inspect that - tries to be smart unless prefixed - - * slime.el: - Make slime-fuzzy-complete-symbol the default in the belife that - it's better for new users - - * swank.lisp: - Add (expt 1.2 length) higher scores for longer matches in fuzzy - completion. - - A good example: puts "make-instance" before - "make-string-input-stream" while completing "make-ins" - - * slime.el: Set slime-fuzzy-completion-in-place enabled by default - - * slime.el: - Added (cons row col) addressing to slime-open-inspector, use in - slime-inspector-operate-on-point - - * slime.el: - FIX: operate the inspector in the debug thread when started from - sldb - - * slime.el: - Convert some inspector defuns to defun* and use keywords. Other - minor cleanups. - -2006-12-18 Marco Baringer - - * slime.el (slime-region-for-defun-at-point): end-of-defun and - beginning-of-defun modify match-data, so we should save it. + * slime.el: Convert some inspector defuns to defun* and use + keywords. Other minor cleanups. 2006-12-18 Marco Baringer * slime.el (slime-region-for-defun-at-point): end-of-defun and beginning-of-defun modify match-data, added a save-match-data to - prevent this. + prevent this from affecting callers of + slime-region-for-defun-at-point. 2006-12-15 Edi Weitz From mkoeppe at common-lisp.net Sat Dec 23 12:04:48 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 23 Dec 2006 07:04:48 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061223120448.2A6A648000@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20543 Modified Files: slime.el Log Message: (slime-inspect): Add a dwim-mode keyword argument, move all input handling into the interactive spec. Restore the behavior of slime-inspect when point is within a presentation (no prompting, no DWIM). (slime-inspect-presentation-at-mouse): Don't do DWIM here, so the presentation-retrieval expression does not end up on the inspector stack. --- /project/slime/cvsroot/slime/slime.el 2006/12/20 14:44:11 1.722 +++ /project/slime/cvsroot/slime/slime.el 2006/12/23 12:04:47 1.723 @@ -3420,7 +3420,8 @@ (with-current-buffer buffer (not (eq major-mode 'slime-inspector-mode))))) (slime-inspect (slime-presentation-expression presentation) - :no-reset (not reset-p))))) + :no-reset (not reset-p) + :eval t :dwim-mode nil)))) (defun slime-copy-presentation-at-mouse (event) (interactive "e") @@ -9102,21 +9103,34 @@ (defvar slime-inspector-mark-stack '()) (defvar slime-saved-window-config) -(defun* slime-inspect (form &key no-reset (eval (not current-prefix-arg)) thread - (package (slime-current-package))) - "Take an expression and inspect it trying to be smart about what was the intention. - -If called with a prefix argument the value will be evaluated and inspected -without any magic in behind the stage." +(defun* slime-inspect (form &key no-reset eval dwim-mode + thread (package (slime-current-package))) + "Take an expression FORM and inspect it. +If DWIM-MODE is non-nil (the interactive default), try to be +smart about what was the intention. Otherwise, if EVAL is +non-nil (interactively, if invoked with a prefix argument), +evaluate FORM and inspect the result. Otherwise, inspect FORM +itself." (interactive - (list (slime-read-object (if current-prefix-arg - "Inspect value (evaluated): " - "Inspect value (dwim mode): ") - :return-names-unconfirmed (not current-prefix-arg)))) + (multiple-value-bind (presentation start end) + (slime-presentation-around-point (point)) + (if presentation + ;; Point is within a presentation, so don't prompt, just + ;; inspect the presented object; don't play DWIM. + (cons (slime-presentation-expression presentation) + '(:eval t :dwim-mode nil)) + ;; Not in a presentation, read form from minibuffer. + (cons (slime-read-object (if current-prefix-arg + "Inspect value (evaluated): " + "Inspect value (dwim mode): ") + :return-names-unconfirmed (not current-prefix-arg)) + (if current-prefix-arg + '(:eval t :dwim-mode nil) + '(:eval nil :dwim-mode t)))))) (slime-eval-async `(swank:init-inspector ,form :reset ,(not no-reset) - :eval ,(not (null current-prefix-arg)) - :dwim-mode ,(not current-prefix-arg)) + :eval ,eval + :dwim-mode ,dwim-mode) (with-lexical-bindings (thread package) (lambda (thing) (slime-open-inspector thing From mkoeppe at common-lisp.net Sat Dec 23 12:44:03 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 23 Dec 2006 07:44:03 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061223124403.83BFC5F027@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv25969 Modified Files: slime.el Log Message: (slime-inspector-position): New. (slime-inspector-operate-on-point, slime-inspector-reinspect): Use it here to make it work on GNU Emacs too. (slime-open-inspector): Fix row-col addressing at end of buffer. --- /project/slime/cvsroot/slime/slime.el 2006/12/23 12:04:47 1.723 +++ /project/slime/cvsroot/slime/slime.el 2006/12/23 12:44:03 1.724 @@ -9199,8 +9199,8 @@ (pop-to-buffer (current-buffer)) (when point (if (consp point) - (progn - (goto-line (min (count-lines 1 (point-max)) (car point))) + (ignore-errors + (goto-line (car point)) (move-to-column (cdr point))) (goto-char (min (point-max) point))))))))) @@ -9220,13 +9220,25 @@ 'face 'slime-inspector-action-face) string))))) +(defun slime-inspector-position () + "Return a pair (Y-POSITION X-POSITION) representing the +position of point in the current buffer." + ;; We make sure we return absolute coordinates even if the user has + ;; narrowed the buffer. + (save-restriction + (widen) + (cons (if (fboundp 'line-number) + (line-number) ; XEmacs + (line-number-at-pos)) ; Emacs + (current-column)))) + (defun slime-inspector-operate-on-point () "If point is on a value then recursivly call the inspector on that value. If point is on an action then call that action." (interactive) (let ((part-number (get-text-property (point) 'slime-part-number)) (action-number (get-text-property (point) 'slime-action-number)) - (opener (lexical-let ((point (cons (line-number) (current-column)))) + (opener (lexical-let ((point (slime-inspector-position))) (lambda (parts) (slime-open-inspector parts :point point))))) (cond (part-number @@ -9349,7 +9361,7 @@ (defun slime-inspector-reinspect () (interactive) (slime-eval-async `(swank:inspector-reinspect) - (lexical-let ((point (cons (line-number) (current-column)))) + (lexical-let ((point (slime-inspector-position))) (lambda (parts) (slime-open-inspector parts :point point))))) From mkoeppe at common-lisp.net Sat Dec 23 12:44:36 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 23 Dec 2006 07:44:36 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061223124436.A262D68003@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26037 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/21 18:15:51 1.1026 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/23 12:44:36 1.1027 @@ -1,3 +1,17 @@ +2006-12-23 Matthias Koeppe + + * slime.el (slime-inspect): Add a dwim-mode keyword argument, move + all input handling into the interactive spec. Restore the + behavior of slime-inspect when point is within a presentation (no + prompting, no DWIM). + (slime-inspect-presentation-at-mouse): Don't do DWIM here, so the + presentation-retrieval expression does not end up on the inspector + stack. + (slime-inspector-position): New. + (slime-inspector-operate-on-point, slime-inspector-reinspect): Use + it here to make it work on GNU Emacs too. + (slime-open-inspector): Fix row-col addressing at end of buffer. + 2006-12-20 Attila Lendvai * slime.el: FIX: inspecting presentations from the right click From mkoeppe at common-lisp.net Sat Dec 23 12:58:42 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 23 Dec 2006 07:58:42 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061223125842.0BC1F2201C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26894 Modified Files: swank-clisp.lisp Log Message: (make-weak-key-hash-table, make-weak-value-hash-table): Implement for CLISP, so that the REPL results history does not cause "memory leaks". --- /project/slime/cvsroot/slime/swank-clisp.lisp 2006/11/19 21:33:03 1.60 +++ /project/slime/cvsroot/slime/swank-clisp.lisp 2006/12/23 12:58:41 1.61 @@ -588,6 +588,15 @@ #+lisp=cl (ext:quit) #-lisp=cl (lisp:quit)) + +;;;; Weak hashtables + +(defimplementation make-weak-key-hash-table (&rest args) + (apply #'make-hash-table :weak :key args)) + +(defimplementation make-weak-value-hash-table (&rest args) + (apply #'make-hash-table :weak :value args)) + ;;; Local Variables: ;;; eval: (put 'compile-file-frobbing-notes 'lisp-indent-function 1) ;;; eval: (put 'dynamic-flet 'common-lisp-indent-function 1) From mkoeppe at common-lisp.net Sat Dec 23 12:58:55 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sat, 23 Dec 2006 07:58:55 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061223125855.AF32822022@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv26937 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/23 12:44:36 1.1027 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/23 12:58:55 1.1028 @@ -1,5 +1,9 @@ 2006-12-23 Matthias Koeppe + * swank-clisp.lisp (make-weak-key-hash-table) + (make-weak-value-hash-table): Implement for CLISP, so that the + REPL results history does not cause "memory leaks". + * slime.el (slime-inspect): Add a dwim-mode keyword argument, move all input handling into the interactive spec. Restore the behavior of slime-inspect when point is within a presentation (no From alendvai at common-lisp.net Sun Dec 24 13:38:36 2006 From: alendvai at common-lisp.net (alendvai) Date: Sun, 24 Dec 2006 08:38:36 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061224133836.9567B5F01C@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6356 Modified Files: swank.lisp Log Message: Sort slot names in the inspector --- /project/slime/cvsroot/slime/swank.lisp 2006/12/20 14:29:09 1.440 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/24 13:38:36 1.441 @@ -4472,7 +4472,8 @@ "All Slots:" (:newline)) (let* ((class (class-of object)) (direct-slots (swank-mop:class-direct-slots class)) - (effective-slots (swank-mop:class-slots class)) + (effective-slots (sort (swank-mop:class-slots class) + #'string< :key #'swank-mop:slot-definition-name)) (slot-presentations (loop for effective-slot :in effective-slots collect (inspect-slot-for-emacs class object effective-slot))) From alendvai at common-lisp.net Sun Dec 24 13:40:05 2006 From: alendvai at common-lisp.net (alendvai) Date: Sun, 24 Dec 2006 08:40:05 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061224134005.5DBA81C009@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv6724 Modified Files: swank.lisp Log Message: Change the order to [set value] [make unbound] --- /project/slime/cvsroot/slime/swank.lisp 2006/12/24 13:38:36 1.441 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/24 13:40:05 1.442 @@ -4446,24 +4446,28 @@ (defgeneric inspect-slot-for-emacs (class object slot) (:method (class object slot) - (let ((slot-name (swank-mop:slot-definition-name slot))) - `(,@(if (swank-mop:slot-boundp-using-class class object slot) - `((:value ,(swank-mop:slot-value-using-class class object slot)) - " " (:action "[make unbound]" - ,(lambda () (swank-mop:slot-makunbound-using-class class object slot)))) - '("#")) - " " (:action "[set value]" - ,(lambda () (with-simple-restart - (abort "Abort setting slot ~S" slot-name) - (let ((value-string (eval-in-emacs - `(condition-case c - (slime-read-object - ,(format nil "Set slot ~S to (evaluated) : " slot-name)) - (quit nil))))) - (when (and value-string - (not (string= value-string ""))) - (setf (swank-mop:slot-value-using-class class object slot) - (eval (read-from-string value-string)))))))))))) + (let ((slot-name (swank-mop:slot-definition-name slot)) + (boundp (swank-mop:slot-boundp-using-class class object slot))) + `(,@(if boundp + `((:value ,(swank-mop:slot-value-using-class class object slot))) + `("#")) + " " + (:action "[set value]" + ,(lambda () (with-simple-restart + (abort "Abort setting slot ~S" slot-name) + (let ((value-string (eval-in-emacs + `(condition-case c + (slime-read-object + ,(format nil "Set slot ~S to (evaluated) : " slot-name)) + (quit nil))))) + (when (and value-string + (not (string= value-string ""))) + (setf (swank-mop:slot-value-using-class class object slot) + (eval (read-from-string value-string)))))))) + " " + ,@(when boundp + `(" " (:action "[make unbound]" + ,(lambda () (swank-mop:slot-makunbound-using-class class object slot))))))))) (defgeneric all-slots-for-inspector (object inspector) (:method ((object standard-object) inspector) From alendvai at common-lisp.net Sun Dec 24 13:43:15 2006 From: alendvai at common-lisp.net (alendvai) Date: Sun, 24 Dec 2006 08:43:15 -0500 (EST) Subject: [slime-cvs] CVS slime/doc Message-ID: <20061224134315.1D80D25003@common-lisp.net> Update of /project/slime/cvsroot/slime/doc In directory clnet:/tmp/cvs-serv8640/doc Modified Files: slime.texi Log Message: Small doc fixes by Alfredo Beaumont --- /project/slime/cvsroot/slime/doc/slime.texi 2006/11/22 06:27:38 1.50 +++ /project/slime/cvsroot/slime/doc/slime.texi 2006/12/24 13:43:15 1.51 @@ -10,7 +10,7 @@ @set EDITION 2.0 @c @set UPDATED @today{} - at set UPDATED @code{$Date: 2006/11/22 06:27:38 $} + at set UPDATED @code{$Date: 2006/12/24 13:43:15 $} @set TITLE SLIME User Manual @settitle @value{TITLE}, version @value{EDITION} @@ -381,7 +381,7 @@ (global-set-key "\C-cs" 'slime-selector) @end example @noindent -which binds @kbd{C-c s} to the function @code{global-set-key}. +which binds @kbd{C-c s} to the function @code{slime-selector}. @c ----------------------- @node inferior-lisp, Multithreading, About key bindings, User-interface conventions @@ -1753,7 +1753,6 @@ @end example @c ----------------------- -======= If you need to do anything particular (like be able to reconnect to swank after you're done), look into @code{swank:create-server}'s other arguments. Some of these arguments @@ -1786,7 +1785,6 @@ to connect to this lisp image from the same machine. ->>>>>>> 1.49 @node Setting up Emacs @subsection Setting up Emacs From alendvai at common-lisp.net Sun Dec 24 13:44:11 2006 From: alendvai at common-lisp.net (alendvai) Date: Sun, 24 Dec 2006 08:44:11 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061224134411.6786732015@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv8791 Modified Files: slime.el swank.lisp Log Message: Added customizable dwim lookup hook support for inspect --- /project/slime/cvsroot/slime/slime.el 2006/12/23 12:44:03 1.724 +++ /project/slime/cvsroot/slime/slime.el 2006/12/24 13:44:11 1.725 @@ -9149,7 +9149,7 @@ (if (and sexp return-names-unconfirmed ;; an string with alphanumeric chars and hyphens only? - (and (string-match "\\([-|:0-9a-zA-Z]*\\)" sexp) + (and (string-match "\\([-|.:0-9a-zA-Z]*\\)" sexp) (= (match-end 0) (length sexp)))) sexp (slime-read-from-minibuffer prompt sexp)))))) --- /project/slime/cvsroot/slime/swank.lisp 2006/12/24 13:40:05 1.442 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/24 13:44:11 1.443 @@ -40,6 +40,7 @@ #:*default-worker-thread-bindings* #:*macroexpand-printer-bindings* #:*record-repl-results* + #:*inspector-dwim-lookup-hooks* ;; These are re-exported directly from the backend: #:buffer-first-change #:frame-source-location-for-emacs @@ -4835,39 +4836,55 @@ (not (third form)) (eq (first form) 'setf)))) +(defvar *inspector-dwim-lookup-hooks* '(default-dwim-inspector-lookup-hook) + "A list of funcallables with one argument. It can be used to register user hooks that look up various things when inspecting in dwim mode.") + +(defun default-dwim-inspector-lookup-hook (form) + (let ((result '())) + (when (and (symbolp form) + (boundp form)) + (push (symbol-value form) result)) + (when (and (valid-function-name-p form) + (fboundp form)) + (push (fdefinition form) result)) + (when (and (symbolp form) + (find-class form nil)) + (push (find-class form) result)) + (when (and (consp form) + (valid-function-name-p (first form)) + (fboundp (first form))) + (push (eval form) result)) + (values result (not (null result))))) + (defslimefun init-inspector (string &key (reset t) (eval t) (dwim-mode nil)) (with-buffer-syntax () (when reset (reset-inspector)) (let* ((form (read-from-string string)) - (value (cond (dwim-mode - ;; TODO: here we _may_ want to present the - ;; multiple possibilities when available - ;; instead of this hardcoded order. - (cond ((and (symbolp form) - (boundp form)) - (symbol-value form)) - ((and (valid-function-name-p form) - (fboundp form)) - (fdefinition form)) - ((and (symbolp form) - (find-class form nil)) - (find-class form)) - ((atom form) - form) - (t (if (and (valid-function-name-p (first form)) - (fboundp (first form))) - (eval form) - form)))) - (eval (eval form)) - (t form)))) + (value (cond + (dwim-mode + (let ((things (loop for hook :in *inspector-dwim-lookup-hooks* + for (result foundp) = (multiple-value-list + (funcall hook form)) + when foundp + append (if (consp result) + result + (list result))))) + (if (rest things) + things + (first things)))) + (eval (eval form)) + (t form)))) (when (and dwim-mode - form) + form + value) ;; push the form to the inspector stack, so you can go back to it ;; with slime-inspector-pop if dwim missed the intention (push form *inspector-stack*)) - (inspect-object value)))) - + (inspect-object (if dwim-mode + (or value form) + value))))) + (defun print-part-to-string (value) (let ((string (to-string value)) (pos (position value *inspector-history*))) From alendvai at common-lisp.net Sun Dec 24 13:51:52 2006 From: alendvai at common-lisp.net (alendvai) Date: Sun, 24 Dec 2006 08:51:52 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061224135152.F12FB50027@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv9650 Modified Files: ChangeLog Log Message: Updated changelog --- /project/slime/cvsroot/slime/ChangeLog 2006/12/23 12:58:55 1.1028 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/24 13:51:52 1.1029 @@ -1,3 +1,13 @@ +2006-12-24 Attila Lendvai + + * slime.el, swank.lisp: Added customizable dwim lookup hook + support for inspect + + * doc/slime.texi: Small doc fixes by Alfredo Beaumont + + * swank.lisp: Change the order to [set value] [make unbound]. Sort + slot names in the inspector + 2006-12-23 Matthias Koeppe * swank-clisp.lisp (make-weak-key-hash-table) From mkoeppe at common-lisp.net Thu Dec 28 14:14:48 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Thu, 28 Dec 2006 09:14:48 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061228141448.BD36C63012@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv13966 Modified Files: slime.el Log Message: (slime-repl-mode-beginning-of-defun) (slime-repl-mode-end-of-defun): New. (slime-repl-mode): Use them as beginning-of-defun-function and end-of-defun-function. (slime-enclosing-operator-names): Bind parse-sexp-lookup-properties to nil, don't parse more than 20000 characters before point, don't determine exact argument positions larger than 64. Byte-compile this function. --- /project/slime/cvsroot/slime/slime.el 2006/12/24 13:44:11 1.725 +++ /project/slime/cvsroot/slime/slime.el 2006/12/28 14:14:46 1.726 @@ -3227,8 +3227,21 @@ (when slime-repl-enable-presentations ;; Respect the syntax text properties of presentations. (set (make-local-variable 'parse-sexp-lookup-properties) t)) + ;; We only want REPL prompts as start of the "defun". + (set (make-local-variable 'beginning-of-defun-function) + 'slime-repl-mode-beginning-of-defun) + (set (make-local-variable 'end-of-defun-function) + 'slime-repl-mode-end-of-defun) (run-hooks 'slime-repl-mode-hook)) +(defun slime-repl-mode-beginning-of-defun () + (slime-repl-previous-prompt) + t) + +(defun slime-repl-mode-end-of-defun () + (slime-repl-next-prompt) + t) + (defun slime-presentation-whole-p (presentation start end &optional object) (let ((object (or object (current-buffer)))) (string= (etypecase object @@ -10892,12 +10905,20 @@ levels of parens." (let ((result '()) (arg-indices '()) - (level 1)) + (level 1) + (parse-sexp-lookup-properties nil)) + ;; The expensive lookup of syntax-class text properties is only + ;; used for interactive balancing of #<...> in presentations; we + ;; do not need them in navigating through the nested lists. + ;; This speeds up this function significantly. (ignore-errors (save-excursion ;; Make sure we get the whole operator name. (slime-end-of-symbol) (save-restriction + ;; Don't parse more than 20000 characters before point, so we don't spend + ;; too much time. + (narrow-to-region (max (point-min) (- (point) 20000)) (point-max)) (narrow-to-region (save-excursion (beginning-of-defun) (point)) (min (1+ (point)) (point-max))) (while (or (not max-levels) @@ -10910,8 +10931,9 @@ (incf arg-index)) (ignore-errors (backward-sexp 1)) - (while (ignore-errors (backward-sexp 1) - (> (point) (point-min))) + (while (and (< arg-index 64) + (ignore-errors (backward-sexp 1) + (> (point) (point-min)))) (incf arg-index)) (backward-up-list 1) (when (member (char-syntax (char-after)) '(?\( ?')) @@ -11243,7 +11265,8 @@ slime-print-apropos slime-show-note-counts slime-insert-propertized - slime-tree-insert))) + slime-tree-insert + slime-enclosing-operator-names))) (run-hooks 'slime-load-hook) From mkoeppe at common-lisp.net Thu Dec 28 14:15:55 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Thu, 28 Dec 2006 09:15:55 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061228141555.DEA04710FC@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv14141 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/24 13:51:52 1.1029 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/28 14:15:55 1.1030 @@ -1,3 +1,17 @@ +2006-12-28 Matthias Koeppe + + Performance improvement for slime-autodoc-mode, in particular when + there are REPL results that are long lists. + + * slime.el (slime-repl-mode-beginning-of-defun) + (slime-repl-mode-end-of-defun): New. + (slime-repl-mode): Use them as beginning-of-defun-function and + end-of-defun-function. + (slime-enclosing-operator-names): Bind + parse-sexp-lookup-properties to nil, don't parse more than 20000 + characters before point, don't determine exact argument positions + larger than 64. Byte-compile this function. + 2006-12-24 Attila Lendvai * slime.el, swank.lisp: Added customizable dwim lookup hook From mkoeppe at common-lisp.net Fri Dec 29 16:08:58 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Fri, 29 Dec 2006 11:08:58 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061229160858.06A18471E7@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv31017 Modified Files: slime.el Log Message: (slime-repl-insert-prompt): Don't insert a result, only the prompt. (slime-repl-insert-result): Removed. (slime-repl-eval-string, slime-repl-show-abort) (slime-repl-set-package, slime-output-buffer) (slime-repl-update-banner): Change all callers. (slime-dispatch-event): Event :WRITE-STRING gets an optional argument TARGET, which controls where the string is inserted. (slime-write-string): Handle targets NIL (regular process output) and :REPL-RESULT. --- /project/slime/cvsroot/slime/slime.el 2006/12/28 14:14:46 1.726 +++ /project/slime/cvsroot/slime/slime.el 2006/12/29 16:08:56 1.727 @@ -2636,12 +2636,8 @@ (defun slime-dispatch-event (event &optional process) (let ((slime-dispatching-connection (or process (slime-connection)))) (destructure-case event - ((:write-string output &optional id) - (if id - (with-current-buffer (slime-output-buffer) - (slime-with-output-end-mark - (slime-insert-presentation output id))) - (slime-write-string output))) + ((:write-string output &optional id target) + (slime-write-string output id target)) ((:presentation-start id) (slime-mark-presentation-start id)) ((:presentation-end id) @@ -2819,7 +2815,7 @@ (setq slime-buffer-connection connection) (slime-reset-repl-markers) (unless noprompt - (slime-repl-insert-prompt '(:suppress-output) 0)) + (slime-repl-insert-prompt 0)) (current-buffer))))))) (defun slime-repl-update-banner () @@ -2841,8 +2837,7 @@ (animate-string (format "; SLIME %s" (or (slime-changelog-date) "- ChangeLog file not found")) 0 0)) - (slime-repl-insert-prompt (cond (use-header-p `(:suppress-output)) - (t `(:values (,(concat "; " banner)))))))) + (slime-repl-insert-prompt))) (defun slime-init-output-buffer (connection) (with-current-buffer (slime-output-buffer t) @@ -3096,15 +3091,31 @@ (switch-to-buffer (process-buffer proc)) (goto-char (point-max))))) -(defun slime-write-string (string) - (with-current-buffer (slime-output-buffer) - (slime-with-output-end-mark - (slime-propertize-region '(face slime-repl-output-face) - (insert string)) - (when (and (= (point) slime-repl-prompt-start-mark) - (not (bolp))) - (insert "\n") - (set-marker slime-output-end (1- (point))))))) +(defun slime-write-string (string &optional id target) + "Insert STRING in the REPL buffer. If ID is non-nil, insert STRING +as a presentation. If TARGET is nil, insert STRING as regular process +output. If TARGET is :repl-result, insert STRING as the result of the +evaluation." + ;; Other values of TARGET are reserved for future extension, + ;; for instance asynchronous output in scratch buffers. --mkoeppe + (ecase target + ((nil) ; Regular process output + (with-current-buffer (slime-output-buffer) + (slime-with-output-end-mark + (if id + (slime-insert-presentation string id) + (slime-insert-propertized '(face slime-repl-output-face) string)) + (when (and (= (point) slime-repl-prompt-start-mark) + (not (bolp))) + (insert "\n") + (set-marker slime-output-end (1- (point))))))) + (:repl-result + (with-current-buffer (slime-output-buffer) + (goto-char (point-max)) + ;;(unless (bolp) (insert "\n")) + (if id + (slime-insert-presentation string id) + (slime-insert-propertized `(face slime-repl-result-face) string)))))) (defun slime-switch-to-output-buffer (&optional connection) "Select the output buffer, preferably in a different window." @@ -3540,57 +3551,33 @@ (when choice (call-interactively (gethash choice choice-to-lambda))))))))) -(defun slime-repl-insert-prompt (result &optional time) - "Goto to point max, insert RESULT and the prompt. +(defun slime-repl-insert-prompt (&optional time) + "Goto to point max, and insert the prompt. Set slime-output-end to start of the inserted text slime-input-start to end end." (goto-char (point-max)) - (let ((start (point))) - (unless (bolp) (insert "\n")) - (slime-repl-insert-result result) - (let ((prompt-start (point)) - (prompt (format "%s> " (slime-lisp-package-prompt-string)))) - (slime-propertize-region - '(face slime-repl-prompt-face read-only t intangible t - slime-repl-prompt t - ;; emacs stuff - rear-nonsticky (slime-repl-prompt read-only face intangible) - ;; xemacs stuff - start-open t end-open t) - (insert prompt)) - ;; FIXME: we could also set beginning-of-defun-function - (setq defun-prompt-regexp (concat "^" prompt)) - (set-marker slime-output-end start) - (set-marker slime-repl-prompt-start-mark prompt-start) - (slime-mark-input-start) - (let ((time (or time 0.2))) - (cond ((zerop time) - (slime-repl-move-output-mark-before-prompt (current-buffer))) - (t - (run-at-time time nil 'slime-repl-move-output-mark-before-prompt - (current-buffer))))))) + (unless (bolp) (insert "\n")) + (let ((prompt-start (point)) + (prompt (format "%s> " (slime-lisp-package-prompt-string)))) + (slime-propertize-region + '(face slime-repl-prompt-face read-only t intangible t + slime-repl-prompt t + ;; emacs stuff + rear-nonsticky (slime-repl-prompt read-only face intangible) + ;; xemacs stuff + start-open t end-open t) + (insert prompt)) + ;;(set-marker slime-output-end start) + (set-marker slime-repl-prompt-start-mark prompt-start) + (slime-mark-input-start) + (let ((time (or time 0.2))) + (cond ((zerop time) + (slime-repl-move-output-mark-before-prompt (current-buffer))) + (t + (run-at-time time nil 'slime-repl-move-output-mark-before-prompt + (current-buffer)))))) (slime-repl-show-maximum-output)) -(defun slime-repl-insert-result (result) - "Insert the result of an evaluation. -RESULT can be one of: - (:values (STRING...)) - (:present ((STRING . ID)...)) - (:suppress-output)" - (destructure-case result - ((:values strings) - (cond ((null strings) (insert "; No value\n")) - (t (dolist (s strings) - (slime-insert-propertized `(face slime-repl-result-face) s) - (insert "\n"))))) - ((:present stuff) - (cond ((and stuff slime-repl-enable-presentations) - (loop for (s . id) in stuff do - (slime-insert-presentation s id) - (insert "\n"))) - (t (slime-repl-insert-result `(:values ,(mapcar #'car stuff)))))) - ((:suppress-output)))) - (defun slime-repl-move-output-mark-before-prompt (buffer) (when (buffer-live-p buffer) (with-current-buffer buffer @@ -3686,10 +3673,13 @@ (defun slime-repl-eval-string (string) (slime-rex () ((list 'swank:listener-eval string) (slime-lisp-package)) - ((:ok result) + ((:ok result) (with-current-buffer (slime-output-buffer) - (slime-repl-insert-prompt result))) - ((:abort) (slime-repl-show-abort)))) + (slime-repl-insert-prompt))) + ((:abort) + (slime-repl-show-abort) + (with-current-buffer (slime-output-buffer) + (slime-repl-insert-prompt))))) (defun slime-repl-send-string (string &optional command-string) (cond (slime-repl-read-mode @@ -3700,13 +3690,7 @@ (with-current-buffer (slime-output-buffer) (slime-with-output-end-mark (unless (bolp) (insert-before-markers "\n")) - (insert-before-markers "; Evaluation aborted\n")) - (slime-rex () - ((list 'swank:listener-eval "") nil) - ((:ok result) - ;; A hack to get the prompt - (with-current-buffer (slime-output-buffer) - (slime-repl-insert-prompt '(:suppress-output))))))) + (insert-before-markers "; Evaluation aborted\n")))) (defun slime-mark-input-start () (set-marker slime-repl-last-input-start-mark @@ -4022,7 +4006,7 @@ (slime-eval `(swank:set-package ,package)) (setf (slime-lisp-package) name) (setf (slime-lisp-package-prompt-string) prompt-string) - (slime-repl-insert-prompt '(:suppress-output) 0) + (slime-repl-insert-prompt 0) (insert unfinished-input))))) From mkoeppe at common-lisp.net Fri Dec 29 16:10:26 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Fri, 29 Dec 2006 11:10:26 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061229161026.CB9EE3001D@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv31637 Modified Files: swank.lisp Log Message: (make-presentations-result): Removed. (send-repl-results-to-emacs): New function, sends :WRITE-STRING events. (listener-eval): Use it here instead of make-presentations-result. --- /project/slime/cvsroot/slime/swank.lisp 2006/12/24 13:44:11 1.443 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/29 16:10:26 1.444 @@ -2637,11 +2637,17 @@ (let ((p (setq *package* (guess-package-from-string package)))) (list (package-name p) (package-string-for-prompt p)))) -(defun make-presentations-result (values) - ;; overridden in present.lisp - `(:present ,(loop for x in values - collect (cons (prin1-to-string x) - (save-presented-object x))))) +(defun send-repl-results-to-emacs (values) + (flet ((send (value) + (let ((id (and *record-repl-results* + (save-presented-object value)))) + (send-to-emacs `(:write-string ,(prin1-to-string value) + ,id :repl-result)) + (send-to-emacs `(:write-string ,(string #\Newline) + nil :repl-result))))) + (if (null values) + (send-to-emacs `(:write-string "; No value" nil :repl-result)) + (mapc #'send values)))) (defslimefun listener-eval (string) (clear-user-input) @@ -2654,11 +2660,9 @@ (setq *** ** ** * * (car values) /// // // / / values)) (setq +++ ++ ++ + + last-form) - (cond ((eq *slime-repl-suppress-output* t) '(:suppress-output)) - (*record-repl-results* - (make-presentations-result values)) - (t - `(:values ,(mapcar #'prin1-to-string values)))))))) + (unless (eq *slime-repl-suppress-output* t) + (send-repl-results-to-emacs values))))) + nil) (defslimefun ed-in-emacs (&optional what) "Edit WHAT in Emacs. From mkoeppe at common-lisp.net Fri Dec 29 16:11:50 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Fri, 29 Dec 2006 11:11:50 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061229161150.8A6B838005@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv31701 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/28 14:15:55 1.1030 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/29 16:11:50 1.1031 @@ -1,3 +1,24 @@ +2006-12-29 Matthias Koeppe + + Simplify the REPL-results protocol. The results are now printed + using special :WRITE-STRING events from the Lisp side. + + * slime.el (slime-repl-insert-prompt): Don't insert a result, only + the prompt. + (slime-repl-insert-result): Removed. + (slime-repl-eval-string, slime-repl-show-abort) + (slime-repl-set-package, slime-output-buffer) + (slime-repl-update-banner): Change all callers. + (slime-dispatch-event): Event :WRITE-STRING gets an + optional argument TARGET, which controls where the string is + inserted. + (slime-write-string): Handle targets NIL (regular process output) + and :REPL-RESULT. + + * swank.lisp (make-presentations-result): Removed. + (send-repl-results-to-emacs): New function, sends :WRITE-STRING events. + (listener-eval): Use it here instead of make-presentations-result. + 2006-12-28 Matthias Koeppe Performance improvement for slime-autodoc-mode, in particular when From eweitz at common-lisp.net Fri Dec 29 18:39:17 2006 From: eweitz at common-lisp.net (eweitz) Date: Fri, 29 Dec 2006 13:39:17 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061229183917.B65BC6D073@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv20170 Modified Files: ChangeLog slime.el Log Message: Only offer an ASDF system as initial input if it's really in the central registry --- /project/slime/cvsroot/slime/ChangeLog 2006/12/29 16:11:50 1.1031 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/29 18:39:15 1.1032 @@ -1,3 +1,8 @@ +2006-12-29 Edi Weitz + + * slime.el (slime-find-asd, slime-read-system-name): Only offer + initial input if system is really in central registry. + 2006-12-29 Matthias Koeppe Simplify the REPL-results protocol. The results are now printed --- /project/slime/cvsroot/slime/slime.el 2006/12/29 16:08:56 1.727 +++ /project/slime/cvsroot/slime/slime.el 2006/12/29 18:39:15 1.728 @@ -4703,13 +4703,18 @@ (slime-compilation-finished-continuation)) (message "Compiling %s.." lisp-filename))) -(defun slime-find-asd () - (let ((asdf-systems-in-directory - (directory-files (file-name-directory (or default-directory - (buffer-file-name))) - nil "\.asd$"))) - (and asdf-systems-in-directory - (file-name-sans-extension (car asdf-systems-in-directory))))) +(defun slime-find-asd (system-names) + "Tries to find an ASDF system definition in the default +directory or in the directory belonging to the current buffer and +returns it if it's in `system-names'." + (let* ((asdf-systems-in-directory + (directory-files (file-name-directory (or default-directory + (buffer-file-name))) + nil "\.asd$"))) + (loop for system in asdf-systems-in-directory + for candidate = (file-name-sans-extension system) + when (find candidate system-names :test #'string-equal) + do (return candidate)))) (defun slime-load-system (&optional system) "Compile and load an ASDF system. @@ -4725,13 +4730,13 @@ (defun slime-read-system-name (&optional prompt initial-value) "Read a system name from the minibuffer, prompting with PROMPT." (setq prompt (or prompt "System: ")) - (let ((completion-ignore-case nil) - (alist (slime-bogus-completion-alist - (mapcar #'file-name-sans-extension - (slime-eval - `(swank:list-all-systems-in-central-registry)))))) + (let* ((completion-ignore-case nil) + (system-names (mapcar #'file-name-sans-extension + (slime-eval + `(swank:list-all-systems-in-central-registry)))) + (alist (slime-bogus-completion-alist system-names))) (completing-read prompt alist nil nil - (or initial-value (slime-find-asd) "") + (or initial-value (slime-find-asd system-names) "") 'slime-system-history))) (defun slime-oos (system operation &rest keyword-args) From mkoeppe at common-lisp.net Sun Dec 31 12:28:28 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 31 Dec 2006 07:28:28 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061231122828.3242B5903E@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv1378 Modified Files: swank.lisp Log Message: (connection): New slot repl-results (a stream). (make-output-function-for-target): New. (open-streams): Use it here to also create a stream for REPL results. (initialize-streams-for-connection): Store the stream. --- /project/slime/cvsroot/slime/swank.lisp 2006/12/29 16:10:26 1.444 +++ /project/slime/cvsroot/slime/swank.lisp 2006/12/31 12:28:28 1.445 @@ -198,6 +198,8 @@ (user-input nil :type (or stream null)) (user-output nil :type (or stream null)) (user-io nil :type (or stream null)) + ;; A stream where we send REPL results. + (repl-results nil :type (or stream null)) ;; In multithreaded systems we delegate certain tasks to specific ;; threads. The `reader-thread' is responsible for reading network ;; requests from Emacs and sending them to the `control-thread'; the @@ -518,8 +520,8 @@ (force-output *debug-io*))) (defun open-streams (connection) - "Return the 4 streams for IO redirection: -DEDICATED-OUTPUT INPUT OUTPUT IO" + "Return the 5 streams for IO redirection: +DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS" (multiple-value-bind (output-fn dedicated-output) (make-output-function connection) (let ((input-fn @@ -532,7 +534,11 @@ (let ((out (or dedicated-output out))) (let ((io (make-two-way-stream in out))) (mapc #'make-stream-interactive (list in out io)) - (values dedicated-output in out io))))))) + (let* ((repl-results-fn + (make-output-function-for-target connection :repl-result)) + (repl-results + (nth-value 1 (make-fn-streams nil repl-results-fn)))) + (values dedicated-output in out io repl-results)))))))) (defun make-output-function (connection) "Create function to send user output to Emacs. @@ -553,6 +559,14 @@ (send-to-emacs `(:write-string ,string))))) nil))) +(defun make-output-function-for-target (connection target) + "Create a function to send user output to a specific TARGET in Emacs." + (lambda (string) + (with-connection (connection) + (with-simple-restart + (abort "Abort sending output to Emacs.") + (send-to-emacs `(:write-string ,string nil ,target)))))) + (defun open-dedicated-output-stream (socket-io) "Open a dedicated output connection to the Emacs on SOCKET-IO. Return an output stream suitable for writing program output. @@ -880,11 +894,13 @@ (send event))))) (defun initialize-streams-for-connection (connection) - (multiple-value-bind (dedicated in out io) (open-streams connection) + (multiple-value-bind (dedicated in out io repl-results) + (open-streams connection) (setf (connection.dedicated-output connection) dedicated (connection.user-io connection) io (connection.user-output connection) out - (connection.user-input connection) in) + (connection.user-input connection) in + (connection.repl-results connection) repl-results) connection)) (defun create-connection (socket-io style) From mkoeppe at common-lisp.net Sun Dec 31 12:28:49 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 31 Dec 2006 07:28:49 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061231122849.280316B560@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv1474 Modified Files: present.lisp Log Message: (slime-stream-p): Allow sending presentations to the repl-results stream. (make-presentations-result): Removed. (send-repl-results-to-emacs): New. --- /project/slime/cvsroot/slime/present.lisp 2006/11/04 12:02:09 1.19 +++ /project/slime/cvsroot/slime/present.lisp 2006/12/31 12:28:46 1.20 @@ -96,7 +96,8 @@ thereis (or (eq stream (connection.dedicated-output connection)) (eq stream (connection.socket-io connection)) (eq stream (connection.user-output connection)) - (eq stream (connection.user-io connection)))))))))) + (eq stream (connection.user-io connection)) + (eq stream (connection.repl-results connection)))))))))) (defun can-present-readable-objects (&optional stream) (declare (ignore stream)) @@ -168,20 +169,20 @@ (write-annotation stream #'presentation-end record))) (funcall continue))) -(defun make-presentations-result (values) +(defun send-repl-results-to-emacs (values) ;; Override a function in swank.lisp, so that ;; nested presentations work in the REPL result. - (cond - ((null values) - '(:values ())) - (t - ;; Do the output ourselves. - (fresh-line) - (dolist (o values) - (presenting-object o *standard-output* - (prin1 o)) - (terpri)) - '(:suppress-output)))) + (let ((repl-results (connection.repl-results *emacs-connection*))) + (flet ((send (value) + (presenting-object value repl-results + (prin1 value repl-results)) + (terpri repl-results))) + (if (null values) + (progn + (princ "; No value" repl-results) + (terpri repl-results)) + (mapc #'send values))) + (finish-output repl-results))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From mkoeppe at common-lisp.net Sun Dec 31 12:29:08 2006 From: mkoeppe at common-lisp.net (mkoeppe) Date: Sun, 31 Dec 2006 07:29:08 -0500 (EST) Subject: [slime-cvs] CVS slime Message-ID: <20061231122908.2CFED72085@common-lisp.net> Update of /project/slime/cvsroot/slime In directory clnet:/tmp/cvs-serv1526 Modified Files: ChangeLog Log Message: *** empty log message *** --- /project/slime/cvsroot/slime/ChangeLog 2006/12/29 18:39:15 1.1032 +++ /project/slime/cvsroot/slime/ChangeLog 2006/12/31 12:29:07 1.1033 @@ -1,3 +1,17 @@ +2006-12-31 Matthias Koeppe + + Restore the nested-presentations feature. + + * present.lisp (slime-stream-p): Allow sending presentations to + the repl-results stream. + (make-presentations-result): Removed. + (send-repl-results-to-emacs): New. + + * swank.lisp (connection): New slot repl-results (a stream). + (make-output-function-for-target): New. + (open-streams): Use it here to also create a stream for REPL results. + (initialize-streams-for-connection): Store the stream. + 2006-12-29 Edi Weitz * slime.el (slime-find-asd, slime-read-system-name): Only offer