I notice, occasionally, that slime prints arglists as:
(some-func #'foo &rest body)
This is due to the pretty-printing of the arglist, it should be:
(some-func (function foo) &rest body)
I'd propose the following change, unless it's likely to have unwanted other effects. (This patch also fixes a typo in EVAL-IN-EMACS).
Index: ChangeLog =================================================================== RCS file: /project/slime/cvsroot/slime/ChangeLog,v retrieving revision 1.261 diff -u -r1.261 ChangeLog --- ChangeLog 21 Feb 2004 16:45:25 -0000 1.261 +++ ChangeLog 22 Feb 2004 23:54:46 -0000 @@ -1,3 +1,8 @@ +2004-02-22 Lawrence Mitchell wence@gmx.li + + * swank.lisp (format-arglist): Bind *PRINT-PRETTY* to NIL. + (eval-in-emacs): Fix typo in docstring. + 2004-02-21 Helmut Eller e9626484@stud3.tuwien.ac.at
Add support for SERVE-EVENT based communication.
Index: swank.lisp =================================================================== RCS file: /project/slime/cvsroot/slime/swank.lisp,v retrieving revision 1.123 diff -u -r1.123 swank.lisp --- swank.lisp 21 Feb 2004 16:37:27 -0000 1.123 +++ swank.lisp 22 Feb 2004 23:47:25 -0000 @@ -691,7 +691,8 @@ (let ((symbol (find-symbol-or-lose function-name))) (values (funcall lambda-list-fn symbol)))) (cond (condition (format nil "(-- ~A)" condition)) - (t (let ((*print-case* :downcase)) + (t (let ((*print-case* :downcase) + (*print-pretty* nil)) (format nil "(~{~A~^ ~})" arglist))))))
@@ -795,7 +796,7 @@ ;;;; Evaluation
(defun eval-in-emacs (form) - "Execute FROM in Emacs." + "Execute FORM in Emacs." (destructuring-bind (fn &rest args) form (send-to-emacs `(:%apply ,(string-downcase (string fn)) ,args))))
lawrence mitchell wence@gmx.li writes:
I'd propose the following change, unless it's likely to have unwanted other effects. (This patch also fixes a typo in EVAL-IN-EMACS).
Thanks for the patch. It's in CVS.
Helmut.
Lunedì, 23 feb 2004, alle 00:57 Europe/Rome, lawrence mitchell ha scritto:
I'd propose the following change, unless it's likely to have unwanted other effects.
Anything against binding it to *swank-pprint-pretty* ?
-- Marco Ring the bells that still can ring. Forget the perfect offering. There is a crack in everything. That's how the light gets in. -Leonard Cohen
Marco Baringer wrote:
Me:
I'd propose the following change, unless it's likely to have unwanted other effects.
Anything against binding it to *swank-pprint-pretty* ?
Not really. The only problem I see with this is that one would presumably also add this binding to SWANK-PPRINT. Which may well have unwanted side-effects elsewhere, in that, in order to have non-pprinted arglists, one also has to have non-pprinted results from PPRINT-EVAL. If, however, you weren't intending this, then I see no reason why one couldn't change things.
Lunedì, 23 feb 2004, alle 11:18 Europe/Rome, lawrence mitchell ha scritto:
Not really. The only problem I see with this is that one would presumably also add this binding to SWANK-PPRINT. Which may well have unwanted side-effects elsewhere, in that, in order to have non-pprinted arglists, one also has to have non-pprinted results from PPRINT-EVAL. If, however, you weren't intending this, then I see no reason why one couldn't change things.
i think swank-pprint should bind print-pretty to t, no matter what the value of *swank-pprint-pretty* is (it's called pprint after all).
i think it woud be quite fair to say that all slime output is controlled by one set of variables, if you want functions args to not be pprint'd it's reasonable to assume you wouldn't want anything else to be pprint'd either.
-- Marco Ring the bells that still can ring. Forget the perfect offering. There is a crack in everything. That's how the light gets in. -Leonard Cohen
Marco Baringer mb@bese.it writes:
i think swank-pprint should bind print-pretty to t, no matter what the value of *swank-pprint-pretty* is (it's called pprint after all).
I agree, *PRINT-PRETTY* should always be T in swank-pprint. But was is the meaning of *swank-pprint-pretty* then? Similar to *sldb-pprint-frames*?
i think it woud be quite fair to say that all slime output is controlled by one set of variables, if you want functions args to not be pprint'd it's reasonable to assume you wouldn't want anything else to be pprint'd either.
I think it is a nice feature when different commands can use different printer settings, e.g., setting *PRINT-PRETTY* to nil for bulk output (for efficiency) and to T for macro expansion commands sounds perfectly reasonable to me.
The come back to the arglist. When *PRINT-PRETTY* is t the arglist for
(defun foo (&optional (function #'identity)) ...)
is printed as
(foo &optional #'#'identity)
Not pretty :-) When *PRINT-PRETTY* is nil the result is
(foo &optional (function (function identity)))
Not perfect, but a bit better IMO.
Another issue are very long argument lists, e.g., for WRITE. With *PRINT-PRETTY* t the result is printed in multiple lines, which looks nicer in Emacs 21.
Could *print-pprint-dispatch* be used to suppress the conversion of (function ...) --> #'... ?
Helmut.