Function: eshell-complete--eval-argument-form

eshell-complete--eval-argument-form is a byte-compiled function defined in em-cmpl.el.gz.

Signature

(eshell-complete--eval-argument-form ARG)

Documentation

Evaluate a single Eshell argument form ARG for the purposes of completion.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-cmpl.el.gz
(defun eshell-complete--eval-argument-form (arg)
  "Evaluate a single Eshell argument form ARG for the purposes of completion."
  (condition-case err
      (let* (;; Don't allow running commands; they could have
             ;; arbitrary side effects, which we don't want when we're
             ;; just performing completions!
             (eshell-allow-commands)
             ;; Handle errors ourselves so that we can properly catch
             ;; `eshell-commands-forbidden'.
             (eshell-handle-errors)
             (result (eshell-do-eval `(eshell-commands ,arg) t)))
        (cl-assert (eq (car result) 'quote))
        (cadr result))
    (eshell-commands-forbidden
     (propertize "\0" 'eshell-argument-stub
                 (intern (format "%s-command" (cadr err)))))
    (error
     (lwarn 'eshell :error
            "Failed to evaluate argument form during completion: %S" arg)
     (propertize "\0" 'eshell-argument-stub 'error))))