Function: eshell-structure-basic-command

eshell-structure-basic-command is a byte-compiled function defined in esh-cmd.el.gz.

This function is obsolete since 31.1.

Signature

(eshell-structure-basic-command FUNC NAMES KEYWORD TEST &rest BODY)

Documentation

With TERMS, KEYWORD, and two NAMES, structure a basic command.

The first of NAMES should be the positive form, and the second the negative. It's not likely that users should ever need to call this function.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defun eshell-structure-basic-command (func names keyword test &rest body)
  "With TERMS, KEYWORD, and two NAMES, structure a basic command.
The first of NAMES should be the positive form, and the second the
negative.  It's not likely that users should ever need to call this
function."
  (declare (obsolete nil "31.1"))
  (unless test
    (error "Missing test for `%s' command" keyword))

  ;; If the test form is a subcommand, wrap it in `eshell-commands' to
  ;; silence the output.
  (when (memq (car test) '(eshell-as-subcommand eshell-lisp-command))
    (setq test `(eshell-commands ,test t)))

  ;; If the test form begins with `eshell-convert' or
  ;; `eshell-escape-arg', it means something data-wise will be
  ;; returned, and we should let that determine the truth of the
  ;; statement.
  (unless (memq (car test) '(eshell-convert eshell-escape-arg))
    (setq test
	  `(progn (eshell-deferrable ,test)
                  (eshell-exit-success-p))))

  ;; should we reverse the sense of the test?  This depends
  ;; on the `names' parameter.  If it's the symbol nil, yes.
  ;; Otherwise, it can be a pair of strings; if the keyword
  ;; we're using matches the second member of that pair (a
  ;; list), we should reverse it.
  (if (or (eq names nil)
	  (and (listp names)
	       (string= keyword (cadr names))))
      (setq test `(not ,test)))

  ;; Finally, create the form that represents this structured command.
  `(,func ,test ,@body))