Function: sh-add-completer
sh-add-completer is a byte-compiled function defined in
sh-script.el.gz.
Signature
(sh-add-completer STRING PREDICATE CODE)
Documentation
Do completion using sh-shell-variables, but initialize it first.
This function is designed for use as the "completion table",
so it takes three arguments:
STRING, the current buffer contents;
PREDICATE, the predicate for filtering possible matches;
CODE, which says what kind of things to do.
CODE can be nil, t or lambda.
nil means to return the best completion of STRING, or nil if there is none.
t means to return a list of all possible completions of STRING.
lambda means to return t if STRING is a valid completion as it stands.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
(defun sh-add-completer (string predicate code)
"Do completion using `sh-shell-variables', but initialize it first.
This function is designed for use as the \"completion table\",
so it takes three arguments:
STRING, the current buffer contents;
PREDICATE, the predicate for filtering possible matches;
CODE, which says what kind of things to do.
CODE can be nil, t or `lambda'.
nil means to return the best completion of STRING, or nil if there is none.
t means to return a list of all possible completions of STRING.
`lambda' means to return t if STRING is a valid completion as it stands."
(let ((vars
(with-current-buffer sh-add-buffer
(or sh-shell-variables-initialized
(sh-shell-initialize-variables))
(nconc (mapcar (lambda (var)
(substring var 0 (string-search "=" var)))
process-environment)
sh-shell-variables))))
(complete-with-action code vars string predicate)))