Page 1 of 1

How to turn off warnings in Lisp?

Posted: Wed Nov 23, 2011 5:16 pm
by luckytobehere
Hello all,

I got this HTML-extract code (open source) from http://weitz.de/html-extract/

I don't know anything about Lisp, I have a deadline and I don't have time to learn it now...

The problem is that when running the executable it displays warnings... "WARNING EOF after '&'" for example.
I want to turn off the warnings.. one possibility is to just remove the lines that print warnings... but as I don't know Lisp I don't want to break the code. Another possibility.. hoping to find some help... is there any command/function in Lisp that will turn off all the warnings without having to manually remove the lines of code?

The code looks something like this:

Code: Select all

(peek-cond (peek-char)
      ((char= peek-char #\&)
       (read-char)
       (peek-cond (peek-char (warn "EOF after '&'")
                             (write-char #\&))
         ((char= peek-char #\#)
          ;; probably a character reference
          (read-char)
          (peek-cond (peek-char (warn "EOF after '&#'")
                                (write-string "&#"))
You can see the warnings... this is just a snippet...

Thank you in advance,
Oana.

Re: How to turn off warnings in Lisp?

Posted: Thu Nov 24, 2011 12:47 am
by ramarren
The warnings indicate that the HTML input is malformed and so the program may not work reliably. If you really want to suppress warning then change the final line of html-extract.lisp (and then rebuild) from:

Code: Select all

#+:build (html-extract)
to either:

Code: Select all

#+:build (handler-bind ((warning #'muffle-warning)) (html-extract))
which will suppress warning only, or

Code: Select all

#+:build (let ((*error-output* (make-broadcast-stream))) (html-extract))
which will suppress all error output.

Re: How to turn off warnings in Lisp?

Posted: Thu Nov 24, 2011 3:20 am
by luckytobehere
Hi Ramarren,

Great!
Yes, I know about the purpose of warnings... I do not really care if the HTML is parsed correctly.
But I'll still leave the errors on...

Thanks alot,
Oana