Function: define-compilation-mode
define-compilation-mode is a macro defined in compile.el.gz.
Signature
(define-compilation-mode MODE NAME DOC &rest BODY)
Documentation
This is like define-derived-mode without the PARENT argument.
The parent is always compilation-mode and the customizable compilation-...
variables are also set from the name of the mode you have chosen,
by replacing the first word, e.g., compilation-scroll-output from
grep-scroll-output if that variable exists.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defmacro define-compilation-mode (mode name doc &rest body)
"This is like `define-derived-mode' without the PARENT argument.
The parent is always `compilation-mode' and the customizable `compilation-...'
variables are also set from the name of the mode you have chosen,
by replacing the first word, e.g., `compilation-scroll-output' from
`grep-scroll-output' if that variable exists."
(declare (indent defun))
(let ((mode-name (replace-regexp-in-string "-mode\\'" "" (symbol-name mode))))
`(define-derived-mode ,mode compilation-mode ,name
,doc
,@(mapcar (lambda (v)
(setq v (cons v
(intern-soft (replace-regexp-in-string
"^compilation" mode-name
(symbol-name v)))))
(and (cdr v)
(or (boundp (cdr v))
;; FIXME: This is hackish, using undocumented info.
(if (boundp 'byte-compile-bound-variables)
(memq (cdr v) byte-compile-bound-variables)))
`(set (make-local-variable ',(car v)) ,(cdr v))))
'(compilation-directory-matcher
compilation-error
compilation-error-regexp-alist
compilation-error-regexp-alist-alist
compilation-error-screen-columns
compilation-finish-functions
compilation-first-column
compilation-mode-font-lock-keywords
compilation-page-delimiter
compilation-parse-errors-filename-function
compilation-process-setup-function
compilation-scroll-output
compilation-search-path
compilation-skip-threshold
compilation-window-height))
,@body)))