This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

How to turn off warnings in Lisp?

3 posts · 1463 views

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:
(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?

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:
#+:build (html-extract)
to either:
#+:build (handler-bind ((warning #'muffle-warning)) (html-extract))
which will suppress warning only, or
#+:build (let ((*error-output* (make-broadcast-stream))) (html-extract))
which will suppress all error output.

Re: How to turn off warnings in Lisp?

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