Function: shell-completion-vars

shell-completion-vars is a byte-compiled function defined in shell.el.gz.

Signature

(shell-completion-vars)

Documentation

Setup completion vars for shell-mode and read-shell-command.

Source Code

;; Defined in /usr/src/emacs/lisp/shell.el.gz
(defun shell-completion-vars ()
  "Setup completion vars for `shell-mode' and `read-shell-command'."
  (setq-local comint-completion-fignore
              shell-completion-fignore)
  (setq-local comint-delimiter-argument-list
              shell-delimiter-argument-list)
  (setq-local comint-file-name-chars shell-file-name-chars)
  (setq-local comint-file-name-quote-list
              shell-file-name-quote-list)
  (setq-local comint-file-name-prefix
              (or (file-remote-p default-directory) ""))
  (setq-local comint-dynamic-complete-functions
              shell-dynamic-complete-functions)
  (setq-local comint-unquote-function #'shell--unquote-argument)
  (setq-local comint-requote-function #'shell--requote-argument)
  (setq-local pcomplete-parse-arguments-function
              #'shell--parse-pcomplete-arguments)
  (setq-local pcomplete-termination-string
              (cond ((not comint-completion-addsuffix) "")
                    ((stringp comint-completion-addsuffix)
                     comint-completion-addsuffix)
                    ((not (consp comint-completion-addsuffix)) " ")
                    (t (cdr comint-completion-addsuffix))))
  (setq-local pcomplete-command-completion-function
              #'shell-command-completion-function)
  ;; Don't use pcomplete's defaulting mechanism, rely on
  ;; shell-dynamic-complete-functions instead.
  (setq-local pcomplete-default-completion-function #'ignore)
  (setq-local comint-input-autoexpand shell-input-autoexpand)
  ;; Not needed in shell-mode because it's inherited from comint-mode, but
  ;; placed here for read-shell-command.
  (add-hook 'completion-at-point-functions #'comint-completion-at-point nil t))