Subject: Re: minor stuff with CMU Lisp
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 14 Oct 2006 21:15:26 -0500
Newsgroups: comp.lang.lisp
Message-ID: <lMadnX_crq8jBKzYnZ2dnUVZ_oOdnZ2d@speakeasy.net>
Mark Tarver <dr.mtarver@ukonline.co.uk> wrote:
+---------------
| I'm experimenting with CMU Lisp...
| 1.  Error messages are printed but with the accompanying
|      'Error in function ...." tagged to them; giving the
|      function in which the error was raised.   Actually I
|      don't want this - is there any way to turn this feature off?
+---------------

Why? Don't you want to know where the error occurred?  ;-}

Anyway, if you are not "debugging" per se but just noodling around
in the REPL and don't want to drop into the debugger every time
you typo or violate a function signature, you might like something
like the following [not specific to CMUCL, actually]:

    > (defun my-debugger-hook (c hook)
	(declare (ignore hook))
	(when (find-restart 'abort c)
	  (princ c)
	  (abort c)))

    MY-DEBUGGER-HOOK
    > (setf *debugger-hook* 'my-debugger-hook)

    MY-DEBUGGER-HOOK
    > (/ 1 0)
    Arithmetic error DIVISION-BY-ZERO signalled.
    Operation was KERNEL::DIVISION, operands (1 0).
    > (length 34)
    Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
	    34 is not of type SEQUENCE
    > (length 12 34)
    Invalid number of arguments: 2
    > (mapcar '1+ '(12 34 foo 56))
    Argument X is not a NUMBER: FOO.
    > 

And you can always undo it temporarily if you *do* want the full
debugger functionality for a specific expression evaluation:

    > (let ((*debugger-hook* nil))
	(mapcar '1+ '(12 34 foo 56)))

    Argument X is not a NUMBER: FOO.
       [Condition of type SIMPLE-TYPE-ERROR]

    Restarts:
      0: [ABORT] Return to Top-Level.

    Debug  (type H for help)

    (KERNEL:TWO-ARG-+ FOO 1)
    Source: Error finding source: 
    Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer exists:
      target:code/numbers.lisp.
    0] 

+---------------
| 2.  Compiler messages. CMU likes to chat and I'm trying to still it.
+---------------

Again, one wonders why. One of the major *advantages* of CMUCL is
its extremely-helpful compiler notes.

+---------------
| I have
|      *COMPILE-VERBOSE*
|      *COMPILE-PRINT*
|      *GC-VERBOSE*
| set to NIL.  However I'm still getting some chat, is there a
| setting I've missed?
+---------------

Are you sure you're getting "chat" and not just the *values*
from the COMPILE-FILE? E.g., this may look like "chat":

    > (compile-file "foo" :print nil :verbose nil)

    #P"/u/rpw3/foo.x86f"
    NIL
    NIL
    >

but it's really just the values from COMPILE-FILE. If you throw
them away, you get nothing:

    > (progn (compile-file "foo-hash" :print nil :verbose nil) 34)

    34
    > 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607