www.delorie.com/gnu/docs/calc/calc_345.html   search  
Buy the book!

GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] Error Handling

If calc-eval encounters an error, it returns a list containing the character position of the error, plus a suitable message as a string. Note that `1 / 0' is not an error by Calc's standards; it simply returns the string "1 / 0" which is the division left in symbolic form. But `(calc-eval "1/")' will return the list `(2 "Expected a number")'.

If you bind the variable calc-eval-error to t using a let form surrounding the call to calc-eval, errors instead call the Emacs error function which aborts to the Emacs command loop with a beep and an error message.

If you bind this variable to the symbol string, error messages are returned as strings instead of lists. The character position is ignored.

As a courtesy to other Lisp code which may be using Calc, be sure to bind calc-eval-error using let rather than changing it permanently with setq.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003