Function: compilation-filter
compilation-filter is a byte-compiled function defined in
compile.el.gz.
Signature
(compilation-filter PROC STRING)
Documentation
Process filter for compilation buffers.
Just inserts the text, handles carriage motion (see
comint-inhibit-carriage-motion), compilation-hidden-output,
and runs compilation-filter-hook.
Probably introduced at or before Emacs version 24.1.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defun compilation-filter (proc string)
"Process filter for compilation buffers.
Just inserts the text, handles carriage motion (see
`comint-inhibit-carriage-motion'), `compilation-hidden-output',
and runs `compilation-filter-hook'."
(when (buffer-live-p (process-buffer proc))
(with-current-buffer (process-buffer proc)
(let ((inhibit-read-only t)
;; `save-excursion' doesn't use the right insertion-type for us.
(pos (copy-marker (point) t))
;; `save-restriction' doesn't use the right insertion type either:
;; If we are inserting at the end of the accessible part of the
;; buffer, keep the inserted text visible.
(min (point-min-marker))
(max (copy-marker (point-max) t))
(compilation-filter-start (marker-position (process-mark proc))))
(unwind-protect
(progn
(widen)
(goto-char compilation-filter-start)
;; We used to use `insert-before-markers', so that windows with
;; point at `process-mark' scroll along with the output, but we
;; now use window-point-insertion-type instead.
(if (not compilation-max-output-line-length)
(insert string)
(dolist (line (string-lines string nil t))
(compilation--insert-abbreviated-line
line compilation-max-output-line-length)))
(when compilation-hidden-output
(compilation--hide-output compilation-filter-start))
(unless comint-inhibit-carriage-motion
(comint-carriage-motion (process-mark proc) (point)))
(set-marker (process-mark proc) (point))
;; Update the number of errors in compilation-mode-line-errors
(compilation--ensure-parse (point))
(run-hooks 'compilation-filter-hook))
(goto-char pos)
(narrow-to-region min max)
(set-marker pos nil)
(set-marker min nil)
(set-marker max nil))))))