annotate man/flymake.texi @ 59723:08c7f3c89c0b

(ispell-dictionary-alist-4): Rewrite the CASECHARS and NOT-CASECHARS regular expressions of the "nederlands" and "nederlands8" dictionaries to prevent a "Range striding over charsets" error.
author Lute Kamstra <lute@gnu.org>
date Tue, 25 Jan 2005 00:36:50 +0000
parents b1ae5333057a
children 7c70ab62c5d7
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
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
295 This section summarises variables used for Flymake
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
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
381 @code{init-function} is required to initialise the syntax check,
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
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
422 (defun flymake-perl-init(buffer)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
423 (let* ((temp-file (flymake-init-create-temp-buffer-copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
424 buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
425 'flymake-create-temp-inplace))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
426 (local-file (concat (flymake-build-relative-path
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
427 (file-name-directory
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
428 (buffer-file-name
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
429 (current-buffer)))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
430 (file-name-directory temp-file))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
431 (file-name-nondirectory temp-file))))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
432 (list "perl" (list "-wc " local-file))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
433 )
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
434 )
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
435 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
436
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
437 @code{flymake-perl-init} creates a temporary copy of the buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
438 contents with the help of
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
439 @code{flymake-init-create-temp-buffer-copy}, and builds an appropriate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
440 command line.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
441
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
442 Next, we add a new entry to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
443 @code{flymake-allowed-file-name-masks}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
444
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
445 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
446 (setq flymake-allowed-file-name-masks
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
447 (cons '(".+\\.pl$"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
448 flymake-perl-init
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
449 flymake-simple-cleanup
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
450 flymake-get-real-file-name)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
451 flymake-allowed-file-name-masks))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
452 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
453
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
454 Note that we use standard @code{cleanup-function} and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
455 @code{getfname-function}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
456
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
457 Finally, we add an entry to @code{flymake-err-line-patterns}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
458
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
459 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
460 (setq flymake-err-line-patterns
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
461 (cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
462 flymake-err-line-patterns))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
463 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
464
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
465 @node Example -- Configuring a tool called via make
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
466 @subsection Example -- Configuring a tool called via make
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
467 @cindex Adding support for C (gcc+make)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
468
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
469 In this example we will add support for C files syntax checked by
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
470 @code{gcc} called via @code{make}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
471
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
472 We're not required to write any new functions, as Flymake already has
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
473 functions for @code{make}. We just add a new entry to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
474 @code{flymake-allowed-file-name-masks}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
475
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
476 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
477 (setq flymake-allowed-file-name-masks
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
478 (cons '(".+\\.c$"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
479 flymake-simple-make-init
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
480 flymake-simple-cleanup
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
481 flymake-get-real-file-name)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
482 flymake-allowed-file-name-masks))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
483 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
484
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
485 @code{flymake-simple-make-init} builds the following @code{make}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
486 command line:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
487
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
488 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
489 (list "make"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
490 (list "-s"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
491 "-C"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
492 base-dir
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
493 (concat "CHK_SOURCES=" source)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
494 "SYNTAX_CHECK_MODE=1"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
495 "check-syntax"))
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
496 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
497
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
498 @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
499
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
500 Thus, @code{Makefile} must contain the @code{check-syntax} target. In
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
501 our case this target might look like this:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
502
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
503 @verbatim
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
504 check-syntax:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
505 gcc -o nul -S ${CHK_SOURCES}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
506 @end verbatim
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
507
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
508 The format of error messages reported by @code{gcc} is already
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
509 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
510 @code{flymake-err-line-patterns}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
511
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
512 @node Flymake Implementation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
513 @chapter Flymake Implementation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
514 @cindex Implementation details
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
515
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
516 @menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
517 * Determining whether syntax check is possible::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
518 * Making a temporary copy::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
519 * Locating a master file::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
520 * Getting the include directories::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
521 * Locating the buildfile::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
522 * Starting the syntax check process::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
523 * Parsing the output::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
524 * Highlighting erroneous lines::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
525 * Interaction with other modes::
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
526 @end menu
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
527
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
528 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
529 Flymake first determines whether it is able to do syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
530 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
531 buffer's directory (or in the system temp directory -- for java
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
532 files), creates a syntax check command and launches a process with
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
533 this command. The output is parsed using a list of error message patterns,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
534 and error information (file name, line number, type and text) is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
535 saved. After the process has finished, Flymake highlights erroneous
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
536 lines in the buffer using the accumulated error information.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
537
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
538 @node Determining whether syntax check is possible
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
539 @section Determining whether syntax check is possible
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
540 @cindex Syntax check models
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
541 @cindex Master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
542
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
543 Syntax check is considered possible if there's an entry in
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
544 @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
545 its @code{init-function} returns non-@code{nil} value.
55822
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
546
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
547 Two syntax check modes are distinguished:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
548
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
549 @enumerate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
550
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
551 @item
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
552 Buffer can be syntax checked in a standalone fashion, that is, the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
553 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
554 do the syntax check. Examples are C/C++ (.c, .cpp) and Java (.java)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
555 sources.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
556
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
557 @item
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
558 Buffer can be syntax checked, but additional file, called master file,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
559 is required to perform this operation. A master file is a file that
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
560 includes the current file, so that running a syntax check tool on it
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
561 will also check syntax in the current file. Examples are C/C++ (.h,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
562 .hpp) headers.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
563
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
564 @end enumerate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
565
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
566 These modes are handled inside init/cleanup/getfname functions, see
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
567 @ref{Adding support for a new syntax check tool}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
568
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
569 Flymake contains implementations of all functionality required to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
570 support different syntax check modes described above (making
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
571 temporary copies, finding master files, etc.), as well as some
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
572 tool-specific (routines for @code{make}, @code{Ant}, etc.) code.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
573
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
574
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
575 @node Making a temporary copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
576 @section Making a temporary copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
577 @cindex Temporary copy of the buffer
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
578 @cindex Master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
579
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
580 After the possibility of the syntax check has been determined, a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
581 temporary copy of the current buffer is made so that the most recent
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
582 unsaved changes could be seen by the syntax check tool. Making a copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
583 is quite straightforward in a standalone case (mode @code{1}), as it's
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
584 just saving buffer contents to a temporary file.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
585
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
586 Things get trickier, however, when master file is involved, as it
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
587 requires to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
588
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
589 @itemize @bullet
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
590 @item locate a master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
591 @item patch it to include the current file using its new (temporary)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
592 name.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
593 @end itemize
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
594
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
595 Locating a master file is discussed in the following section.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
596
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
597 Patching just changes all appropriate lines of the master file so that they
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
598 use the new (temporary) name of the current file. For example, suppose current
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
599 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
600 it includes current file via @code{#include "file.h"}. Current file's copy
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
601 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
602 changed to @code{#include "file_flymake.h"}. Finally, patched master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
603 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
604 the syntax check tool.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
605
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
606 @node Locating a master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
607 @section Locating a master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
608 @cindex Master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
609
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
610 Master file is located in two steps.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
611
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
612 First, a list of possible master files is built. A simple name
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
613 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
614 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
615 stored in a customizable variable @code{flymake-master-file-dirs}, which
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
616 usually contains something like @code{("." "./src")}. No more than
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
617 @code{flymake-master-file-count-limit} entries is added to the master file
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
618 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
619 the top.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
620
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
621 Next, each master file in a list is checked to contain the appropriate
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
622 include directives. No more than @code{flymake-check-file-limit} of each
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
623 file are parsed.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
624
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
625 For @code{file.h}, the include directives to look for are
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
626 @code{#include "file.h"}, @code{#include "../file.h"}, etc. Each
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
627 include is checked against a list of include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
628 (see @ref{Getting the include directories}) to be sure it points to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
629 correct @code{file.h}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
630
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
631 First matching master file found stops the search. The master file is then
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
632 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
633 aborted, and corresponding status (!) is reported in the mode line.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
634
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
635 @node Getting the include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
636 @section Getting the include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
637 @cindex Include directories (C/C++ specific)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
638
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
639 Two sets of include directories are distinguished: system include directories
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
640 and project include directories. The former is just the contents of the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
641 @code{INCLUDE} environment variable. The latter is not so easy to obtain,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
642 and the way it can be obtained can vary greatly for different projects.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
643 Therefore, a customizable variable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
644 @code{flymake-get-project-include-dirs-function} is used to provide the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
645 way to implement the desired behaviour.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
646
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
647 The default implementation, @code{flymake-get-project-include-dirs-imp},
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
648 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
649 directory containing a correct @code{Makefile}, to be determined.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
650
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
651 As obtaining the project include directories might be a costly operation, its
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
652 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
653 of every syntax check attempt.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
654
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
655 @node Locating the buildfile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
656 @section Locating the buildfile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
657 @cindex Locating the buildfile
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
658 @cindex buildfile, locating
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
659 @cindex Makefile, locating
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
660
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
661 Flymake can be configured to use different tools for performing syntax
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
662 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
663 script or a call to @code{make} for a more complicated case of a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
664 @code{C/C++} source. The general idea is that simple files, like perl
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
665 scripts and html pages, can be checked by directly invoking a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
666 corresponding tool. Files that are usually more complex and generally
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
667 used as part of larger projects, might require non-trivial options to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
668 be passed to the syntax check tool, like include directories for
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
669 C++. The latter files are syntax checked using some build tool, like
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
670 @code{make} or @code{Ant}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
671
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
672 All @code{make} configuration data is usually stored in a file called
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
673 @code{Makefile}. To allow for future extensions, flymake uses a notion of
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
674 buildfile to reference the 'project configuration' file.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
675
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
676 Special function, @code{flymake-find-buildfile} is provided for locating buildfiles.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
677 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
678 for possible master files. A customizable variable
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
679 @code{flymake-buildfile-dirs} holds a list of relative paths to the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
680 buildfile. They are checked sequentially until a buildfile is found. In case
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
681 there's no build file, syntax check is aborted.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
682
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
683 Buildfile values are also cached.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
684
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
685 @node Starting the syntax check process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
686 @section Starting the syntax check process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
687 @cindex Syntax check process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
688
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
689 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
690 initialization function. Flymake then just calls @code{start-process}
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
691 to start an asynchronous process and configures process filter and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
692 sentinel which is used for processing the output of the syntax check
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
693 tool.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
694
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
695 @node Parsing the output
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
696 @section Parsing the output
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
697 @cindex Parsing the output
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
698
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
699 The output generated by the syntax check tool is parsed in the process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
700 filter/sentinel using the error message patterns stored in the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
701 @code{flymake-err-line-patterns} variable. This variable contains a
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
702 list of items of the form @code{(regexp file-idx line-idx
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
703 err-text-idx)}, used to determine whether a particular line is an
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
704 error message and extract file name, line number and error text,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
705 respectively. Error type (error/warning) is also guessed by matching
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
706 error text with the '@code{^[wW]arning}' pattern. Anything that was not
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
707 classified as a warning is considered an error. Type is then used to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
708 sort error menu items, which shows error messages first.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
709
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
710 Flymake is also able to interpret error message patterns missing err-text-idx
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
711 information. This is done by merely taking the rest of the matched line
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
712 (@code{(substring line (match-end 0))}) as error text. This trick allows
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
713 to make use of a huge collection of error message line patterns from
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
714 @code{compile.el}. All these error patterns are appended to
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
715 the end of @code{flymake-err-line-patterns}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
716
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
717 The error information obtained is saved in a buffer local
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
718 variable. The buffer for which the process output belongs is
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
719 determined from the process-id@w{}->@w{}buffer mapping updated
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
720 after every process launch/exit.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
721
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
722 @node Highlighting erroneous lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
723 @section Highlighting erroneous lines
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
724 @cindex Erroneous lines, faces
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
725
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
726 Highlighting is implemented with overlays and happens in the process
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
727 sentinel, after calling the cleanup function. Two customizable faces
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
728 are used: @code{flymake-errline-face} and
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
729 @code{flymake-warnline-face}. Errors belonging outside the current
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
730 buffer are considered to belong to line 1 of the current buffer.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
731
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
732 @node Interaction with other modes
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
733 @section Interaction with other modes
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
734 @cindex Interaction with other modes
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
735 @cindex Interaction with compile mode
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
736
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
737 The only mode flymake currently knows about is @code{compile}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
738
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
739 Flymake can be configured to not start syntax check if it thinks the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
740 compilation is in progress. The check is made by the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
741 @code{flymake-compilation-is-running}, which tests the
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
742 @code{compilation-in-progress} variable. The reason why this might be
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
743 useful is saving CPU time in case both syntax check and compilation
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
744 are very CPU intensive. The original reason for adding this feature,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
745 though, was working around a locking problem with MS Visual C++ compiler.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
746
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
747 Flymake also provides an alternative command for starting compilation,
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
748 @code{flymake-compile}:
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
749
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
750 @lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
751 (defun flymake-compile()
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
752 "kill all flymake syntax checks, start compilation"
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
753 (interactive)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
754 (flymake-stop-all-syntax-checks)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
755 (call-interactively 'compile)
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
756 )
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
757 @end lisp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
758
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
759 It just kills all the active syntax check processes before calling
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
760 @code{compile}.
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
761
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
762 @node Index
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
763 @unnumbered Index
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
764
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
765 @printindex cp
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
766
ffbaa3e438cd New file.
Eli Zaretskii <eliz@gnu.org>
parents:
diff changeset
767 @bye
55855
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
768
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
769 @ignore
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
770 arch-tag: 9f0db077-5598-49ab-90b9-8df9248a63ec
fea2f114cd7d Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 55822
diff changeset
771 @end ignore