Function: compilation-setup
compilation-setup is a byte-compiled function defined in
compile.el.gz.
Signature
(compilation-setup &optional MINOR)
Documentation
Prepare the buffer for the compilation parsing commands to work.
Optional argument MINOR indicates this is called from
compilation-minor-mode(var)/compilation-minor-mode(fun).
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defun compilation-setup (&optional minor)
"Prepare the buffer for the compilation parsing commands to work.
Optional argument MINOR indicates this is called from
`compilation-minor-mode'."
(make-local-variable 'compilation-current-error)
(make-local-variable 'compilation-messages-start)
(make-local-variable 'compilation-error-screen-columns)
(make-local-variable 'overlay-arrow-position)
(setq-local compilation-num-errors-found 0)
(setq-local compilation-num-warnings-found 0)
(setq-local compilation-num-infos-found 0)
(setq-local overlay-arrow-string "")
(setq next-error-overlay-arrow-position nil)
(add-hook 'kill-buffer-hook
(lambda () (setq next-error-overlay-arrow-position nil)) nil t)
;; Note that compilation-next-error-function is for interfacing
;; with the next-error function in simple.el, and it's only
;; coincidentally named similarly to compilation-next-error.
(setq next-error-function 'compilation-next-error-function)
(setq-local comint-file-name-prefix
(or (file-remote-p default-directory) ""))
(setq-local compilation-locs
(make-hash-table :test 'equal :weakness 'value))
;; It's generally preferable to use after-change-functions since they
;; can be subject to combine-after-change-calls, but if we do that, we risk
;; running our hook after font-lock, resulting in incorrect refontification.
(add-hook 'before-change-functions #'compilation--flush-parse nil t)
;; Also for minor mode, since it's not permanent-local.
(add-hook 'change-major-mode-hook #'compilation--remove-properties nil t)
(if minor
(progn
(font-lock-add-keywords nil (compilation-mode-font-lock-keywords))
(font-lock-flush))
(setq font-lock-defaults '(compilation-mode-font-lock-keywords t))))