Function: eshell-do-command

eshell-do-command is a macro defined in esh-cmd.el.gz.

Signature

(eshell-do-command 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...

Aliases

eshell-trap-errors (obsolete since 31.1)

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defmacro eshell-do-command (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'..."
  `(eshell-condition-case err
       (let ((eshell-this-command-hook '(ignore)))
         (unwind-protect
             (eshell-deferrable ,object)
           (mapc #'funcall eshell-this-command-hook)))
     (error
      (eshell-errorn (error-message-string err))
      (eshell-set-exit-info 1))))