Function: shell-highlight-undef-matcher

shell-highlight-undef-matcher is a byte-compiled function defined in shell.el.gz.

Signature

(shell-highlight-undef-matcher END)

Documentation

Matcher used to highlight shell commands up to END.

Source Code

;; Defined in /usr/src/emacs/lisp/shell.el.gz
(defun shell-highlight-undef-matcher (end)
  "Matcher used to highlight shell commands up to END."
  (when (re-search-forward shell-highlight-undef-regexp end t)
    (save-match-data
      (let ((cmd (match-string 6))
            (beg (match-beginning 6)))
        (setq shell--highlight-undef-face
              (let* ((buf (buffer-base-buffer))
                     (default-directory
                      (if buf (buffer-local-value 'default-directory buf)
                        default-directory)))
                (cond
                 ;; Don't fontify command output.  Mostly useful if
                 ;; `comint-fontify-input-mode' is disabled.
                 ((text-property-any beg (point) 'field 'output)
                  nil)
                 ((member cmd shell-highlight-undef-aliases)
                  'shell-highlight-undef-alias-face)
                 ;; Check if it contains a directory separator
                 ((file-name-directory cmd)
                  (when (file-name-absolute-p cmd)
                    (setq cmd (concat
                               (or (bound-and-true-p comint-file-name-prefix)
                                   (file-remote-p default-directory))
                               cmd)))
                  (if (or (file-executable-p cmd)
                          (file-directory-p cmd))
                      'shell-highlight-undef-defined-face
                    'shell-highlight-undef-undefined-face))
                 ((shell--highlight-undef-executable-find cmd)
                  'shell-highlight-undef-defined-face)
                 (t 'shell-highlight-undef-undefined-face))))))
    t))