Function: semantic-safe

semantic-safe is a macro defined in fw.el.gz.

Signature

(semantic-safe FORMAT &rest BODY)

Documentation

Turn into a FORMAT message any error caught during eval of BODY.

Return the value of last BODY form or nil if an error occurred. FORMAT can have a %s escape which will be replaced with the actual error message. If debug-on-error is set, errors are not caught, so that you can debug them. Avoid using a large BODY since it is duplicated.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/fw.el.gz
;;; Help debugging
;;
(defmacro semantic-safe (format &rest body)
  "Turn into a FORMAT message any error caught during eval of BODY.
Return the value of last BODY form or nil if an error occurred.
FORMAT can have a %s escape which will be replaced with the actual
error message.
If `debug-on-error' is set, errors are not caught, so that you can
debug them.
Avoid using a large BODY since it is duplicated."
  (declare (debug t) (indent 1))
  `(if debug-on-error
       ;;(let ((inhibit-quit nil)) ,@body)
       ;; Note to self: Doing the above screws up the wisent parser.
       (progn ,@body)
     (condition-case err
	 (progn ,@body)
       (error
        (message ,format (format "%S - %s" (current-buffer)
                                 (error-message-string err)))
        nil))))