Function: eshell-trap-errors

eshell-trap-errors is a macro defined in esh-cmd.el.gz.

Signature

(eshell-trap-errors OBJECT)

Documentation

Trap any errors that occur, so they are not entirely fatal.

Also, the variable eshell-this-command-hook is available for the duration of OBJECT's evaluation. Note that functions should be added to this hook using nconc, and *not* add-hook.

Someday, when Scheme will become the dominant Emacs language, all of this grossness will be made to disappear by using call/cc...

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defmacro eshell-trap-errors (object)
  "Trap any errors that occur, so they are not entirely fatal.
Also, the variable `eshell-this-command-hook' is available for the
duration of OBJECT's evaluation.  Note that functions should be added
to this hook using `nconc', and *not* `add-hook'.

Someday, when Scheme will become the dominant Emacs language, all of
this grossness will be made to disappear by using `call/cc'..."
  `(let ((eshell-this-command-hook '(ignore)))
     (eshell-condition-case err
	 (prog1
	     ,object
	   (mapc #'funcall eshell-this-command-hook))
       (error
	(mapc #'funcall eshell-this-command-hook)
	(eshell-errorn (error-message-string err))
	(eshell-close-handles 1)))))