Re: Temporarily suppress all error messages

Leo Butler <[email protected]> Thu, 21 May 2026 16:27:34 +0000
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <[email protected]>
Hi,
Others have answered about the init file.

The :lisp shortcut only reads to the end of line, so you would need to
remove the newlines in that definition (this is not a problem, just
something to be aware of).

Alternatively,

to_lisp();

changes the reader to accept lisp input. So, you can do something like
this:

to_lisp();  /* <--- in Maxima */
(setf ...)
(defun mtell ...
  ...)
(to-maxima) ;; <--- return to Maxima, from Lisp

Leo

On Wed, May 20 2026, Astrea Drifter <[email protected]> wrote:

> Leo,
> I don't seem to have a maxima-init.lisp file. If I'm meant to create one,
> where should I put it?
> Alternatively, could this be entered into the terminal? This looks like a
> single command, just a longer one, which makes me wonder if it could be
> made to work there by putting :lisp before (defun and maybe condensing it
> to a single line.
>
> Astrea
>
> On Wed, May 20, 2026 at 8:25 AM Leo Butler <[email protected]> wrote:
>
>> Hello,
>>
>> You can also add this to your maxima-init.lisp file:
>>
>>  (defun mtell (&rest l)
>>   (let ((*print-base* 10))
>>    (apply #'mformat *error-output* l)))
>>
>> This will direct all MTELL output to *ERROR-OUTPUT* rather than
>> *STANDARD-OUTPUT*. Combined with re-binding *ERROR-OUTPUT*, this should
>> muffle >95% of the messages you might see otherwise.
>>
>> The (dis)advantage of this suggestion is that error messages are stored
>> in an output stream, so you can inspect them via:
>>
>> get_output_stream_string (?\*error\-output\*);
>>
>> from the Maxima command line.
>>
>> Best regards,
>> Leo
>>
>>
>> On Tue, May 19 2026, Astrea Drifter <[email protected]> wrote:
>>
>> > Leo,
>> > I am indeed using the most recent version of Maxima (5.49) and I do the
>> > terminal most of the time. (If I ever use anything else, it's XMaxima).
>> So
>> > the Lisp command you mentioned is workable for me!
>> >
>> > Michel,
>> > I tried out your version of the command, and it seems to do well in
>> > suppressing the "not enough parentheses", "too many parentheses", and
>> > "expected n arguments but got k" sorts of messages, and these are the
>> ones
>> > which I get very often and which I was having trouble suppressing. Not
>> only
>> > that, but the command also interacts with my syntax (which involves the
>> > double-quotes and the user-defined nofix "~" along with a whole bunch of
>> > stuff in my preamble) in a way that causes it to print output lines with
>> > empty brackets on them, which is exactly what I was hoping for it to do
>> in
>> > these cases!
>> >
>> > So this command seems like the perfect help for my use case, and I've
>> > included it in my preamble. I might post again if I encounter any issues
>> > with it that I can't fix, but as near as I can tell it seems like it will
>> > work nicely.
>> >
>> > Thank you all so much for your help!
>> > Astrea
>> >
>> > On Tue, May 19, 2026 at 9:39 AM Leo Butler <[email protected]>
>> wrote:
>> >
>> >> If you are using a recent version of maxima, you can do the following at
>> >> the terminal:
>> >>
>> >> :lisp(setf *error-output* (make-output-string-stream))
>> >>
>> >> Alternatively, you can save the line
>> >>
>> >> (setf *error-output* (make-output-string-stream))
>> >>
>> >> in a start-up file (e.g. maxima-init.lisp) and make sure it gets loaded
>> >> at start-up.
>> >>
>> >> Explanation: in recent versions of Maxima, errors and warnings are
>> >> printed to the output stream *ERROR-OUTPUT*. That can be rebound to a
>> >> "string stream", which results in the diversion of the error messages to
>> >> a sink.
>> >>
>> >> Best regards,
>> >> Leo
>> >>
>> >>
>> >> On Tue, May 19 2026, Michel Talon <[email protected]> wrote:
>> >>
>> >> > Le 19/05/2026 à 04:52, Astrea Drifter a écrit :
>> >> >>
>> >> >> While searching for solutions, I found a thread where the following
>> >> >> commands were recommended to turn off error and warning messages
>> >> >> respectively, and these seemed well suited for the use case of that
>> >> >> thread's op:
>> >> >> :lisp (defun merror(&rest foo) nil)
>> >> >> :lisp (defun mtell (&rest foo) nil)
>> >> >>
>> >> >> Unfortunately, while I have some experience with Maxima, I know
>> >> >> nothing at all about Lisp.
>> >> >
>> >> > A little pedagogy: a lot of errors in maxima trigger the function
>> >> > merror, which outputs the appropriate error message. In lisp you can
>> >> > redefine any function, so when doing  (defun merror(&rest foo) nil)
>> >> > you are just redefining merror to produce nil, for whatever arguments
>> >> > you feed merror with (&rest foo). Idem for mtell which is triggered by
>> >> > less severe problems. But this does not work for your use case because
>> >> > the error is produced at the level of the parser (nparse.lisp) in
>> >> > which errors do not call merror or mtell, but just use the lisp
>> >> > function format to output a message.
>> >> >
>> >> > (format t (intl:gettext "incorrect syntax: "))  line 122 of
>> nparse.lisp
>> >> >
>> >> > followed by some more complex stuff to output the cause of the error,
>> >> > here ~ is not an infix operator ...
>> >> >
>> >> > Since you probably don't want to redefine lisp functions, i don't see
>> >> > how to mute this error message.
>> >>
>> >> --
>> >> ---
>> >> Best regards,
>> >> Dr Butler
>> >> _______________________________________________
>> >> Maxima-discuss mailing list
>> >> [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>> >>
>>
>> --
>> ---
>> Best regards,
>> Dr Butler

-- 
---
Best regards,
Dr Butler
_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss