Next: Example---Configuring a tool called via make, Up: Adding support for a new syntax check tool [Contents][Index]
In this example, we will add support for perl as a syntax check
tool. perl supports the -c option which does syntax
checking.
First, we write the init-function:
(defun flymake-perl-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "perl" (list "-wc " local-file))))
flymake-perl-init creates a temporary copy of the buffer
contents with the help of
flymake-init-create-temp-buffer-copy, and builds an appropriate
command line.
Next, we add a new entry to the
flymake-allowed-file-name-masks:
(setq flymake-allowed-file-name-masks
(cons '(".+\\.pl$"
flymake-perl-init
flymake-simple-cleanup
flymake-get-real-file-name)
flymake-allowed-file-name-masks))
Note that we use standard cleanup-function and
getfname-function.
Finally, we add an entry to flymake-err-line-patterns:
(setq flymake-err-line-patterns
(cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]"
2 3 nil 1)
flymake-err-line-patterns))