Function: eshell-complete-variable-assignment

eshell-complete-variable-assignment is a byte-compiled function defined in esh-var.el.gz.

Signature

(eshell-complete-variable-assignment)

Documentation

If there is a variable assignment, allow completion of entries.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-var.el.gz
(defun eshell-complete-variable-assignment ()
  "If there is a variable assignment, allow completion of entries."
  (catch 'not-assignment
    ;; The current argument can only be a variable assignment if all
    ;; arguments leading up to it are also variable assignments.  See
    ;; `eshell-handle-local-variables'.
    (dotimes (offset (1+ pcomplete-index))
      (unless (string-match (concat "\\`" eshell-variable-name-regexp "=")
                            (pcomplete-actual-arg 'first offset))
        (throw 'not-assignment nil)))
    ;; We have a variable assignment.  Handle it.
    (let ((arg (pcomplete-actual-arg))
          (pos (match-end 0)))
      (when (string-match "\\(:\\)[^:]*\\'" arg)
	(setq pos (match-end 1)))
      (setq pcomplete-stub (substring arg pos))
      (throw 'pcomplete-completions (pcomplete-entries)))))