Function: compilation--parse-region

compilation--parse-region is a byte-compiled function defined in compile.el.gz.

Signature

(compilation--parse-region START END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defun compilation--parse-region (start end)
  (goto-char end)
  (unless (bolp)
    ;; We generally don't like to parse partial lines.
    (cl-assert (eobp))
    (when (let ((proc (get-buffer-process (current-buffer))))
            (and proc (memq (process-status proc) '(run open))))
      (setq end (line-beginning-position))))
  (compilation--remove-properties start end)
  ;; compilation-directory-matcher is the only part that really needs to be
  ;; parsed sequentially.  So we could split it out, handle directories
  ;; like syntax-propertize, and the rest as font-lock-keywords.  But since
  ;; we want to have it work even when font-lock is off, we'd then need to
  ;; use our own compilation-parsed text-property to keep track of the parts
  ;; that have already been parsed.
  (goto-char start)
  (while (re-search-forward (car compilation-directory-matcher)
                            end t)
    (compilation--flush-directory-cache (match-beginning 0) (match-end 0))
    (when compilation-debug
      (font-lock-append-text-property
       (match-beginning 0) (match-end 0)
       'compilation-debug
       (vector 'directory compilation-directory-matcher)))
    (dolist (elt (cdr compilation-directory-matcher))
      (add-text-properties (match-beginning (car elt))
                           (match-end (car elt))
                           (compilation-directory-properties
                            (car elt) (cdr elt)))))

  (compilation-parse-errors start end))