3.3 Implementation overview

flymake-proc-legacy-flymake saves a copy of the buffer in a temporary file in the buffer’s directory (or in the system temporary directory, for Java files), creates a syntax check command and launches a process with this command. The output is parsed using a list of error message patterns, and error information (file name, line number, type and text) is saved. After the process has finished, Flymake highlights erroneous lines in the buffer using the accumulated error information.

Syntax check is considered possible if there’s an entry in flymake-proc-allowed-file-name-masks matching buffer’s filename and its init-function returns non-nil value.

Two syntax check modes are distinguished:

  1. Buffer can be syntax checked in a standalone fashion, that is, the file (its temporary copy, in fact) can be passed over to the compiler to do the syntax check. Examples are C/C++ sources (.c, .cpp) and Java (.java).
  2. Buffer can be syntax checked, but additional file, called master file, is required to perform this operation. A master file is a file that includes the current file, so that running a syntax check tool on it will also check syntax in the current file. Examples are C/C++ headers (.h, .hpp).

These modes are handled inside init/cleanup/getfname functions, see Adding support for a new syntax check tool.

The Proc backend contains implementations of all functionality required to support different syntax check modes described above (making temporary copies, finding master files, etc.), as well as some tool-specific (routines for Make, Ant, etc.) code.