annotate doc/misc/flymake.texi @ 106850:a6629254b6ba

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