Function: sh--cmd-completion-table

sh--cmd-completion-table is a byte-compiled function defined in sh-script.el.gz.

Signature

(sh--cmd-completion-table STRING PRED ACTION)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
;; (defun sh--var-completion-table (string pred action)
;;   (complete-with-action action (sh--vars-before-point) string pred))

(defun sh--cmd-completion-table (string pred action)
  (let ((cmds
         (append (when (fboundp 'imenu--make-index-alist)
                   (mapcar #'car
                           (condition-case nil
                               (imenu--make-index-alist)
                             (imenu-unavailable nil))))
                 (mapcar (lambda (v) (concat v "="))
                         (sh--vars-before-point))
                 (locate-file-completion-table
                  exec-path exec-suffixes string pred t)
                 sh--completion-keywords)))
    (complete-with-action action cmds string pred)))