annotate man/flymake.texi @ 64187:e9504f39348e

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Jul 2005 04:00:06 +0000
parents 4133ed695908
children 3723093a21fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
1 \input texinfo @c -*-texinfo-*-
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
2 @comment %**start of header
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
3 @setfilename ../info/flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
4 @set VERSION 0.3
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
5 @set UPDATED April 2004
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
6 @settitle GNU Flymake @value{VERSION}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
7 @syncodeindex pg cp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
8 @comment %**end of header
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
9
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
10 @copying
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
11 This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}),
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
12 which is a universal on-the-fly syntax checker for GNU Emacs.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
13
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
14 Copyright @copyright{} 2004 Free Software Foundation, Inc.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
15
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
16 @quotation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
17 Permission is granted to copy, distribute and/or modify this document
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
18 under the terms of the GNU Free Documentation License, Version 1.1 or
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
19 any later version published by the Free Software Foundation; with no
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
20 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
21 and with the Back-Cover Texts as in (a) below. A copy of the license
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
22 is included in the section entitled ``GNU Free Documentation License''
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
23 in the Emacs manual.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
24
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
25 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
26 this GNU Manual, like GNU software. Copies published by the Free
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
27 Software Foundation raise funds for GNU development.''
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
28
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
29 This document is part of a collection distributed under the GNU Free
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
30 Documentation License. If you want to distribute this document
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
31 separately from the collection, you can do so by adding a copy of the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
32 license to the document, as described in section 6 of the license.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
33 @end quotation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
34 @end copying
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
35
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
36 @dircategory Emacs
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
37 @direntry
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
38 * Flymake: (flymake). A universal on-the-fly syntax checker.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
39 @end direntry
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
40
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
41 @titlepage
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
42 @title GNU Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
43 @subtitle for version @value{VERSION}, @value{UPDATED}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
44 @author Pavel Kobiakov(@email{pk_at_work@@yahoo.com})
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
45 @page
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
46 @vskip 0pt plus 1filll
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
47 @end titlepage
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
48
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
49 @contents
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
50
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
51 @ifnottex
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
52 @node Top
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
53 @top GNU Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
54 @end ifnottex
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
55
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
56 @menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
57 * Overview of Flymake::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
58 * Obtaining Flymake::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
59 * Installing Flymake::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
60 * Using Flymake::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
61 * Configuring Flymake::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
62 * Flymake Implementation::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
63 * Index::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
64 @end menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
65
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
66 @node Overview of Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
67 @chapter Overview
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
68 @cindex Overview of Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
69
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
70 Flymake is a universal on-the-fly syntax checker implemented as an
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
71 Emacs minor mode. Flymake runs the pre-configured syntax check tool
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
72 (compiler for C++ files, @code{perl} for perl files, etc.) in the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
73 background, passing it a temporary copy of the current buffer, and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
74 parses the output for known error/warning message patterns. Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
75 then highlights erroneous lines (i.e. lines for which at least one
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
76 error or warning has been reported by the syntax check tool), and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
77 displays an overall buffer status in the mode line. Status information
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
78 displayed by Flymake contains total number of errors and warnings
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
79 reported for the buffer during the last syntax check.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
80
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
81 @code{flymake-goto-next-error} and @code{flymake-goto-prev-error}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
82 functions allow for easy navigation to the next/previous erroneous
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
83 line, respectively.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
84
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
85 Calling @code{flymake-display-err-menu-for-current-line} will popup a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
86 menu containing error messages reported by the syntax check tool for
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
87 the current line. Errors/warnings belonging to another file, such as a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
88 @code{.h} header file included by a @code{.c} file, are shown in the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
89 current buffer as belonging to the first line. Menu items for such
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
90 messages also contain a filename and a line number. Selecting such a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
91 menu item will automatically open the file and jump to the line with
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
92 error.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
93
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
94 Syntax check is done 'on-the-fly'. It is started whenever
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
95
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
96 @itemize @bullet
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
97 @item buffer is loaded
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
98 @item a newline character is added to the buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
99 @item some changes were made to the buffer more than @code{0.5} seconds ago (the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
100 delay is configurable).
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
101 @end itemize
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
102
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
103 Flymake is a universal syntax checker in the sense that it's easily
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
104 extended to support new syntax check tools and error message
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
105 patterns. @xref{Configuring Flymake}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
106
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
107 @node Obtaining Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
108 @chapter Obtaining Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
109 @cindex Getting Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
110
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
111 Release versions of Flymake can be downloaded from
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
112 @* @url{https://sourceforge.net/project/showfiles.php?group_id=77501}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
113 You can also try current version available via CVS at @url{https://}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
114
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
115 Flymake's homepage is at @url{http://flymake.sourceforge.net}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
116
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
117 @node Installing Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
118 @chapter Installing
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
119 @cindex Installing Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
120
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
121
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
122 Flymake is packaged in a single file, @code{flymake.el}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
123
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
124 To install/update Flymake, place @code{flymake.el} to a directory
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
125 somewhere on Emacs load path. You might also want to byte-compile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
126 @code{flymake.el} to improve performance.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
127
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
128 Also, place the following line in the @code{.emacs} file.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
129
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
130 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
131 (require 'flymake)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
132 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
133
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
134 You might also map the most frequently used Flymake functions, such as
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
135 @code{flymake-goto-next-error}, to some keyboard shortcuts:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
136
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
137 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
138 (global-set-key [f3] 'flymake-display-err-menu-for-current-line)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
139 (global-set-key [f4] 'flymake-goto-next-error)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
140 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
141
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
142 @node Using Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
143 @chapter Using Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
144 @cindex Using Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
145
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
146 @menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
147 * Flymake mode::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
148 * Running the syntax check::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
149 * Navigating to error lines::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
150 * Viewing error messages::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
151 * Syntax check statuses::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
152 * Troubleshooting::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
153 @end menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
154
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
155 @node Flymake mode
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
156 @section Flymake mode
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
157 @cindex flymake-mode
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
158
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
159 Flymake is an Emacs minor mode. To use Flymake, you
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
160 must first activate @code{flymake-mode} by using the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
161 @code{flymake-mode} function.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
162
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
163 Instead of manually activating @code{flymake-mode}, you can configure
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
164 Flymake to automatically enable @code{flymake-mode} upon opening any
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
165 file for which syntax check is possible. To do so, place the following
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
166 line in @code{.emacs}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
167
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
168 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
169 (add-hook 'find-file-hooks 'flymake-find-file-hook)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
170 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
171
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
172 @node Running the syntax check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
173 @section Running the syntax check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
174 @cindex Manually starting the syntax check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
175
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
176 When @code{flymake-mode} is active, syntax check is started
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
177 automatically on any of the three conditions mentioned above. Syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
178 check can also be started manually by using the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
179 @code{flymake-start-syntax-check-for-current-buffer} function. This
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
180 can be used, for example, when changes were made to some other buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
181 affecting the current buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
182
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
183 @node Navigating to error lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
184 @section Navigating to error lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
185 @cindex Navigating to error lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
186
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
187 After syntax check is completed, lines for which at least one error or
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
188 warning has been reported are highlighted, and total number of errors
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
189 and warning is shown in the mode line. Use the following functions to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
190 navigate the highlighted lines.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
191
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
192 @multitable @columnfractions 0.25 0.75
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
193
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
194 @item @code{flymake-goto-next-error}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
195 @tab Moves point to the next erroneous line, if any.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
196
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
197 @item @code{flymake-goto-prev-error}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
198 @tab Moves point to the previous erroneous line.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
199
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
200 @end multitable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
201
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
202 These functions treat erroneous lines as a linked list. Therefore,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
203 @code{flymake-goto-next-error} will go to the first erroneous line
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
204 when invoked in the end of the buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
205
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
206 @node Viewing error messages
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
207 @section Viewing error messages
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
208 @cindex Viewing error messages
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
209
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
210 To view error messages belonging to the current line, use the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
211 @code{flymake-display-err-menu-for-current-line} function. If there's
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
212 at least one error or warning reported for the current line, this
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
213 function will display a popup menu with error/warning texts.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
214 Selecting the menu item whose error belongs to another file brings
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
215 forward that file with the help of the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
216 @code{flymake-goto-file-and-line} function.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
217
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
218 @node Syntax check statuses
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
219 @section Syntax check statuses
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
220 @cindex Syntax check statuses
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
221
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
222 After syntax check is finished, its status is displayed in the mode line.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
223 The following statuses are defined.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
224
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
225 @multitable @columnfractions 0.25 0.75
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
226 @item Flymake* or Flymake:E/W*
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
227 @tab Flymake is currently running. For the second case, E/W contains the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
228 error and warning count for the previous run.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
229
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
230 @item Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
231 @tab Syntax check is not running. Usually this means syntax check was
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
232 successfully passed (no errors, no warnings). Other possibilities are:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
233 syntax check was killed as a result of executing
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
234 @code{flymake-compile}, or syntax check cannot start as compilation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
235 is currently in progress.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
236
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
237 @item Flymake:E/W
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
238 @tab Number of errors/warnings found by the syntax check process.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
239
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
240 @item Flymake:!
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
241 @tab Flymake was unable to find master file for the current buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
242 @end multitable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
243
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
244 The following errors cause a warning message and switch flymake mode
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
245 OFF for the buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
246
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
247 @multitable @columnfractions 0.25 0.75
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
248 @item CFGERR
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
249 @tab Syntax check process returned nonzero exit code, but no
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
250 errors/warnings were reported. This indicates a possible configuration
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
251 error (for example, no suitable error message patterns for the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
252 syntax check tool).
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
253
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
254 @item NOMASTER
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
255 @tab Flymake was unable to find master file for the current buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
256
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
257 @item NOMK
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
258 @tab Flymake was unable to find a suitable buildfile for the current buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
259
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
260 @item PROCERR
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
261 @tab Flymake was unable to launch a syntax check process.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
262 @end multitable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
263
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
264
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
265 @node Troubleshooting
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
266 @section Troubleshooting
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
267 @cindex Logging
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
268 @cindex Troubleshooting
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
269
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
270 Flymake uses a simple logging facility for indicating important points
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
271 in the control flow. The logging facility sends logging messages to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
272 the @code{*Messages*} buffer. The information logged can be used for
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
273 resolving various problems related to Flymake.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
274
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
275 Logging output is controlled by the @code{flymake-log-level}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
276 variable. @code{3} is the most verbose level, and @code{-1} switches
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
277 logging off.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
278
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
279 @node Configuring Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
280 @chapter Configuring and Extending Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
281 @cindex Configuring and Extending Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
282
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
283 @menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
284 * Customizable variables::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
285 * Adding support for a new syntax check tool::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
286 @end menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
287
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
288 Flymake was designed to be easily extended for supporting new syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
289 check tools and error message patterns.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
290
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
291 @node Customizable variables
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
292 @section Customizable variables
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
293 @cindex Customizable variables
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
294
63600
c8b57e4594b8 Fix spellings.
Juanma Barranquero <lekktu@gmail.com>
parents: 60407
diff changeset
295 This section summarizes variables used for Flymake
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
296 configuration.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
297
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
298 @table @code
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
299 @item flymake-log-level
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
300 Controls logging output, see @ref{Troubleshooting}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
301
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
302 @item flymake-allowed-file-name-masks
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
303 A list of @code{(filename-regexp, init-function, cleanup-function
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
304 getfname-function)} for configuring syntax check tools. @xref{Adding
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
305 support for a new syntax check tool}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
306
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
307 @item flymake-buildfile-dirs
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
308 A list of directories (relative paths) for searching a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
309 buildfile. @xref{Locating the buildfile}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
310
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
311 @item flymake-master-file-dirs
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
312 A list of directories for searching a master file. @xref{Locating a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
313 master file}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
314
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
315 @item flymake-get-project-include-dirs-function
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
316 A function used for obtaining a list of project include dirs (C/C++
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
317 specific). @xref{Getting the include directories}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
318
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
319 @item flymake-master-file-count-limit
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
320 @itemx flymake-check-file-limit
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
321 Used when looking for a master file. @xref{Locating a master file}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
322
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
323 @item flymake-err-line-patterns
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
324 Patterns for error/warning messages in the form @code{(regexp file-idx
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
325 line-idx err-text-idx)}. @xref{Parsing the output}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
326
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
327 @item flymake-compilation-prevents-syntax-check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
328 A flag indicating whether compilation and syntax check of the same
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
329 file cannot be run simultaneously.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
330
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
331 @item flymake-no-changes-timeout
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
332 If any changes are made to the buffer, syntax check is automatically
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
333 started after @code{flymake-no-changes-timeout} seconds.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
334
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
335 @item flymake-gui-warnings-enabled
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
336 A boolean flag indicating whether Flymake will show message boxes for
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
337 non-recoverable errors. If @code{flymake-gui-warnings-enabled} is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
338 @code{nil}, these errors will only be logged to the @code{*Messages*}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
339 buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
340
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
341 @item flymake-start-syntax-check-on-newline
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
342 A boolean flag indicating whether to start syntax check after a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
343 newline character is added to the buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
344
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
345 @item flymake-errline-face
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
346 A custom face for highlighting lines for which at least one error has
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
347 been reported.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
348
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
349 @item flymake-warnline-face
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
350 A custom face for highlighting lines for which at least one warning
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
351 and no errors have been reported.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
352
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
353 @end table
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
354
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
355 @node Adding support for a new syntax check tool
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
356 @section Adding support for a new syntax check tool
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
357 @cindex Adding support for a new syntax check tool
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
358
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
359 @menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
360 * Example -- Configuring a tool called directly::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
361 * Example -- Configuring a tool called via make::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
362 @end menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
363
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
364 Syntax check tools are configured using the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
365 @code{flymake-allowed-file-name-masks} list. Each item of this list
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
366 has the following format:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
367
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
368 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
369 (filename-regexp, init-function, cleanup-function, getfname-function)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
370 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
371
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
372 @table @code
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
373 @item filename-regexp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
374 This field is used as a key for locating init/cleanup/getfname
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
375 functions for the buffer. Items in
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
376 @code{flymake-allowed-file-name-masks} are searched sequentially. The
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
377 first item with @code{filename-regexp} matching buffer filename is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
378 selected. If no match is found, @code{flymake-mode} is switched off.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
379
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
380 @item init-function
63600
c8b57e4594b8 Fix spellings.
Juanma Barranquero <lekktu@gmail.com>
parents: 60407
diff changeset
381 @code{init-function} is required to initialize the syntax check,
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
382 usually by creating a temporary copy of the buffer contents. The
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
383 function must return @code{(list cmd-name arg-list)}. If
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
384 @code{init-function} returns null, syntax check is aborted, by
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
385 @code{flymake-mode} is not switched off.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
386
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
387 @item cleanup-function
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
388 @code{cleanup-function} is called after the syntax check process is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
389 complete and should take care of proper deinitialization, which is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
390 usually deleting a temporary copy created by the @code{init-function}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
391
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
392 @item getfname-function
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
393 This function is used for translating filenames reported by the syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
394 check tool into ``real'' filenames. Filenames reported by the tool
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
395 will be different from the real ones, as actually the tool works with
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
396 the temporary copy. In most cases, the default implementation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
397 provided by Flymake, @code{flymake-get-real-file-name}, can be used as
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
398 @code{getfname-function}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
399
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
400 @end table
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
401
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
402 To add support for a new syntax check tool, write corresponding
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
403 @code{init-function}, and, optionally @code{cleanup-function} and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
404 @code{getfname-function}. If the format of error messages reported by
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
405 the new tool is not yet supported by Flymake, add a new entry to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
406 the @code{flymake-err-line-patterns} list.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
407
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
408 The following sections contain some examples of configuring Flymake
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
409 support for various syntax check tools.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
410
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
411 @node Example -- Configuring a tool called directly
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
412 @subsection Example -- Configuring a tool called directly
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
413 @cindex Adding support for perl
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
414
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
415 In this example, we will add support for @code{perl} as a syntax check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
416 tool. @code{perl} supports the @code{-c} option which does syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
417 checking.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
418
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
419 First, we write the @code{init-function}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
420
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
421 @lisp
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
422 (defun flymake-perl-init (buffer)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
423 (let* ((temp-file (flymake-init-create-temp-buffer-copy
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
424 buffer 'flymake-create-temp-inplace))
63952
4133ed695908 (Example -- Configuring a tool called directly):
Richard M. Stallman <rms@gnu.org>
parents: 63600
diff changeset
425 (local-file (concat (flymake-build-relative-filename
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
426 (file-name-directory
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
427 (buffer-file-name
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
428 (current-buffer)))
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
429 (file-name-directory temp-file))
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
430 (file-name-nondirectory temp-file))))
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
431 (list "perl" (list "-wc " local-file))))
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
432 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
433
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
434 @code{flymake-perl-init} creates a temporary copy of the buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
435 contents with the help of
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
436 @code{flymake-init-create-temp-buffer-copy}, and builds an appropriate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
437 command line.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
438
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
439 Next, we add a new entry to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
440 @code{flymake-allowed-file-name-masks}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
441
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
442 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
443 (setq flymake-allowed-file-name-masks
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
444 (cons '(".+\\.pl$"
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
445 flymake-perl-init
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
446 flymake-simple-cleanup
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
447 flymake-get-real-file-name)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
448 flymake-allowed-file-name-masks))
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
449 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
450
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
451 Note that we use standard @code{cleanup-function} and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
452 @code{getfname-function}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
453
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
454 Finally, we add an entry to @code{flymake-err-line-patterns}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
455
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
456 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
457 (setq flymake-err-line-patterns
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
458 (cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]"
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
459 2 3 nil 1)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
460 flymake-err-line-patterns))
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
461 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
462
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
463 @node Example -- Configuring a tool called via make
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
464 @subsection Example -- Configuring a tool called via make
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
465 @cindex Adding support for C (gcc+make)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
466
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
467 In this example we will add support for C files syntax checked by
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
468 @code{gcc} called via @code{make}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
469
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
470 We're not required to write any new functions, as Flymake already has
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
471 functions for @code{make}. We just add a new entry to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
472 @code{flymake-allowed-file-name-masks}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
473
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
474 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
475 (setq flymake-allowed-file-name-masks
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
476 (cons '(".+\\.c$"
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
477 flymake-simple-make-init
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
478 flymake-simple-cleanup
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
479 flymake-get-real-file-name)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
480 flymake-allowed-file-name-masks))
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
481 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
482
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
483 @code{flymake-simple-make-init} builds the following @code{make}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
484 command line:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
485
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
486 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
487 (list "make"
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
488 (list "-s" "-C"
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
489 base-dir
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
490 (concat "CHK_SOURCES=" source)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
491 "SYNTAX_CHECK_MODE=1"
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
492 "check-syntax"))
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
493 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
494
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
495 @code{base-dir} is a directory containing @code{Makefile}, see @ref{Locating the buildfile}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
496
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
497 Thus, @code{Makefile} must contain the @code{check-syntax} target. In
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
498 our case this target might look like this:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
499
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
500 @verbatim
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
501 check-syntax:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
502 gcc -o nul -S ${CHK_SOURCES}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
503 @end verbatim
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
504
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
505 The format of error messages reported by @code{gcc} is already
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
506 supported by Flymake, so we don't have to add a new entry to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
507 @code{flymake-err-line-patterns}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
508
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
509 @node Flymake Implementation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
510 @chapter Flymake Implementation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
511 @cindex Implementation details
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
512
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
513 @menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
514 * Determining whether syntax check is possible::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
515 * Making a temporary copy::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
516 * Locating a master file::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
517 * Getting the include directories::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
518 * Locating the buildfile::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
519 * Starting the syntax check process::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
520 * Parsing the output::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
521 * Highlighting erroneous lines::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
522 * Interaction with other modes::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
523 @end menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
524
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
525 Syntax check is started by calling @code{flymake-start-syntax-check-for-current-buffer}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
526 Flymake first determines whether it is able to do syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
527 check. It then saves a copy of the buffer in a temporary file in the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
528 buffer's directory (or in the system temp directory -- for java
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
529 files), creates a syntax check command and launches a process with
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
530 this command. The output is parsed using a list of error message patterns,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
531 and error information (file name, line number, type and text) is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
532 saved. After the process has finished, Flymake highlights erroneous
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
533 lines in the buffer using the accumulated error information.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
534
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
535 @node Determining whether syntax check is possible
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
536 @section Determining whether syntax check is possible
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
537 @cindex Syntax check models
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
538 @cindex Master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
539
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
540 Syntax check is considered possible if there's an entry in
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
541 @code{flymake-allowed-file-name-masks} matching buffer's filename and
56279
b1ae5333057a * ses.texi, viper.texi, search.texi, flymake.texi, faq.texi:
Jesper Harder <harder@ifa.au.dk>
parents: 55855
diff changeset
542 its @code{init-function} returns non-@code{nil} value.
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
543
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
544 Two syntax check modes are distinguished:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
545
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
546 @enumerate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
547
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
548 @item
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
549 Buffer can be syntax checked in a standalone fashion, that is, the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
550 file (its temporary copy, in fact) can be passed over to the compiler to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
551 do the syntax check. Examples are C/C++ (.c, .cpp) and Java (.java)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
552 sources.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
553
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
554 @item
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
555 Buffer can be syntax checked, but additional file, called master file,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
556 is required to perform this operation. A master file is a file that
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
557 includes the current file, so that running a syntax check tool on it
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
558 will also check syntax in the current file. Examples are C/C++ (.h,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
559 .hpp) headers.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
560
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
561 @end enumerate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
562
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
563 These modes are handled inside init/cleanup/getfname functions, see
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
564 @ref{Adding support for a new syntax check tool}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
565
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
566 Flymake contains implementations of all functionality required to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
567 support different syntax check modes described above (making
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
568 temporary copies, finding master files, etc.), as well as some
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
569 tool-specific (routines for @code{make}, @code{Ant}, etc.) code.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
570
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
571
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
572 @node Making a temporary copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
573 @section Making a temporary copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
574 @cindex Temporary copy of the buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
575 @cindex Master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
576
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
577 After the possibility of the syntax check has been determined, a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
578 temporary copy of the current buffer is made so that the most recent
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
579 unsaved changes could be seen by the syntax check tool. Making a copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
580 is quite straightforward in a standalone case (mode @code{1}), as it's
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
581 just saving buffer contents to a temporary file.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
582
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
583 Things get trickier, however, when master file is involved, as it
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
584 requires to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
585
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
586 @itemize @bullet
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
587 @item locate a master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
588 @item patch it to include the current file using its new (temporary)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
589 name.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
590 @end itemize
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
591
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
592 Locating a master file is discussed in the following section.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
593
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
594 Patching just changes all appropriate lines of the master file so that they
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
595 use the new (temporary) name of the current file. For example, suppose current
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
596 file name is @code{file.h}, the master file is @code{file.cpp}, and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
597 it includes current file via @code{#include "file.h"}. Current file's copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
598 is saved to file @code{file_flymake.h}, so the include line must be
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
599 changed to @code{#include "file_flymake.h"}. Finally, patched master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
600 is saved to @code{file_flymake_master.cpp}, and the last one is passed to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
601 the syntax check tool.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
602
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
603 @node Locating a master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
604 @section Locating a master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
605 @cindex Master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
606
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
607 Master file is located in two steps.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
608
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
609 First, a list of possible master files is built. A simple name
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
610 matching is used to find the files. For a C++ header @code{file.h},
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
611 Flymake searches for all @code{.cpp} files in the directories whose relative paths are
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
612 stored in a customizable variable @code{flymake-master-file-dirs}, which
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
613 usually contains something like @code{("." "./src")}. No more than
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
614 @code{flymake-master-file-count-limit} entries is added to the master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
615 list. The list is then sorted to move files with names @code{file.cpp} to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
616 the top.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
617
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
618 Next, each master file in a list is checked to contain the appropriate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
619 include directives. No more than @code{flymake-check-file-limit} of each
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
620 file are parsed.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
621
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
622 For @code{file.h}, the include directives to look for are
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
623 @code{#include "file.h"}, @code{#include "../file.h"}, etc. Each
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
624 include is checked against a list of include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
625 (see @ref{Getting the include directories}) to be sure it points to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
626 correct @code{file.h}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
627
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
628 First matching master file found stops the search. The master file is then
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
629 patched and saved to disk. In case no master file is found, syntax check is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
630 aborted, and corresponding status (!) is reported in the mode line.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
631
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
632 @node Getting the include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
633 @section Getting the include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
634 @cindex Include directories (C/C++ specific)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
635
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
636 Two sets of include directories are distinguished: system include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
637 and project include directories. The former is just the contents of the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
638 @code{INCLUDE} environment variable. The latter is not so easy to obtain,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
639 and the way it can be obtained can vary greatly for different projects.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
640 Therefore, a customizable variable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
641 @code{flymake-get-project-include-dirs-function} is used to provide the
63600
c8b57e4594b8 Fix spellings.
Juanma Barranquero <lekktu@gmail.com>
parents: 60407
diff changeset
642 way to implement the desired behavior.
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
643
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
644 The default implementation, @code{flymake-get-project-include-dirs-imp},
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
645 uses a @code{make} call. This requires a correct base directory, that is, a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
646 directory containing a correct @code{Makefile}, to be determined.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
647
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
648 As obtaining the project include directories might be a costly operation, its
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
649 return value is cached in the hash table. The cache is cleared in the beginning
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
650 of every syntax check attempt.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
651
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
652 @node Locating the buildfile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
653 @section Locating the buildfile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
654 @cindex Locating the buildfile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
655 @cindex buildfile, locating
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
656 @cindex Makefile, locating
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
657
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
658 Flymake can be configured to use different tools for performing syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
659 checks. For example, it can use direct compiler call to syntax check a perl
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
660 script or a call to @code{make} for a more complicated case of a
63600
c8b57e4594b8 Fix spellings.
Juanma Barranquero <lekktu@gmail.com>
parents: 60407
diff changeset
661 @code{C/C++} source. The general idea is that simple files, like perl
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
662 scripts and html pages, can be checked by directly invoking a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
663 corresponding tool. Files that are usually more complex and generally
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
664 used as part of larger projects, might require non-trivial options to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
665 be passed to the syntax check tool, like include directories for
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
666 C++. The latter files are syntax checked using some build tool, like
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
667 @code{make} or @code{Ant}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
668
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
669 All @code{make} configuration data is usually stored in a file called
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
670 @code{Makefile}. To allow for future extensions, flymake uses a notion of
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
671 buildfile to reference the 'project configuration' file.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
672
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
673 Special function, @code{flymake-find-buildfile} is provided for locating buildfiles.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
674 Searching for a buildfile is done in a manner similar to that of searching
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
675 for possible master files. A customizable variable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
676 @code{flymake-buildfile-dirs} holds a list of relative paths to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
677 buildfile. They are checked sequentially until a buildfile is found. In case
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
678 there's no build file, syntax check is aborted.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
679
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
680 Buildfile values are also cached.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
681
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
682 @node Starting the syntax check process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
683 @section Starting the syntax check process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
684 @cindex Syntax check process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
685
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
686 The command line (command name and the list of arguments) for launching a process is returned by the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
687 initialization function. Flymake then just calls @code{start-process}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
688 to start an asynchronous process and configures process filter and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
689 sentinel which is used for processing the output of the syntax check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
690 tool.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
691
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
692 @node Parsing the output
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
693 @section Parsing the output
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
694 @cindex Parsing the output
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
695
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
696 The output generated by the syntax check tool is parsed in the process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
697 filter/sentinel using the error message patterns stored in the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
698 @code{flymake-err-line-patterns} variable. This variable contains a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
699 list of items of the form @code{(regexp file-idx line-idx
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
700 err-text-idx)}, used to determine whether a particular line is an
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
701 error message and extract file name, line number and error text,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
702 respectively. Error type (error/warning) is also guessed by matching
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
703 error text with the '@code{^[wW]arning}' pattern. Anything that was not
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
704 classified as a warning is considered an error. Type is then used to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
705 sort error menu items, which shows error messages first.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
706
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
707 Flymake is also able to interpret error message patterns missing err-text-idx
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
708 information. This is done by merely taking the rest of the matched line
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
709 (@code{(substring line (match-end 0))}) as error text. This trick allows
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
710 to make use of a huge collection of error message line patterns from
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
711 @code{compile.el}. All these error patterns are appended to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
712 the end of @code{flymake-err-line-patterns}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
713
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
714 The error information obtained is saved in a buffer local
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
715 variable. The buffer for which the process output belongs is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
716 determined from the process-id@w{}->@w{}buffer mapping updated
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
717 after every process launch/exit.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
718
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
719 @node Highlighting erroneous lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
720 @section Highlighting erroneous lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
721 @cindex Erroneous lines, faces
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
722
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
723 Highlighting is implemented with overlays and happens in the process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
724 sentinel, after calling the cleanup function. Two customizable faces
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
725 are used: @code{flymake-errline-face} and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
726 @code{flymake-warnline-face}. Errors belonging outside the current
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
727 buffer are considered to belong to line 1 of the current buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
728
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
729 @node Interaction with other modes
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
730 @section Interaction with other modes
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
731 @cindex Interaction with other modes
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
732 @cindex Interaction with compile mode
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
733
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
734 The only mode flymake currently knows about is @code{compile}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
735
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
736 Flymake can be configured to not start syntax check if it thinks the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
737 compilation is in progress. The check is made by the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
738 @code{flymake-compilation-is-running}, which tests the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
739 @code{compilation-in-progress} variable. The reason why this might be
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
740 useful is saving CPU time in case both syntax check and compilation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
741 are very CPU intensive. The original reason for adding this feature,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
742 though, was working around a locking problem with MS Visual C++ compiler.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
743
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
744 Flymake also provides an alternative command for starting compilation,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
745 @code{flymake-compile}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
746
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
747 @lisp
60407
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
748 (defun flymake-compile ()
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
749 "Kill all flymake syntax checks then start compilation."
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
750 (interactive)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
751 (flymake-stop-all-syntax-checks)
7c70ab62c5d7 Refill and tweak style in @lisp blocks.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 56279
diff changeset
752 (call-interactively 'compile))
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
753 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
754
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
755 It just kills all the active syntax check processes before calling
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
756 @code{compile}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
757
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
758 @node Index
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
759 @unnumbered Index
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
760
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
761 @printindex cp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
762
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
763 @bye
55855
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
764
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
765 @ignore
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
766 arch-tag: 9f0db077-5598-49ab-90b9-8df9248a63ec
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
767 @end ignore