Mercurial > emacs
annotate lisp/progmodes/flymake.el @ 78712:9fb15fe54f48
*** empty log message ***
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Sat, 01 Sep 2007 23:32:36 +0000 |
parents | 97bfd89475cd |
children | a1342e6e097a e5a68f18fcb9 |
rev | line source |
---|---|
55822 | 1 ;;; flymake.el -- a universal on-the-fly syntax checker |
2 | |
75347 | 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 |
4 ;; Free Software Foundation, Inc. | |
55822 | 5 |
74181
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
6 ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
7 ;; Maintainer: Pavel Kobyakov <pk_at_work@yahoo.com> |
55822 | 8 ;; Version: 0.3 |
9 ;; Keywords: c languages tools | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
78234
c1ec1c8a8d2e
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76818
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
55822 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
55822 | 27 |
28 ;;; Commentary: | |
29 ;; | |
30 ;; Flymake is a minor Emacs mode performing on-the-fly syntax | |
31 ;; checks using the external syntax check tool (for C/C++ this | |
32 ;; is usually the compiler) | |
33 | |
68122
b720282b1826
Add bugs/todo entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68119
diff
changeset
|
34 ;;; Bugs/todo: |
b720282b1826
Add bugs/todo entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68119
diff
changeset
|
35 |
b720282b1826
Add bugs/todo entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68119
diff
changeset
|
36 ;; - Only uses "Makefile", not "makefile" or "GNUmakefile" |
b720282b1826
Add bugs/todo entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68119
diff
changeset
|
37 ;; (from http://bugs.debian.org/337339). |
b720282b1826
Add bugs/todo entry.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68119
diff
changeset
|
38 |
55822 | 39 ;;; Code: |
40 | |
68101
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
41 (eval-when-compile (require 'cl)) |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
42 (if (featurep 'xemacs) (require 'overlay)) |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
43 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
44 (defvar flymake-is-running nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
45 "If t, flymake syntax check process is running for the current buffer.") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
46 (make-variable-buffer-local 'flymake-is-running) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
47 |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
48 (defvar flymake-timer nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
49 "Timer for starting syntax check.") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
50 (make-variable-buffer-local 'flymake-timer) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
51 |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
52 (defvar flymake-last-change-time nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
53 "Time of last buffer change.") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
54 (make-variable-buffer-local 'flymake-last-change-time) |
63971
b4534bf76ba1
(flymake-find-file): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents:
63924
diff
changeset
|
55 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
56 (defvar flymake-check-start-time nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
57 "Time at which syntax check was started.") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
58 (make-variable-buffer-local 'flymake-check-start-time) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
59 |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
60 (defvar flymake-check-was-interrupted nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
61 "Non-nil if syntax check was killed by `flymake-compile'.") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
62 (make-variable-buffer-local 'flymake-check-was-interrupted) |
63971
b4534bf76ba1
(flymake-find-file): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents:
63924
diff
changeset
|
63 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
64 (defvar flymake-err-info nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
65 "Sorted list of line numbers and lists of err info in the form (file, err-text).") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
66 (make-variable-buffer-local 'flymake-err-info) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
67 |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
68 (defvar flymake-new-err-info nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
69 "Same as `flymake-err-info', effective when a syntax check is in progress.") |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
70 (make-variable-buffer-local 'flymake-new-err-info) |
63971
b4534bf76ba1
(flymake-find-file): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents:
63924
diff
changeset
|
71 |
55822 | 72 ;;;; [[ cross-emacs compatibility routines |
58561 | 73 (defsubst flymake-makehash (&optional test) |
74 (if (fboundp 'make-hash-table) | |
75 (if test (make-hash-table :test test) (make-hash-table)) | |
62574
88e2f978ea2c
(flymake-makehash): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents:
62402
diff
changeset
|
76 (with-no-warnings |
88e2f978ea2c
(flymake-makehash): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents:
62402
diff
changeset
|
77 (makehash test)))) |
55822 | 78 |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
79 (defalias 'flymake-float-time |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
80 (if (fboundp 'float-time) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
81 'float-time |
64109
1e30080a8802
(flymake-float-time): Instead of with-no-warnings, test for xemacs.
Richard M. Stallman <rms@gnu.org>
parents:
64087
diff
changeset
|
82 (if (featurep 'xemacs) |
1e30080a8802
(flymake-float-time): Instead of with-no-warnings, test for xemacs.
Richard M. Stallman <rms@gnu.org>
parents:
64087
diff
changeset
|
83 (lambda () |
1e30080a8802
(flymake-float-time): Instead of with-no-warnings, test for xemacs.
Richard M. Stallman <rms@gnu.org>
parents:
64087
diff
changeset
|
84 (multiple-value-bind (s0 s1 s2) (current-time) |
1e30080a8802
(flymake-float-time): Instead of with-no-warnings, test for xemacs.
Richard M. Stallman <rms@gnu.org>
parents:
64087
diff
changeset
|
85 (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2))))))) |
58515 | 86 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
87 (defalias 'flymake-replace-regexp-in-string |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
88 (if (eval-when-compile (fboundp 'replace-regexp-in-string)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
89 'replace-regexp-in-string |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
90 (lambda (regexp rep str) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
91 (replace-in-string str regexp rep)))) |
55822 | 92 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
93 (defalias 'flymake-split-string |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
94 (if (condition-case nil (equal (split-string " bc " " " t) '("bc")) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
95 (error nil)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
96 (lambda (str pattern) (split-string str pattern t)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
97 (lambda (str pattern) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
98 "Split STR into a list of substrings bounded by PATTERN. |
61943 | 99 Zero-length substrings at the beginning and end of the list are omitted." |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
100 (let ((split (split-string str pattern))) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
101 (while (equal (car split) "") (setq split (cdr split))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
102 (setq split (nreverse split)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
103 (while (equal (car split) "") (setq split (cdr split))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
104 (nreverse split))))) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
105 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
106 (defalias 'flymake-get-temp-dir |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
107 (if (fboundp 'temp-directory) |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
108 'temp-directory |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
109 (lambda () temporary-file-directory))) |
55822 | 110 |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
111 (defalias 'flymake-line-beginning-position |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
112 (if (fboundp 'line-beginning-position) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
113 'line-beginning-position |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
114 (lambda (&optional arg) (save-excursion (beginning-of-line arg) (point))))) |
55822 | 115 |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
116 (defalias 'flymake-line-end-position |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
117 (if (fboundp 'line-end-position) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
118 'line-end-position |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
119 (lambda (&optional arg) (save-excursion (end-of-line arg) (point))))) |
55822 | 120 |
74181
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
121 (defun flymake-posn-at-point-as-event (&optional position window dx dy) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
122 "Return pixel position of top left corner of glyph at POSITION, |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
123 relative to top left corner of WINDOW, as a mouse-1 click |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
124 event (identical to the event that would be triggered by clicking |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
125 mouse button 1 at the top left corner of the glyph). |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
126 |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
127 POSITION and WINDOW default to the position of point in the |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
128 selected window. |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
129 |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
130 DX and DY specify optional offsets from the top left of the glyph." |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
131 (unless window (setq window (selected-window))) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
132 (unless position (setq position (window-point window))) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
133 (unless dx (setq dx 0)) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
134 (unless dy (setq dy 0)) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
135 |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
136 (let* ((pos (posn-at-point position window)) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
137 (x-y (posn-x-y pos)) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
138 (edges (window-inside-pixel-edges window)) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
139 (win-x-y (window-pixel-edges window))) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
140 ;; adjust for window edges |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
141 (setcar (nthcdr 2 pos) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
142 (cons (+ (car x-y) (car edges) (- (car win-x-y)) dx) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
143 (+ (cdr x-y) (cadr edges) (- (cadr win-x-y)) dy))) |
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
144 (list 'mouse-1 pos))) |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
145 |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
146 (defun flymake-popup-menu (menu-data) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
147 "Pop up the flymake menu at point, using the data MENU-DATA. |
61943 | 148 POS is a list of the form ((X Y) WINDOW), where X and Y are |
149 pixels positions from the top left corner of WINDOW's frame. | |
150 MENU-DATA is a list of error and warning messages returned by | |
151 `flymake-make-err-menu-data'." | |
152 (if (featurep 'xemacs) | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
153 (let* ((pos (flymake-get-point-pixel-pos)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
154 (x-pos (nth 0 pos)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
155 (y-pos (nth 1 pos)) |
58561 | 156 (fake-event-props '(button 1 x 1 y 1))) |
157 (setq fake-event-props (plist-put fake-event-props 'x x-pos)) | |
158 (setq fake-event-props (plist-put fake-event-props 'y y-pos)) | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
159 (popup-menu (flymake-make-xemacs-menu menu-data) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
160 (make-event 'button-press fake-event-props))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
161 (x-popup-menu (if (eval-when-compile (fboundp 'posn-at-point)) |
74181
88e41fa55ec2
(flymake-posn-at-point-as-event): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
73380
diff
changeset
|
162 (flymake-posn-at-point-as-event) |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
163 (list (flymake-get-point-pixel-pos) (selected-window))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
164 (flymake-make-emacs-menu menu-data)))) |
55822 | 165 |
58515 | 166 (defun flymake-make-emacs-menu (menu-data) |
61943 | 167 "Return a menu specifier using MENU-DATA. |
168 MENU-DATA is a list of error and warning messages returned by | |
169 `flymake-make-err-menu-data'. | |
170 See `x-popup-menu' for the menu specifier format." | |
58515 | 171 (let* ((menu-title (nth 0 menu-data)) |
172 (menu-items (nth 1 menu-data)) | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
173 (menu-commands (mapcar (lambda (foo) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
174 (cons (nth 0 foo) (nth 1 foo))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
175 menu-items))) |
58515 | 176 (list menu-title (cons "" menu-commands)))) |
55822 | 177 |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
178 (if (featurep 'xemacs) (progn |
55822 | 179 |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
180 (defun flymake-nop ()) |
58561 | 181 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
182 (defun flymake-make-xemacs-menu (menu-data) |
61943 | 183 "Return a menu specifier using MENU-DATA." |
58515 | 184 (let* ((menu-title (nth 0 menu-data)) |
185 (menu-items (nth 1 menu-data)) | |
186 (menu-commands nil)) | |
187 (setq menu-commands (mapcar (lambda (foo) | |
188 (vector (nth 0 foo) (or (nth 1 foo) '(flymake-nop)) t)) | |
189 menu-items)) | |
190 (cons menu-title menu-commands))) | |
55822 | 191 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
192 )) ;; xemacs |
55822 | 193 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
194 (unless (eval-when-compile (fboundp 'posn-at-point)) |
58561 | 195 |
58515 | 196 (defun flymake-current-row () |
197 "Return current row number in current frame." | |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
198 (if (fboundp 'window-edges) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
199 (+ (car (cdr (window-edges))) (count-lines (window-start) (point))) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
200 (count-lines (window-start) (point)))) |
55822 | 201 |
58515 | 202 (defun flymake-selected-frame () |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
203 (if (fboundp 'window-edges) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
204 (selected-frame) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
205 (selected-window))) |
55822 | 206 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
207 (defun flymake-get-point-pixel-pos () |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
208 "Return point position in pixels: (x, y)." |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
209 (let ((mouse-pos (mouse-position)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
210 (pixel-pos nil) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
211 (ret nil)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
212 (if (car (cdr mouse-pos)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
213 (progn |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
214 (set-mouse-position (flymake-selected-frame) (current-column) (flymake-current-row)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
215 (setq pixel-pos (mouse-pixel-position)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
216 (set-mouse-position (car mouse-pos) (car (cdr mouse-pos)) (cdr (cdr mouse-pos))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
217 (setq ret (list (car (cdr pixel-pos)) (cdr (cdr pixel-pos))))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
218 (progn |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
219 (setq ret '(0 0)))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
220 (flymake-log 3 "mouse pos is %s" ret) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
221 ret)) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
222 |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
223 ) ;; End of (unless (fboundp 'posn-at-point) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
224 |
55822 | 225 ;;;; ]] |
226 | |
227 (defcustom flymake-log-level -1 | |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
228 "Logging level, only messages with level lower or equal will be logged. |
55822 | 229 -1 = NONE, 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG" |
58515 | 230 :group 'flymake |
231 :type 'integer) | |
55822 | 232 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
233 (defun flymake-log (level text &rest args) |
61943 | 234 "Log a message at level LEVEL. |
235 If LEVEL is higher than `flymake-log-level', the message is | |
236 ignored. Otherwise, it is printed using `message'. | |
237 TEXT is a format control string, and the remaining arguments ARGS | |
238 are the string substitutions (see `format')." | |
58515 | 239 (if (<= level flymake-log-level) |
240 (let* ((msg (apply 'format text args))) | |
65584
6dbba0bd58df
Message format fixes, commit no. 3
Deepak Goel <deego@gnufans.org>
parents:
65382
diff
changeset
|
241 (message "%s" msg) |
58515 | 242 ;;(with-temp-buffer |
243 ;; (insert msg) | |
244 ;; (insert "\n") | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
245 ;; (flymake-save-buffer-in-file "d:/flymake.log" t) ; make log file name customizable |
58515 | 246 ;;) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
247 ))) |
55822 | 248 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
249 (defun flymake-ins-after (list pos val) |
58515 | 250 "Insert VAL into LIST after position POS." |
251 (let ((tmp (copy-sequence list))) ; (???) | |
252 (setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp))) | |
253 tmp)) | |
55822 | 254 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
255 (defun flymake-set-at (list pos val) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
256 "Set VAL at position POS in LIST." |
58515 | 257 (let ((tmp (copy-sequence list))) ; (???) |
258 (setcar (nthcdr pos tmp) val) | |
259 tmp)) | |
55822 | 260 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
261 (defvar flymake-processes nil |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
262 "List of currently active flymake processes.") |
55822 | 263 |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
264 (defvar flymake-output-residual nil) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
265 |
55822 | 266 (make-variable-buffer-local 'flymake-output-residual) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
267 |
58515 | 268 (defcustom flymake-allowed-file-name-masks |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
269 '(("\\.c\\'" flymake-simple-make-init) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
270 ("\\.cpp\\'" flymake-simple-make-init) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
271 ("\\.xml\\'" flymake-xml-init) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
272 ("\\.html?\\'" flymake-xml-init) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
273 ("\\.cs\\'" flymake-simple-make-init) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
274 ("\\.pl\\'" flymake-perl-init) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
275 ("\\.h\\'" flymake-master-make-header-init flymake-master-cleanup) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
276 ("\\.java\\'" flymake-simple-make-java-init flymake-simple-java-cleanup) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
277 ("[0-9]+\\.tex\\'" flymake-master-tex-init flymake-master-cleanup) |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
278 ("\\.tex\\'" flymake-simple-tex-init) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
279 ("\\.idl\\'" flymake-simple-make-init) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
280 ;; ("\\.cpp\\'" 1) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
281 ;; ("\\.java\\'" 3) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
282 ;; ("\\.h\\'" 2 ("\\.cpp\\'" "\\.c\\'") |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
283 ;; ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2)) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
284 ;; ("\\.idl\\'" 1) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
285 ;; ("\\.odl\\'" 1) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
286 ;; ("[0-9]+\\.tex\\'" 2 ("\\.tex\\'") |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
287 ;; ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 )) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
288 ;; ("\\.tex\\'" 1) |
58515 | 289 ) |
290 "*Files syntax checking is allowed for." | |
291 :group 'flymake | |
292 :type '(repeat (string symbol symbol symbol))) | |
55822 | 293 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
294 (defun flymake-get-file-name-mode-and-masks (file-name) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
295 "Return the corresponding entry from `flymake-allowed-file-name-masks'." |
58515 | 296 (unless (stringp file-name) |
297 (error "Invalid file-name")) | |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
298 (let ((fnm flymake-allowed-file-name-masks) |
58515 | 299 (mode-and-masks nil)) |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
300 (while (and (not mode-and-masks) fnm) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
301 (if (string-match (car (car fnm)) file-name) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
302 (setq mode-and-masks (cdr (car fnm)))) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
303 (setq fnm (cdr fnm))) |
58515 | 304 (flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks)) |
305 mode-and-masks)) | |
55822 | 306 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
307 (defun flymake-can-syntax-check-file (file-name) |
58515 | 308 "Determine whether we can syntax check FILE-NAME. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
309 Return nil if we cannot, non-nil if we can." |
58515 | 310 (if (flymake-get-init-function file-name) t nil)) |
55822 | 311 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
312 (defun flymake-get-init-function (file-name) |
58515 | 313 "Return init function to be used for the file." |
314 (let* ((init-f (nth 0 (flymake-get-file-name-mode-and-masks file-name)))) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
315 ;;(flymake-log 0 "calling %s" init-f) |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
316 ;;(funcall init-f (current-buffer)) |
58515 | 317 init-f)) |
55822 | 318 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
319 (defun flymake-get-cleanup-function (file-name) |
58515 | 320 "Return cleanup function to be used for the file." |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
321 (or (nth 1 (flymake-get-file-name-mode-and-masks file-name)) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
322 'flymake-simple-cleanup)) |
55822 | 323 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
324 (defun flymake-get-real-file-name-function (file-name) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
325 (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
326 'flymake-get-real-file-name)) |
55822 | 327 |
328 (defcustom flymake-buildfile-dirs '("." ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../.." "../../../../../../.." "../../../../../../../.." "../../../../../../../../.." "../../../../../../../../../.." "../../../../../../../../../../..") | |
58515 | 329 "Dirs to look for buildfile." |
330 :group 'flymake | |
331 :type '(repeat (string))) | |
55822 | 332 |
333 (defvar flymake-find-buildfile-cache (flymake-makehash 'equal)) | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
334 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
335 (defun flymake-get-buildfile-from-cache (dir-name) |
58515 | 336 (gethash dir-name flymake-find-buildfile-cache)) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
337 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
338 (defun flymake-add-buildfile-to-cache (dir-name buildfile) |
58515 | 339 (puthash dir-name buildfile flymake-find-buildfile-cache)) |
55822 | 340 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
341 (defun flymake-clear-buildfile-cache () |
58515 | 342 (clrhash flymake-find-buildfile-cache)) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
343 |
68113
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
344 (defun flymake-find-buildfile (buildfile-name source-dir-name) |
58515 | 345 "Find buildfile starting from current directory. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
346 Buildfile includes Makefile, build.xml etc. |
58515 | 347 Return its file name if found, or nil if not found." |
68113
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
348 (or (flymake-get-buildfile-from-cache source-dir-name) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
349 (let* ((dirs flymake-buildfile-dirs) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
350 (buildfile-dir nil) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
351 (found nil)) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
352 (while (and (not found) dirs) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
353 (setq buildfile-dir (concat source-dir-name (car dirs))) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
354 (when (file-exists-p (expand-file-name buildfile-name buildfile-dir)) |
68113
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
355 (setq found t)) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
356 (setq dirs (cdr dirs))) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
357 (if found |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
358 (progn |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
359 (flymake-log 3 "found buildfile at %s/%s" buildfile-dir buildfile-name) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
360 (flymake-add-buildfile-to-cache source-dir-name buildfile-dir) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
361 buildfile-dir) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
362 (progn |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
363 (flymake-log 3 "buildfile for %s not found" source-dir-name) |
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
364 nil))))) |
55822 | 365 |
58515 | 366 (defun flymake-fix-file-name (name) |
68933
88689f411bd6
(flymake-fix-file-name): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68122
diff
changeset
|
367 "Replace all occurrences of '\' with '/'." |
58515 | 368 (when name |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
369 (setq name (expand-file-name name)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
370 (setq name (abbreviate-file-name name)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
371 (setq name (directory-file-name name)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
372 name)) |
55822 | 373 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
374 (defun flymake-same-files (file-name-one file-name-two) |
58515 | 375 "Check if FILE-NAME-ONE and FILE-NAME-TWO point to same file. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
376 Return t if so, nil if not." |
58515 | 377 (equal (flymake-fix-file-name file-name-one) |
378 (flymake-fix-file-name file-name-two))) | |
55822 | 379 |
380 (defcustom flymake-master-file-dirs '("." "./src" "./UnitTest") | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
381 "Dirs where to look for master files." |
58515 | 382 :group 'flymake |
383 :type '(repeat (string))) | |
55822 | 384 |
385 (defcustom flymake-master-file-count-limit 32 | |
58515 | 386 "Max number of master files to check." |
387 :group 'flymake | |
388 :type 'integer) | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
389 |
58561 | 390 ;; This is bound dynamically to pass a parameter to a sort predicate below |
391 (defvar flymake-included-file-name) | |
55822 | 392 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
393 (defun flymake-find-possible-master-files (file-name master-file-dirs masks) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
394 "Find (by name and location) all possible master files. |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
395 Master files are .cpp and .c for and .h. Files are searched for |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
396 starting from the .h directory and max max-level parent dirs. |
55822 | 397 File contents are not checked." |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
398 (let* ((dirs master-file-dirs) |
58515 | 399 (files nil) |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
400 (done nil)) |
55822 | 401 |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
402 (while (and (not done) dirs) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
403 (let* ((dir (expand-file-name (car dirs) (file-name-directory file-name))) |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
404 (masks masks)) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
405 (while (and (file-exists-p dir) (not done) masks) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
406 (let* ((mask (car masks)) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
407 (dir-files (directory-files dir t mask))) |
55822 | 408 |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
409 (flymake-log 3 "dir %s, %d file(s) for mask %s" |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
410 dir (length dir-files) mask) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
411 (while (and (not done) dir-files) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
412 (when (not (file-directory-p (car dir-files))) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
413 (setq files (cons (car dir-files) files)) |
58515 | 414 (when (>= (length files) flymake-master-file-count-limit) |
415 (flymake-log 3 "master file count limit (%d) reached" flymake-master-file-count-limit) | |
416 (setq done t))) | |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
417 (setq dir-files (cdr dir-files)))) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
418 (setq masks (cdr masks)))) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
419 (setq dirs (cdr dirs))) |
58515 | 420 (when files |
58561 | 421 (let ((flymake-included-file-name (file-name-nondirectory file-name))) |
422 (setq files (sort files 'flymake-master-file-compare)))) | |
58515 | 423 (flymake-log 3 "found %d possible master file(s)" (length files)) |
424 files)) | |
55822 | 425 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
426 (defun flymake-master-file-compare (file-one file-two) |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
427 "Compare two files specified by FILE-ONE and FILE-TWO. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
428 This function is used in sort to move most possible file names |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
429 to the beginning of the list (File.h -> File.cpp moved to top)." |
58515 | 430 (and (equal (file-name-sans-extension flymake-included-file-name) |
431 (file-name-sans-extension (file-name-nondirectory file-one))) | |
432 (not (equal file-one file-two)))) | |
55822 | 433 |
434 (defcustom flymake-check-file-limit 8192 | |
58515 | 435 "Max number of chars to look at when checking possible master file." |
436 :group 'flymake | |
437 :type 'integer) | |
55822 | 438 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
439 (defun flymake-check-patch-master-file-buffer |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
440 (master-file-temp-buffer |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
441 master-file-name patched-master-file-name |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
442 source-file-name patched-source-file-name |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
443 include-dirs regexp) |
58515 | 444 "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
445 For .cpp master file this means it includes SOURCE-FILE-NAME (.h). |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
446 If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
447 instead of SOURCE-FILE-NAME. |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
448 Whether a buffer for MATER-FILE-NAME exists, use it as a source |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
449 instead of reading master file from disk." |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
450 (let* ((source-file-nondir (file-name-nondirectory source-file-name)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
451 (found nil) |
58515 | 452 (inc-name nil) |
453 (search-limit flymake-check-file-limit)) | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
454 (setq regexp |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
455 (format regexp ; "[ \t]*#[ \t]*include[ \t]*\"\\(.*%s\\)\"" |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
456 (regexp-quote source-file-nondir))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
457 (unwind-protect |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
458 (with-current-buffer master-file-temp-buffer |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
459 (when (> search-limit (point-max)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
460 (setq search-limit (point-max))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
461 (flymake-log 3 "checking %s against regexp %s" |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
462 master-file-name regexp) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
463 (goto-char (point-min)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
464 (while (and (< (point) search-limit) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
465 (re-search-forward regexp search-limit t)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
466 (let ((match-beg (match-beginning 1)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
467 (match-end (match-end 1))) |
55822 | 468 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
469 (flymake-log 3 "found possible match for %s" source-file-nondir) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
470 (setq inc-name (match-string 1)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
471 (when (eq t (compare-strings |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
472 source-file-nondir nil nil |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
473 inc-name (- (length inc-name) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
474 (length source-file-nondir)) nil)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
475 (flymake-log 3 "inc-name=%s" inc-name) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
476 (when (flymake-check-include source-file-name inc-name |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
477 include-dirs) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
478 (setq found t) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
479 ;; replace-match is not used here as it fails in |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
480 ;; XEmacs with 'last match not a buffer' error as |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
481 ;; check-includes calls replace-in-string |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
482 (flymake-replace-region |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
483 match-beg match-end |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
484 (file-name-nondirectory patched-source-file-name)))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
485 (forward-line 1))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
486 (when found |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
487 (flymake-save-buffer-in-file patched-master-file-name))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
488 ;;+(flymake-log 3 "killing buffer %s" |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
489 ;; (buffer-name master-file-temp-buffer)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
490 (kill-buffer master-file-temp-buffer)) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
491 ;;+(flymake-log 3 "check-patch master file %s: %s" master-file-name found) |
58515 | 492 (when found |
493 (flymake-log 2 "found master file %s" master-file-name)) | |
494 found)) | |
55822 | 495 |
60905
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
496 (defun flymake-replace-region (beg end rep) |
58515 | 497 "Replace text in BUFFER in region (BEG END) with REP." |
498 (save-excursion | |
60905
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
499 (goto-char end) |
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
500 ;; Insert before deleting, so as to better preserve markers's positions. |
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
501 (insert rep) |
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
502 (delete-region beg end))) |
55822 | 503 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
504 (defun flymake-read-file-to-temp-buffer (file-name) |
58515 | 505 "Insert contents of FILE-NAME into newly created temp buffer." |
506 (let* ((temp-buffer (get-buffer-create (generate-new-buffer-name (concat "flymake:" (file-name-nondirectory file-name)))))) | |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
507 (with-current-buffer temp-buffer |
58515 | 508 (insert-file-contents file-name)) |
509 temp-buffer)) | |
55822 | 510 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
511 (defun flymake-copy-buffer-to-temp-buffer (buffer) |
58515 | 512 "Copy contents of BUFFER into newly created temp buffer." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
513 (with-current-buffer |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
514 (get-buffer-create (generate-new-buffer-name |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
515 (concat "flymake:" (buffer-name buffer)))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
516 (insert-buffer-substring buffer) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
517 (current-buffer))) |
55822 | 518 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
519 (defun flymake-check-include (source-file-name inc-name include-dirs) |
58515 | 520 "Check if SOURCE-FILE-NAME can be found in include path. |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
521 Return t if it can be found via include path using INC-NAME." |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
522 (if (file-name-absolute-p inc-name) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
523 (flymake-same-files source-file-name inc-name) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
524 (while (and include-dirs |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
525 (not (flymake-same-files |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
526 source-file-name |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
527 (concat (file-name-directory source-file-name) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
528 "/" (car include-dirs) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
529 "/" inc-name)))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
530 (setq include-dirs (cdr include-dirs))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
531 include-dirs)) |
55822 | 532 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
533 (defun flymake-find-buffer-for-file (file-name) |
58515 | 534 "Check if there exists a buffer visiting FILE-NAME. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
535 Return t if so, nil if not." |
58515 | 536 (let ((buffer-name (get-file-buffer file-name))) |
537 (if buffer-name | |
538 (get-buffer buffer-name)))) | |
55822 | 539 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
540 (defun flymake-create-master-file (source-file-name patched-source-file-name get-incl-dirs-f create-temp-f masks include-regexp) |
58515 | 541 "Save SOURCE-FILE-NAME with a different name. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
542 Find master file, patch and save it." |
58515 | 543 (let* ((possible-master-files (flymake-find-possible-master-files source-file-name flymake-master-file-dirs masks)) |
544 (master-file-count (length possible-master-files)) | |
545 (idx 0) | |
546 (temp-buffer nil) | |
547 (master-file-name nil) | |
548 (patched-master-file-name nil) | |
549 (found nil)) | |
55822 | 550 |
58515 | 551 (while (and (not found) (< idx master-file-count)) |
552 (setq master-file-name (nth idx possible-master-files)) | |
553 (setq patched-master-file-name (funcall create-temp-f master-file-name "flymake_master")) | |
554 (if (flymake-find-buffer-for-file master-file-name) | |
555 (setq temp-buffer (flymake-copy-buffer-to-temp-buffer (flymake-find-buffer-for-file master-file-name))) | |
556 (setq temp-buffer (flymake-read-file-to-temp-buffer master-file-name))) | |
557 (setq found | |
558 (flymake-check-patch-master-file-buffer | |
559 temp-buffer | |
560 master-file-name | |
561 patched-master-file-name | |
562 source-file-name | |
563 patched-source-file-name | |
564 (funcall get-incl-dirs-f (file-name-directory master-file-name)) | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
565 include-regexp)) |
58515 | 566 (setq idx (1+ idx))) |
567 (if found | |
568 (list master-file-name patched-master-file-name) | |
569 (progn | |
570 (flymake-log 3 "none of %d master file(s) checked includes %s" master-file-count | |
571 (file-name-nondirectory source-file-name)) | |
572 nil)))) | |
55822 | 573 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
574 (defun flymake-save-buffer-in-file (file-name) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
575 (save-restriction |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
576 (widen) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
577 (make-directory (file-name-directory file-name) 1) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
578 (write-region (point-min) (point-max) file-name nil 566)) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
579 (flymake-log 3 "saved buffer %s in file %s" (buffer-name) file-name)) |
55822 | 580 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
581 (defun flymake-save-string-to-file (file-name data) |
58515 | 582 "Save string DATA to file FILE-NAME." |
583 (write-region data nil file-name nil 566)) | |
55822 | 584 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
585 (defun flymake-read-file-to-string (file-name) |
58515 | 586 "Read contents of file FILE-NAME and return as a string." |
587 (with-temp-buffer | |
588 (insert-file-contents file-name) | |
589 (buffer-substring (point-min) (point-max)))) | |
55822 | 590 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
591 (defun flymake-process-filter (process output) |
58515 | 592 "Parse OUTPUT and highlight error lines. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
593 It's flymake process filter." |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
594 (let ((source-buffer (process-buffer process))) |
55822 | 595 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
596 (flymake-log 3 "received %d byte(s) of output from process %d" |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
597 (length output) (process-id process)) |
58515 | 598 (when source-buffer |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
599 (with-current-buffer source-buffer |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
600 (flymake-parse-output-and-residual output))))) |
55822 | 601 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
602 (defun flymake-process-sentinel (process event) |
58515 | 603 "Sentinel for syntax check buffers." |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
604 (when (memq (process-status process) '(signal exit)) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
605 (let* ((exit-status (process-exit-status process)) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
606 (command (process-command process)) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
607 (source-buffer (process-buffer process)) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
608 (cleanup-f (flymake-get-cleanup-function (buffer-file-name source-buffer)))) |
55822 | 609 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
610 (flymake-log 2 "process %d exited with code %d" |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
611 (process-id process) exit-status) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
612 (condition-case err |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
613 (progn |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
614 (flymake-log 3 "cleaning up using %s" cleanup-f) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
615 (when (buffer-live-p source-buffer) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
616 (with-current-buffer source-buffer |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
617 (funcall cleanup-f))) |
55822 | 618 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
619 (delete-process process) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
620 (setq flymake-processes (delq process flymake-processes)) |
55822 | 621 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
622 (when (buffer-live-p source-buffer) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
623 (with-current-buffer source-buffer |
55822 | 624 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
625 (flymake-parse-residual) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
626 (flymake-post-syntax-check exit-status command) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
627 (setq flymake-is-running nil)))) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
628 (error |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
629 (let ((err-str (format "Error in process sentinel for buffer %s: %s" |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
630 source-buffer (error-message-string err)))) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
631 (flymake-log 0 err-str) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
632 (with-current-buffer source-buffer |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
633 (setq flymake-is-running nil)))))))) |
55822 | 634 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
635 (defun flymake-post-syntax-check (exit-status command) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
636 (setq flymake-err-info flymake-new-err-info) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
637 (setq flymake-new-err-info nil) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
638 (setq flymake-err-info |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
639 (flymake-fix-line-numbers |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
640 flymake-err-info 1 (flymake-count-lines))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
641 (flymake-delete-own-overlays) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
642 (flymake-highlight-err-lines flymake-err-info) |
61943 | 643 (let (err-count warn-count) |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
644 (setq err-count (flymake-get-err-count flymake-err-info "e")) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
645 (setq warn-count (flymake-get-err-count flymake-err-info "w")) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
646 (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
647 (buffer-name) err-count warn-count |
61943 | 648 (- (flymake-float-time) flymake-check-start-time)) |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
649 (setq flymake-check-start-time nil) |
55822 | 650 |
58515 | 651 (if (and (equal 0 err-count) (equal 0 warn-count)) |
652 (if (equal 0 exit-status) | |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
653 (flymake-report-status "" "") ; PASSED |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
654 (if (not flymake-check-was-interrupted) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
655 (flymake-report-fatal-status "CFGERR" |
58515 | 656 (format "Configuration error has occured while running %s" command)) |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
657 (flymake-report-status nil ""))) ; "STOPPED" |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
658 (flymake-report-status (format "%d/%d" err-count warn-count) "")))) |
55822 | 659 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
660 (defun flymake-parse-output-and-residual (output) |
58515 | 661 "Split OUTPUT into lines, merge in residual if necessary." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
662 (let* ((buffer-residual flymake-output-residual) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
663 (total-output (if buffer-residual (concat buffer-residual output) output)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
664 (lines-and-residual (flymake-split-output total-output)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
665 (lines (nth 0 lines-and-residual)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
666 (new-residual (nth 1 lines-and-residual))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
667 (setq flymake-output-residual new-residual) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
668 (setq flymake-new-err-info |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
669 (flymake-parse-err-lines |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
670 flymake-new-err-info lines)))) |
55822 | 671 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
672 (defun flymake-parse-residual () |
58515 | 673 "Parse residual if it's non empty." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
674 (when flymake-output-residual |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
675 (setq flymake-new-err-info |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
676 (flymake-parse-err-lines |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
677 flymake-new-err-info |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
678 (list flymake-output-residual))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
679 (setq flymake-output-residual nil))) |
55822 | 680 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
681 (defun flymake-er-make-er (line-no line-err-info-list) |
58515 | 682 (list line-no line-err-info-list)) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
683 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
684 (defun flymake-er-get-line (err-info) |
58515 | 685 (nth 0 err-info)) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
686 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
687 (defun flymake-er-get-line-err-info-list (err-info) |
58515 | 688 (nth 1 err-info)) |
55822 | 689 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
690 (defstruct (flymake-ler |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
691 (:constructor nil) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
692 (:constructor flymake-ler-make-ler (file line type text &optional full-file))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
693 file line type text full-file) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
694 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
695 (defun flymake-ler-set-file (line-err-info file) |
58515 | 696 (flymake-ler-make-ler file |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
697 (flymake-ler-line line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
698 (flymake-ler-type line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
699 (flymake-ler-text line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
700 (flymake-ler-full-file line-err-info))) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
701 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
702 (defun flymake-ler-set-full-file (line-err-info full-file) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
703 (flymake-ler-make-ler (flymake-ler-file line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
704 (flymake-ler-line line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
705 (flymake-ler-type line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
706 (flymake-ler-text line-err-info) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
707 full-file)) |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
708 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
709 (defun flymake-ler-set-line (line-err-info line) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
710 (flymake-ler-make-ler (flymake-ler-file line-err-info) |
55822 | 711 line |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
712 (flymake-ler-type line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
713 (flymake-ler-text line-err-info) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
714 (flymake-ler-full-file line-err-info))) |
55822 | 715 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
716 (defun flymake-get-line-err-count (line-err-info-list type) |
58515 | 717 "Return number of errors of specified TYPE. |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
718 Value of TYPE is either \"e\" or \"w\"." |
58515 | 719 (let* ((idx 0) |
720 (count (length line-err-info-list)) | |
721 (err-count 0)) | |
55822 | 722 |
58515 | 723 (while (< idx count) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
724 (when (equal type (flymake-ler-type (nth idx line-err-info-list))) |
58515 | 725 (setq err-count (1+ err-count))) |
726 (setq idx (1+ idx))) | |
727 err-count)) | |
55822 | 728 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
729 (defun flymake-get-err-count (err-info-list type) |
58515 | 730 "Return number of errors of specified TYPE for ERR-INFO-LIST." |
731 (let* ((idx 0) | |
732 (count (length err-info-list)) | |
733 (err-count 0)) | |
734 (while (< idx count) | |
735 (setq err-count (+ err-count (flymake-get-line-err-count (nth 1 (nth idx err-info-list)) type))) | |
736 (setq idx (1+ idx))) | |
737 err-count)) | |
55822 | 738 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
739 (defun flymake-fix-line-numbers (err-info-list min-line max-line) |
58515 | 740 "Replace line numbers with fixed value. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
741 If line-numbers is less than MIN-LINE, set line numbers to MIN-LINE. |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
742 If line numbers is greater than MAX-LINE, set line numbers to MAX-LINE. |
58561 | 743 The reason for this fix is because some compilers might report |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
744 line number outside the file being compiled." |
58515 | 745 (let* ((count (length err-info-list)) |
746 (err-info nil) | |
747 (line 0)) | |
748 (while (> count 0) | |
749 (setq err-info (nth (1- count) err-info-list)) | |
750 (setq line (flymake-er-get-line err-info)) | |
751 (when (or (< line min-line) (> line max-line)) | |
752 (setq line (if (< line min-line) min-line max-line)) | |
753 (setq err-info-list (flymake-set-at err-info-list (1- count) | |
754 (flymake-er-make-er line | |
755 (flymake-er-get-line-err-info-list err-info))))) | |
756 (setq count (1- count)))) | |
757 err-info-list) | |
55822 | 758 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
759 (defun flymake-highlight-err-lines (err-info-list) |
58515 | 760 "Highlight error lines in BUFFER using info from ERR-INFO-LIST." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
761 (save-excursion |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
762 (dolist (err err-info-list) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
763 (flymake-highlight-line (car err) (nth 1 err))))) |
55822 | 764 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
765 (defun flymake-overlay-p (ov) |
58515 | 766 "Determine whether overlay OV was created by flymake." |
767 (and (overlayp ov) (overlay-get ov 'flymake-overlay))) | |
55822 | 768 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
769 (defun flymake-make-overlay (beg end tooltip-text face mouse-face) |
58515 | 770 "Allocate a flymake overlay in range BEG and END." |
771 (when (not (flymake-region-has-flymake-overlays beg end)) | |
772 (let ((ov (make-overlay beg end nil t t))) | |
773 (overlay-put ov 'face face) | |
774 (overlay-put ov 'mouse-face mouse-face) | |
775 (overlay-put ov 'help-echo tooltip-text) | |
776 (overlay-put ov 'flymake-overlay t) | |
777 (overlay-put ov 'priority 100) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
778 ;;+(flymake-log 3 "created overlay %s" ov) |
58515 | 779 ov) |
780 (flymake-log 3 "created an overlay at (%d-%d)" beg end))) | |
55822 | 781 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
782 (defun flymake-delete-own-overlays () |
58515 | 783 "Delete all flymake overlays in BUFFER." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
784 (dolist (ol (overlays-in (point-min) (point-max))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
785 (when (flymake-overlay-p ol) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
786 (delete-overlay ol) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
787 ;;+(flymake-log 3 "deleted overlay %s" ol) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
788 ))) |
55822 | 789 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
790 (defun flymake-region-has-flymake-overlays (beg end) |
58515 | 791 "Check if region specified by BEG and END has overlay. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
792 Return t if it has at least one flymake overlay, nil if no overlay." |
58515 | 793 (let ((ov (overlays-in beg end)) |
794 (has-flymake-overlays nil)) | |
795 (while (consp ov) | |
796 (when (flymake-overlay-p (car ov)) | |
797 (setq has-flymake-overlays t)) | |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
798 (setq ov (cdr ov))) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
799 has-flymake-overlays)) |
55822 | 800 |
63449
d6d67f85ab76
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Miles Bader <miles@gnu.org>
parents:
63402
diff
changeset
|
801 (defface flymake-errline |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
802 ;;+ '((((class color)) (:foreground "OrangeRed" :bold t :underline t)) |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
803 ;;+ '((((class color)) (:underline "OrangeRed")) |
58515 | 804 '((((class color)) (:background "LightPink")) |
805 (t (:bold t))) | |
806 "Face used for marking error lines." | |
807 :group 'flymake) | |
55822 | 808 |
63449
d6d67f85ab76
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Miles Bader <miles@gnu.org>
parents:
63402
diff
changeset
|
809 (defface flymake-warnline |
58515 | 810 '((((class color)) (:background "LightBlue2")) |
811 (t (:bold t))) | |
812 "Face used for marking warning lines." | |
813 :group 'flymake) | |
55822 | 814 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
815 (defun flymake-highlight-line (line-no line-err-info-list) |
58515 | 816 "Highlight line LINE-NO in current buffer. |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
817 Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting." |
58515 | 818 (goto-line line-no) |
819 (let* ((line-beg (flymake-line-beginning-position)) | |
820 (line-end (flymake-line-end-position)) | |
821 (beg line-beg) | |
822 (end line-end) | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
823 (tooltip-text (flymake-ler-text (nth 0 line-err-info-list))) |
58515 | 824 (face nil)) |
55822 | 825 |
58515 | 826 (goto-char line-beg) |
827 (while (looking-at "[ \t]") | |
828 (forward-char)) | |
55822 | 829 |
58515 | 830 (setq beg (point)) |
55822 | 831 |
58515 | 832 (goto-char line-end) |
833 (while (and (looking-at "[ \t\r\n]") (> (point) 1)) | |
834 (backward-char)) | |
55822 | 835 |
58515 | 836 (setq end (1+ (point))) |
55822 | 837 |
58515 | 838 (when (<= end beg) |
839 (setq beg line-beg) | |
840 (setq end line-end)) | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
841 |
58515 | 842 (when (= end beg) |
843 (goto-char end) | |
844 (forward-line) | |
845 (setq end (point))) | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
846 |
58515 | 847 (if (> (flymake-get-line-err-count line-err-info-list "e") 0) |
63449
d6d67f85ab76
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Miles Bader <miles@gnu.org>
parents:
63402
diff
changeset
|
848 (setq face 'flymake-errline) |
d6d67f85ab76
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Miles Bader <miles@gnu.org>
parents:
63402
diff
changeset
|
849 (setq face 'flymake-warnline)) |
55822 | 850 |
58515 | 851 (flymake-make-overlay beg end tooltip-text face nil))) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
852 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
853 (defun flymake-parse-err-lines (err-info-list lines) |
58515 | 854 "Parse err LINES, store info in ERR-INFO-LIST." |
855 (let* ((count (length lines)) | |
856 (idx 0) | |
857 (line-err-info nil) | |
858 (real-file-name nil) | |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
859 (source-file-name buffer-file-name) |
58515 | 860 (get-real-file-name-f (flymake-get-real-file-name-function source-file-name))) |
55822 | 861 |
58515 | 862 (while (< idx count) |
863 (setq line-err-info (flymake-parse-line (nth idx lines))) | |
864 (when line-err-info | |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
865 (setq real-file-name (funcall get-real-file-name-f |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
866 (flymake-ler-file line-err-info))) |
58515 | 867 (setq line-err-info (flymake-ler-set-full-file line-err-info real-file-name)) |
55822 | 868 |
58515 | 869 (if (flymake-same-files real-file-name source-file-name) |
870 (setq line-err-info (flymake-ler-set-file line-err-info nil)) | |
871 (setq line-err-info (flymake-ler-set-file line-err-info (file-name-nondirectory real-file-name)))) | |
55822 | 872 |
58515 | 873 (setq err-info-list (flymake-add-err-info err-info-list line-err-info))) |
874 (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no")) | |
875 (setq idx (1+ idx))) | |
876 err-info-list)) | |
55822 | 877 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
878 (defun flymake-split-output (output) |
58515 | 879 "Split OUTPUT into lines. |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
880 Return last one as residual if it does not end with newline char. |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
881 Returns ((LINES) RESIDUAL)." |
58515 | 882 (when (and output (> (length output) 0)) |
883 (let* ((lines (flymake-split-string output "[\n\r]+")) | |
884 (complete (equal "\n" (char-to-string (aref output (1- (length output)))))) | |
885 (residual nil)) | |
886 (when (not complete) | |
887 (setq residual (car (last lines))) | |
888 (setq lines (butlast lines))) | |
889 (list lines residual)))) | |
55822 | 890 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
891 (defun flymake-reformat-err-line-patterns-from-compile-el (original-list) |
58515 | 892 "Grab error line patterns from ORIGINAL-LIST in compile.el format. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
893 Convert it to flymake internal format." |
58515 | 894 (let* ((converted-list '())) |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
895 (dolist (item original-list) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
896 (setq item (cdr item)) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
897 (let ((regexp (nth 0 item)) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
898 (file (nth 1 item)) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
899 (line (nth 2 item)) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
900 (col (nth 3 item))) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
901 (if (consp file) (setq file (car file))) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
902 (if (consp line) (setq line (car line))) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
903 (if (consp col) (setq col (car col))) |
61284
fb2f8ebf304e
(flymake-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
60978
diff
changeset
|
904 |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
905 (when (not (functionp line)) |
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
906 (setq converted-list (cons (list regexp file line col) converted-list))))) |
58515 | 907 converted-list)) |
57847
4bac9c04ed9e
2004-11-2 Pavel Kobiakov <pk_at_work@yahoo.com>
Masatake YAMATO <jet@gyve.org>
parents:
57696
diff
changeset
|
908 |
65382
8cdd634706b6
Require `compile' unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
65154
diff
changeset
|
909 (require 'compile) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
910 |
58515 | 911 (defvar flymake-err-line-patterns ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text |
912 (append | |
913 '( | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
914 ;; MS Visual C++ 6.0 |
58515 | 915 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)" |
916 1 3 nil 4) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
917 ;; jikes |
58515 | 918 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)" |
919 1 3 nil 4) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
920 ;; MS midl |
58515 | 921 ("midl[ ]*:[ ]*\\(command line error .*\\)" |
922 nil nil nil 1) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
923 ;; MS C# |
58515 | 924 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+)\: \\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)" |
925 1 3 nil 4) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
926 ;; perl |
58515 | 927 ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
928 ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1) |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
929 ;; ant/javac |
78532
97bfd89475cd
(flymake-err-line-patterns): Fix infloop in javac regexp.
Richard M. Stallman <rms@gnu.org>
parents:
78234
diff
changeset
|
930 (" *\\(\\[javac\\] *\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)" |
58515 | 931 2 4 nil 5)) |
932 ;; compilation-error-regexp-alist) | |
58561 | 933 (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist)) |
76818
1878992532c8
(flymake-err-line-patterns): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
75517
diff
changeset
|
934 "Patterns for matching error/warning lines. Each pattern has the form |
1878992532c8
(flymake-err-line-patterns): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
75517
diff
changeset
|
935 \(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX). |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
936 Use `flymake-reformat-err-line-patterns-from-compile-el' to add patterns |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
937 from compile.el") |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
938 |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
939 ;;(defcustom flymake-err-line-patterns |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
940 ;; '( |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
941 ;; ; MS Visual C++ 6.0 |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
942 ;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)" |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
943 ;; 1 3 4) |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
944 ;; ; jikes |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
945 ;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\):[ \t\n]*\\(.+\\)\\)" |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
946 ;; 1 3 4)) |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
947 ;; "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)" |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
948 ;; :group 'flymake |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
949 ;; :type '(repeat (string number number number)) |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
950 ;;) |
55822 | 951 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
952 (defun flymake-parse-line (line) |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
953 "Parse LINE to see if it is an error or warning. |
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
954 Return its components if so, nil otherwise." |
58515 | 955 (let ((raw-file-name nil) |
956 (line-no 0) | |
957 (err-type "e") | |
958 (err-text nil) | |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
959 (patterns flymake-err-line-patterns) |
58515 | 960 (matched nil)) |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
961 (while (and patterns (not matched)) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
962 (when (string-match (car (car patterns)) line) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
963 (let* ((file-idx (nth 1 (car patterns))) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
964 (line-idx (nth 2 (car patterns)))) |
55822 | 965 |
58515 | 966 (setq raw-file-name (if file-idx (match-string file-idx line) nil)) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61943
diff
changeset
|
967 (setq line-no (if line-idx (string-to-number (match-string line-idx line)) 0)) |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
968 (setq err-text (if (> (length (car patterns)) 4) |
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
969 (match-string (nth 4 (car patterns)) line) |
58515 | 970 (flymake-patch-err-text (substring line (match-end 0))))) |
971 (or err-text (setq err-text "<no error text>")) | |
972 (if (and err-text (string-match "^[wW]arning" err-text)) | |
973 (setq err-type "w") | |
974 ) | |
975 (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx | |
976 raw-file-name line-no err-text) | |
977 (setq matched t))) | |
60906
9b761ddc6f4b
(flymake-get-file-name-mode-and-masks)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60905
diff
changeset
|
978 (setq patterns (cdr patterns))) |
58515 | 979 (if matched |
980 (flymake-ler-make-ler raw-file-name line-no err-type err-text) | |
981 ()))) | |
55822 | 982 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
983 (defun flymake-find-err-info (err-info-list line-no) |
58515 | 984 "Find (line-err-info-list pos) for specified LINE-NO." |
985 (if err-info-list | |
986 (let* ((line-err-info-list nil) | |
987 (pos 0) | |
988 (count (length err-info-list))) | |
55822 | 989 |
58515 | 990 (while (and (< pos count) (< (car (nth pos err-info-list)) line-no)) |
991 (setq pos (1+ pos))) | |
992 (when (and (< pos count) (equal (car (nth pos err-info-list)) line-no)) | |
993 (setq line-err-info-list (flymake-er-get-line-err-info-list (nth pos err-info-list)))) | |
994 (list line-err-info-list pos)) | |
995 '(nil 0))) | |
55822 | 996 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
997 (defun flymake-line-err-info-is-less-or-equal (line-one line-two) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
998 (or (string< (flymake-ler-type line-one) (flymake-ler-type line-two)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
999 (and (string= (flymake-ler-type line-one) (flymake-ler-type line-two)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1000 (not (flymake-ler-file line-one)) (flymake-ler-file line-two)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1001 (and (string= (flymake-ler-type line-one) (flymake-ler-type line-two)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1002 (or (and (flymake-ler-file line-one) (flymake-ler-file line-two)) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1003 (and (not (flymake-ler-file line-one)) (not (flymake-ler-file line-two))))))) |
55822 | 1004 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1005 (defun flymake-add-line-err-info (line-err-info-list line-err-info) |
61943 | 1006 "Update LINE-ERR-INFO-LIST with the error LINE-ERR-INFO. |
1007 For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'. | |
1008 The new element is inserted in the proper position, according to | |
1009 the predicate `flymake-line-err-info-is-less-or-equal'. | |
1010 The updated value of LINE-ERR-INFO-LIST is returned." | |
58515 | 1011 (if (not line-err-info-list) |
1012 (list line-err-info) | |
1013 (let* ((count (length line-err-info-list)) | |
1014 (idx 0)) | |
1015 (while (and (< idx count) (flymake-line-err-info-is-less-or-equal (nth idx line-err-info-list) line-err-info)) | |
1016 (setq idx (1+ idx))) | |
1017 (cond ((equal 0 idx) (setq line-err-info-list (cons line-err-info line-err-info-list))) | |
1018 (t (setq line-err-info-list (flymake-ins-after line-err-info-list (1- idx) line-err-info)))) | |
1019 line-err-info-list))) | |
55822 | 1020 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1021 (defun flymake-add-err-info (err-info-list line-err-info) |
61943 | 1022 "Update ERR-INFO-LIST with the error LINE-ERR-INFO, preserving sort order. |
1023 Returns the updated value of ERR-INFO-LIST. | |
1024 For the format of ERR-INFO-LIST, see `flymake-err-info'. | |
1025 For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'." | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1026 (let* ((line-no (if (flymake-ler-file line-err-info) 1 (flymake-ler-line line-err-info))) |
58515 | 1027 (info-and-pos (flymake-find-err-info err-info-list line-no)) |
1028 (exists (car info-and-pos)) | |
1029 (pos (nth 1 info-and-pos)) | |
1030 (line-err-info-list nil) | |
1031 (err-info nil)) | |
55822 | 1032 |
58515 | 1033 (if exists |
1034 (setq line-err-info-list (flymake-er-get-line-err-info-list (car (nthcdr pos err-info-list))))) | |
1035 (setq line-err-info-list (flymake-add-line-err-info line-err-info-list line-err-info)) | |
55822 | 1036 |
58515 | 1037 (setq err-info (flymake-er-make-er line-no line-err-info-list)) |
1038 (cond (exists (setq err-info-list (flymake-set-at err-info-list pos err-info))) | |
1039 ((equal 0 pos) (setq err-info-list (cons err-info err-info-list))) | |
1040 (t (setq err-info-list (flymake-ins-after err-info-list (1- pos) err-info)))) | |
1041 err-info-list)) | |
55822 | 1042 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1043 (defun flymake-get-project-include-dirs-imp (basedir) |
58515 | 1044 "Include dirs for the project current file belongs to." |
1045 (if (flymake-get-project-include-dirs-from-cache basedir) | |
1046 (progn | |
1047 (flymake-get-project-include-dirs-from-cache basedir)) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1048 ;;else |
73380
a875c440fe93
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68933
diff
changeset
|
1049 (let* ((command-line (concat "make -C " |
a875c440fe93
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68933
diff
changeset
|
1050 (shell-quote-argument basedir) |
a875c440fe93
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68933
diff
changeset
|
1051 " DUMPVARS=INCLUDE_DIRS dumpvars")) |
58515 | 1052 (output (shell-command-to-string command-line)) |
1053 (lines (flymake-split-string output "\n")) | |
1054 (count (length lines)) | |
1055 (idx 0) | |
1056 (inc-dirs nil)) | |
1057 (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines)))) | |
1058 (setq idx (1+ idx))) | |
1059 (when (< idx count) | |
1060 (let* ((inc-lines (flymake-split-string (nth idx lines) " *-I")) | |
1061 (inc-count (length inc-lines))) | |
1062 (while (> inc-count 0) | |
1063 (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines))) | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1064 (push (flymake-replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs)) |
58515 | 1065 (setq inc-count (1- inc-count))))) |
1066 (flymake-add-project-include-dirs-to-cache basedir inc-dirs) | |
1067 inc-dirs))) | |
55822 | 1068 |
1069 (defcustom flymake-get-project-include-dirs-function 'flymake-get-project-include-dirs-imp | |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
1070 "Function used to get project include dirs, one parameter: basedir name." |
58515 | 1071 :group 'flymake |
1072 :type 'function) | |
55822 | 1073 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1074 (defun flymake-get-project-include-dirs (basedir) |
58515 | 1075 (funcall flymake-get-project-include-dirs-function basedir)) |
55822 | 1076 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1077 (defun flymake-get-system-include-dirs () |
58515 | 1078 "System include dirs - from the 'INCLUDE' env setting." |
1079 (let* ((includes (getenv "INCLUDE"))) | |
1080 (if includes (flymake-split-string includes path-separator) nil))) | |
55822 | 1081 |
1082 (defvar flymake-project-include-dirs-cache (flymake-makehash 'equal)) | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1083 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1084 (defun flymake-get-project-include-dirs-from-cache (base-dir) |
58515 | 1085 (gethash base-dir flymake-project-include-dirs-cache)) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1086 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1087 (defun flymake-add-project-include-dirs-to-cache (base-dir include-dirs) |
58515 | 1088 (puthash base-dir include-dirs flymake-project-include-dirs-cache)) |
55822 | 1089 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1090 (defun flymake-clear-project-include-dirs-cache () |
58515 | 1091 (clrhash flymake-project-include-dirs-cache)) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1092 |
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1093 (defun flymake-get-include-dirs (base-dir) |
58515 | 1094 "Get dirs to use when resolving local file names." |
1095 (let* ((include-dirs (append '(".") (flymake-get-project-include-dirs base-dir) (flymake-get-system-include-dirs)))) | |
1096 include-dirs)) | |
55822 | 1097 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1098 ;; (defun flymake-restore-formatting () |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1099 ;; "Remove any formatting made by flymake." |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1100 ;; ) |
55822 | 1101 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1102 ;; (defun flymake-get-program-dir (buffer) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1103 ;; "Get dir to start program in." |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1104 ;; (unless (bufferp buffer) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1105 ;; (error "Invalid buffer")) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1106 ;; (with-current-buffer buffer |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1107 ;; default-directory)) |
55822 | 1108 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1109 (defun flymake-safe-delete-file (file-name) |
58515 | 1110 (when (and file-name (file-exists-p file-name)) |
1111 (delete-file file-name) | |
1112 (flymake-log 1 "deleted file %s" file-name))) | |
55822 | 1113 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1114 (defun flymake-safe-delete-directory (dir-name) |
58515 | 1115 (condition-case err |
1116 (progn | |
1117 (delete-directory dir-name) | |
1118 (flymake-log 1 "deleted dir %s" dir-name)) | |
1119 (error | |
1120 (flymake-log 1 "Failed to delete dir %s, error ignored" dir-name)))) | |
55822 | 1121 |
58561 | 1122 (defcustom flymake-compilation-prevents-syntax-check t |
58515 | 1123 "If non-nil, syntax check won't be started in case compilation is running." |
1124 :group 'flymake | |
1125 :type 'boolean) | |
55822 | 1126 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1127 (defun flymake-start-syntax-check () |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1128 "Start syntax checking for current buffer." |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1129 (interactive) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1130 (flymake-log 3 "flymake is running: %s" flymake-is-running) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1131 (when (and (not flymake-is-running) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1132 (flymake-can-syntax-check-file buffer-file-name)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1133 (when (or (not flymake-compilation-prevents-syntax-check) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1134 (not (flymake-compilation-is-running))) ;+ (flymake-rep-ort-status buffer "COMP") |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1135 (flymake-clear-buildfile-cache) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1136 (flymake-clear-project-include-dirs-cache) |
55822 | 1137 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1138 (setq flymake-check-was-interrupted nil) |
55822 | 1139 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1140 (let* ((source-file-name buffer-file-name) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1141 (init-f (flymake-get-init-function source-file-name)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1142 (cleanup-f (flymake-get-cleanup-function source-file-name)) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1143 (cmd-and-args (funcall init-f)) |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1144 (cmd (nth 0 cmd-and-args)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1145 (args (nth 1 cmd-and-args)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1146 (dir (nth 2 cmd-and-args))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1147 (if (not cmd-and-args) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1148 (progn |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1149 (flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name) |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1150 (funcall cleanup-f)) |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1151 (progn |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1152 (setq flymake-last-change-time nil) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1153 (flymake-start-syntax-check-process cmd args dir))))))) |
55822 | 1154 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1155 (defun flymake-start-syntax-check-process (cmd args dir) |
58515 | 1156 "Start syntax check process." |
1157 (let* ((process nil)) | |
1158 (condition-case err | |
1159 (progn | |
1160 (when dir | |
1161 (let ((default-directory dir)) | |
1162 (flymake-log 3 "starting process on dir %s" default-directory))) | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1163 (setq process (apply 'start-process "flymake-proc" (current-buffer) cmd args)) |
58515 | 1164 (set-process-sentinel process 'flymake-process-sentinel) |
1165 (set-process-filter process 'flymake-process-filter) | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1166 (push process flymake-processes) |
55822 | 1167 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1168 (setq flymake-is-running t) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1169 (setq flymake-last-change-time nil) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1170 (setq flymake-check-start-time (flymake-float-time)) |
55822 | 1171 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1172 (flymake-report-status nil "*") |
58515 | 1173 (flymake-log 2 "started process %d, command=%s, dir=%s" |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1174 (process-id process) (process-command process) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1175 default-directory) |
58515 | 1176 process) |
1177 (error | |
1178 (let* ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s" | |
1179 cmd args (error-message-string err))) | |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1180 (source-file-name buffer-file-name) |
58515 | 1181 (cleanup-f (flymake-get-cleanup-function source-file-name))) |
1182 (flymake-log 0 err-str) | |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1183 (funcall cleanup-f) |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1184 (flymake-report-fatal-status "PROCERR" err-str)))))) |
55822 | 1185 |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1186 (defun flymake-kill-process (proc) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1187 "Kill process PROC." |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1188 (kill-process proc) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1189 (let* ((buf (process-buffer proc))) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1190 (when (buffer-live-p buf) |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1191 (with-current-buffer buf |
61943 | 1192 (setq flymake-check-was-interrupted t)))) |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1193 (flymake-log 1 "killed process %d" (process-id proc))) |
55822 | 1194 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1195 (defun flymake-stop-all-syntax-checks () |
58515 | 1196 "Kill all syntax check processes." |
1197 (interactive) | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1198 (while flymake-processes |
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1199 (flymake-kill-process (pop flymake-processes)))) |
55822 | 1200 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1201 (defun flymake-compilation-is-running () |
58515 | 1202 (and (boundp 'compilation-in-progress) |
1203 compilation-in-progress)) | |
55822 | 1204 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1205 (defun flymake-compile () |
58515 | 1206 "Kill all flymake syntax checks, start compilation." |
1207 (interactive) | |
1208 (flymake-stop-all-syntax-checks) | |
1209 (call-interactively 'compile)) | |
55822 | 1210 |
1211 (defcustom flymake-no-changes-timeout 0.5 | |
58515 | 1212 "Time to wait after last change before starting compilation." |
1213 :group 'flymake | |
1214 :type 'number) | |
55822 | 1215 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1216 (defun flymake-on-timer-event (buffer) |
58515 | 1217 "Start a syntax check for buffer BUFFER if necessary." |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1218 (when (buffer-live-p buffer) |
60904
6c1fb526eda5
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60903
diff
changeset
|
1219 (with-current-buffer buffer |
61943 | 1220 (when (and (not flymake-is-running) |
1221 flymake-last-change-time | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1222 (> (- (flymake-float-time) flymake-last-change-time) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1223 flymake-no-changes-timeout)) |
61943 | 1224 |
1225 (setq flymake-last-change-time nil) | |
58515 | 1226 (flymake-log 3 "starting syntax check as more than 1 second passed since last change") |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1227 (flymake-start-syntax-check))))) |
55822 | 1228 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1229 (defun flymake-current-line-no () |
58515 | 1230 "Return number of current line in current buffer." |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1231 (count-lines (point-min) (if (eobp) (point) (1+ (point))))) |
55822 | 1232 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1233 (defun flymake-count-lines () |
58515 | 1234 "Return number of lines in buffer BUFFER." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1235 (count-lines (point-min) (point-max))) |
55822 | 1236 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1237 (defun flymake-display-err-menu-for-current-line () |
58515 | 1238 "Display a menu with errors/warnings for current line if it has errors and/or warnings." |
1239 (interactive) | |
1240 (let* ((line-no (flymake-current-line-no)) | |
61943 | 1241 (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) |
58515 | 1242 (menu-data (flymake-make-err-menu-data line-no line-err-info-list)) |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1243 (choice nil)) |
58515 | 1244 (if menu-data |
1245 (progn | |
68002
84f2196866ae
(flymake-check-start-time, flymake-check-was-interrupted, flymake-err-info)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67934
diff
changeset
|
1246 (setq choice (flymake-popup-menu menu-data)) |
58515 | 1247 (flymake-log 3 "choice=%s" choice) |
1248 (when choice | |
1249 (eval choice))) | |
1250 (flymake-log 1 "no errors for line %d" line-no)))) | |
55822 | 1251 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1252 (defun flymake-make-err-menu-data (line-no line-err-info-list) |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
1253 "Make a (menu-title (item-title item-action)*) list with errors/warnings from LINE-ERR-INFO-LIST." |
58515 | 1254 (let* ((menu-items nil)) |
1255 (when line-err-info-list | |
1256 (let* ((count (length line-err-info-list)) | |
1257 (menu-item-text nil)) | |
1258 (while (> count 0) | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1259 (setq menu-item-text (flymake-ler-text (nth (1- count) line-err-info-list))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1260 (let* ((file (flymake-ler-file (nth (1- count) line-err-info-list))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1261 (full-file (flymake-ler-full-file (nth (1- count) line-err-info-list))) |
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1262 (line (flymake-ler-line (nth (1- count) line-err-info-list)))) |
58515 | 1263 (if file |
1264 (setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")"))) | |
1265 (setq menu-items (cons (list menu-item-text | |
1266 (if file (list 'flymake-goto-file-and-line full-file line) nil)) | |
1267 menu-items))) | |
1268 (setq count (1- count))) | |
1269 (flymake-log 3 "created menu-items with %d item(s)" (length menu-items)))) | |
1270 (if menu-items | |
1271 (let* ((menu-title (format "Line %d: %d error(s), %d warning(s)" line-no | |
1272 (flymake-get-line-err-count line-err-info-list "e") | |
1273 (flymake-get-line-err-count line-err-info-list "w")))) | |
1274 (list menu-title menu-items)) | |
1275 nil))) | |
55822 | 1276 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1277 (defun flymake-goto-file-and-line (file line) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1278 "Try to get buffer for FILE and goto line LINE in it." |
58515 | 1279 (if (not (file-exists-p file)) |
1280 (flymake-log 1 "file %s does not exists" file) | |
1281 (progn | |
1282 (find-file file) | |
1283 (goto-line line)))) | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1284 |
55822 | 1285 ;; flymake minor mode declarations |
60905
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
1286 (defvar flymake-mode-line nil) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1287 |
55822 | 1288 (make-variable-buffer-local 'flymake-mode-line) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1289 |
55822 | 1290 (defvar flymake-mode-line-e-w nil) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1291 |
55822 | 1292 (make-variable-buffer-local 'flymake-mode-line-e-w) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1293 |
55822 | 1294 (defvar flymake-mode-line-status nil) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1295 |
55822 | 1296 (make-variable-buffer-local 'flymake-mode-line-status) |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1297 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1298 (defun flymake-report-status (e-w &optional status) |
58515 | 1299 "Show status in mode line." |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1300 (when e-w |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1301 (setq flymake-mode-line-e-w e-w)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1302 (when status |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1303 (setq flymake-mode-line-status status)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1304 (let* ((mode-line " Flymake")) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1305 (when (> (length flymake-mode-line-e-w) 0) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1306 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w))) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1307 (setq mode-line (concat mode-line flymake-mode-line-status)) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1308 (setq flymake-mode-line mode-line) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1309 (force-mode-line-update))) |
55822 | 1310 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1311 (defun flymake-display-warning (warning) |
58515 | 1312 "Display a warning to user." |
1313 (message-box warning)) | |
55822 | 1314 |
1315 (defcustom flymake-gui-warnings-enabled t | |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
1316 "Enables/disables GUI warnings." |
58515 | 1317 :group 'flymake |
1318 :type 'boolean) | |
55822 | 1319 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1320 (defun flymake-report-fatal-status (status warning) |
58515 | 1321 "Display a warning and switch flymake mode off." |
1322 (when flymake-gui-warnings-enabled | |
1323 (flymake-display-warning (format "Flymake: %s. Flymake will be switched OFF" warning)) | |
1324 ) | |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1325 (flymake-mode 0) |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1326 (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s" |
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1327 (buffer-name) status warning)) |
55822 | 1328 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1329 (defcustom flymake-start-syntax-check-on-find-file t |
58515 | 1330 "Start syntax check on find file." |
1331 :group 'flymake | |
1332 :type 'boolean) | |
55822 | 1333 |
1334 ;;;###autoload | |
63922
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1335 (define-minor-mode flymake-mode |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1336 "Minor mode to do on-the-fly syntax checking. |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1337 When called interactively, toggles the minor mode. |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1338 With arg, turn Flymake mode on if and only if arg is positive." |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1339 :group 'flymake :lighter flymake-mode-line |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1340 (cond |
55822 | 1341 |
63922
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1342 ;; Turning the mode ON. |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1343 (flymake-mode |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1344 (if (not (flymake-can-syntax-check-file buffer-file-name)) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1345 (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name)) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1346 (add-hook 'after-change-functions 'flymake-after-change-function nil t) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1347 (add-hook 'after-save-hook 'flymake-after-save-hook nil t) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1348 (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1349 ;;+(add-hook 'find-file-hook 'flymake-find-file-hook) |
55822 | 1350 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1351 (flymake-report-status "" "") |
63971
b4534bf76ba1
(flymake-find-file): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents:
63924
diff
changeset
|
1352 |
63922
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1353 (setq flymake-timer |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1354 (run-at-time nil 1 'flymake-on-timer-event (current-buffer))) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1355 |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1356 (when flymake-start-syntax-check-on-find-file |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1357 (flymake-start-syntax-check)))) |
63922
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1358 |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1359 ;; Turning the mode OFF. |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1360 (t |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1361 (remove-hook 'after-change-functions 'flymake-after-change-function t) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1362 (remove-hook 'after-save-hook 'flymake-after-save-hook t) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1363 (remove-hook 'kill-buffer-hook 'flymake-kill-buffer-hook t) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1364 ;;+(remove-hook 'find-file-hook (function flymake-find-file-hook) t) |
55822 | 1365 |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1366 (flymake-delete-own-overlays) |
55822 | 1367 |
61943 | 1368 (when flymake-timer |
1369 (cancel-timer flymake-timer) | |
1370 (setq flymake-timer nil)) | |
55822 | 1371 |
63924
c5978a78e9ed
(flymake-mode, flymake-mode-off): Fix unbalanced parentheses.
Luc Teirlinck <teirllm@auburn.edu>
parents:
63922
diff
changeset
|
1372 (setq flymake-is-running nil)))) |
63922
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1373 |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1374 ;;;###autoload |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1375 (defun flymake-mode-on () |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1376 "Turn flymake mode on." |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1377 (flymake-mode 1) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1378 (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name))) |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1379 |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1380 ;;;###autoload |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1381 (defun flymake-mode-off () |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1382 "Turn flymake mode off." |
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1383 (flymake-mode 0) |
63924
c5978a78e9ed
(flymake-mode, flymake-mode-off): Fix unbalanced parentheses.
Luc Teirlinck <teirllm@auburn.edu>
parents:
63922
diff
changeset
|
1384 (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name))) |
55822 | 1385 |
1386 (defcustom flymake-start-syntax-check-on-newline t | |
58515 | 1387 "Start syntax check if newline char was added/removed from the buffer." |
1388 :group 'flymake | |
1389 :type 'boolean) | |
55822 | 1390 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1391 (defun flymake-after-change-function (start stop len) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1392 "Start syntax check for current buffer if it isn't already running." |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1393 ;;+(flymake-log 0 "setting change time to %s" (flymake-float-time)) |
58515 | 1394 (let((new-text (buffer-substring start stop))) |
1395 (when (and flymake-start-syntax-check-on-newline (equal new-text "\n")) | |
1396 (flymake-log 3 "starting syntax check as new-line has been seen") | |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1397 (flymake-start-syntax-check)) |
61943 | 1398 (setq flymake-last-change-time (flymake-float-time)))) |
55822 | 1399 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1400 (defun flymake-after-save-hook () |
58515 | 1401 (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved? |
1402 (progn | |
1403 (flymake-log 3 "starting syntax check as buffer was saved") | |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1404 (flymake-start-syntax-check)))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???) |
55822 | 1405 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1406 (defun flymake-kill-buffer-hook () |
61943 | 1407 (when flymake-timer |
1408 (cancel-timer flymake-timer) | |
1409 (setq flymake-timer nil))) | |
55822 | 1410 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1411 (defun flymake-find-file-hook () |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1412 ;;+(when flymake-start-syntax-check-on-find-file |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1413 ;;+ (flymake-log 3 "starting syntax check on file open") |
67934
83b7f7a9b7c9
(flymake-copy-buffer-to-temp-buffer): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65584
diff
changeset
|
1414 ;;+ (flymake-start-syntax-check) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1415 ;;+) |
58515 | 1416 (when (and (not (local-variable-p 'flymake-mode (current-buffer))) |
63922
1cafd9845c42
(flymake-mode-on, flymake-mode-off): Move body into flymake-mode and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
63901
diff
changeset
|
1417 (flymake-can-syntax-check-file buffer-file-name)) |
58515 | 1418 (flymake-mode) |
1419 (flymake-log 3 "automatically turned ON flymake mode"))) | |
55822 | 1420 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1421 (defun flymake-get-first-err-line-no (err-info-list) |
58515 | 1422 "Return first line with error." |
1423 (when err-info-list | |
1424 (flymake-er-get-line (car err-info-list)))) | |
55822 | 1425 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1426 (defun flymake-get-last-err-line-no (err-info-list) |
58515 | 1427 "Return last line with error." |
1428 (when err-info-list | |
1429 (flymake-er-get-line (nth (1- (length err-info-list)) err-info-list)))) | |
55822 | 1430 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1431 (defun flymake-get-next-err-line-no (err-info-list line-no) |
58515 | 1432 "Return next line with error." |
1433 (when err-info-list | |
1434 (let* ((count (length err-info-list)) | |
1435 (idx 0)) | |
1436 (while (and (< idx count) (>= line-no (flymake-er-get-line (nth idx err-info-list)))) | |
1437 (setq idx (1+ idx))) | |
1438 (if (< idx count) | |
1439 (flymake-er-get-line (nth idx err-info-list)))))) | |
55822 | 1440 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1441 (defun flymake-get-prev-err-line-no (err-info-list line-no) |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
1442 "Return previous line with error." |
58515 | 1443 (when err-info-list |
1444 (let* ((count (length err-info-list))) | |
1445 (while (and (> count 0) (<= line-no (flymake-er-get-line (nth (1- count) err-info-list)))) | |
1446 (setq count (1- count))) | |
1447 (if (> count 0) | |
1448 (flymake-er-get-line (nth (1- count) err-info-list)))))) | |
55822 | 1449 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1450 (defun flymake-skip-whitespace () |
58515 | 1451 "Move forward until non-whitespace is reached." |
1452 (while (looking-at "[ \t]") | |
1453 (forward-char))) | |
55822 | 1454 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1455 (defun flymake-goto-line (line-no) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1456 "Go to line LINE-NO, then skip whitespace." |
58515 | 1457 (goto-line line-no) |
1458 (flymake-skip-whitespace)) | |
55822 | 1459 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1460 (defun flymake-goto-next-error () |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1461 "Go to next error in err ring." |
58515 | 1462 (interactive) |
61943 | 1463 (let ((line-no (flymake-get-next-err-line-no flymake-err-info (flymake-current-line-no)))) |
58515 | 1464 (when (not line-no) |
61943 | 1465 (setq line-no (flymake-get-first-err-line-no flymake-err-info)) |
58515 | 1466 (flymake-log 1 "passed end of file")) |
1467 (if line-no | |
1468 (flymake-goto-line line-no) | |
1469 (flymake-log 1 "no errors in current buffer")))) | |
55822 | 1470 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1471 (defun flymake-goto-prev-error () |
63901
05e4043d377b
(flymake-find-possible-master-files, flymake-master-file-compare,
Juanma Barranquero <lekktu@gmail.com>
parents:
63449
diff
changeset
|
1472 "Go to previous error in err ring." |
58515 | 1473 (interactive) |
61943 | 1474 (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (flymake-current-line-no)))) |
58515 | 1475 (when (not line-no) |
61943 | 1476 (setq line-no (flymake-get-last-err-line-no flymake-err-info)) |
58515 | 1477 (flymake-log 1 "passed beginning of file")) |
1478 (if line-no | |
1479 (flymake-goto-line line-no) | |
1480 (flymake-log 1 "no errors in current buffer")))) | |
55822 | 1481 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1482 (defun flymake-patch-err-text (string) |
58515 | 1483 (if (string-match "^[\n\t :0-9]*\\(.*\\)$" string) |
1484 (match-string 1 string) | |
1485 string)) | |
55822 | 1486 |
1487 ;;;; general init-cleanup and helper routines | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1488 (defun flymake-create-temp-inplace (file-name prefix) |
58515 | 1489 (unless (stringp file-name) |
1490 (error "Invalid file-name")) | |
1491 (or prefix | |
1492 (setq prefix "flymake")) | |
1493 (let* ((temp-name (concat (file-name-sans-extension file-name) | |
1494 "_" prefix | |
1495 (and (file-name-extension file-name) | |
1496 (concat "." (file-name-extension file-name)))))) | |
1497 (flymake-log 3 "create-temp-inplace: file=%s temp=%s" file-name temp-name) | |
1498 temp-name)) | |
55822 | 1499 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1500 (defun flymake-create-temp-with-folder-structure (file-name prefix) |
58515 | 1501 (unless (stringp file-name) |
1502 (error "Invalid file-name")) | |
55822 | 1503 |
58515 | 1504 (let* ((dir (file-name-directory file-name)) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1505 ;; Not sure what this slash-pos is all about, but I guess it's just |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1506 ;; trying to remove the leading / of absolute file names. |
58515 | 1507 (slash-pos (string-match "/" dir)) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1508 (temp-dir (expand-file-name (substring dir (1+ slash-pos)) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1509 (flymake-get-temp-dir)))) |
55822 | 1510 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1511 (file-truename (expand-file-name (file-name-nondirectory file-name) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1512 temp-dir)))) |
55822 | 1513 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1514 (defun flymake-delete-temp-directory (dir-name) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1515 "Attempt to delete temp dir created by `flymake-create-temp-with-folder-structure', do not fail on error." |
58515 | 1516 (let* ((temp-dir (flymake-get-temp-dir)) |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1517 (suffix (substring dir-name (1+ (length temp-dir))))) |
55822 | 1518 |
58515 | 1519 (while (> (length suffix) 0) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1520 (setq suffix (directory-file-name suffix)) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1521 ;;+(flymake-log 0 "suffix=%s" suffix) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1522 (flymake-safe-delete-directory |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1523 (file-truename (expand-file-name suffix temp-dir))) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1524 (setq suffix (file-name-directory suffix))))) |
55822 | 1525 |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1526 (defvar flymake-temp-source-file-name nil) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1527 (make-variable-buffer-local 'flymake-temp-source-file-name) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1528 |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1529 (defvar flymake-master-file-name nil) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1530 (make-variable-buffer-local 'flymake-master-file-name) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1531 |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1532 (defvar flymake-temp-master-file-name nil) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1533 (make-variable-buffer-local 'flymake-temp-master-file-name) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1534 |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1535 (defvar flymake-base-dir nil) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1536 (make-variable-buffer-local 'flymake-base-dir) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1537 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1538 (defun flymake-init-create-temp-buffer-copy (create-temp-f) |
58515 | 1539 "Make a temporary copy of the current buffer, save its name in buffer data and return the name." |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1540 (let* ((source-file-name buffer-file-name) |
58515 | 1541 (temp-source-file-name (funcall create-temp-f source-file-name "flymake"))) |
55822 | 1542 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1543 (flymake-save-buffer-in-file temp-source-file-name) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1544 (setq flymake-temp-source-file-name temp-source-file-name) |
58515 | 1545 temp-source-file-name)) |
55822 | 1546 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1547 (defun flymake-simple-cleanup () |
63402
1fce9257f24f
(flymake-new-err-info, flymake-start-syntax-check-for-current-buffer,
Juanma Barranquero <lekktu@gmail.com>
parents:
62574
diff
changeset
|
1548 "Do cleanup after `flymake-init-create-temp-buffer-copy'. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1549 Delete temp file." |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1550 (flymake-safe-delete-file flymake-temp-source-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1551 (setq flymake-last-change-time nil)) |
55822 | 1552 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1553 (defun flymake-get-real-file-name (file-name-from-err-msg) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1554 "Translate file name from error message to \"real\" file name. |
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1555 Return full-name. Names are real, not patched." |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1556 (let* ((real-name nil) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1557 (source-file-name buffer-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1558 (master-file-name flymake-master-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1559 (temp-source-file-name flymake-temp-source-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1560 (temp-master-file-name flymake-temp-master-file-name) |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1561 (base-dirs |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1562 (list flymake-base-dir |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1563 (file-name-directory source-file-name) |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1564 (if master-file-name (file-name-directory master-file-name)))) |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1565 (files (list (list source-file-name source-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1566 (list temp-source-file-name source-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1567 (list master-file-name master-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1568 (list temp-master-file-name master-file-name)))) |
55822 | 1569 |
58515 | 1570 (when (equal 0 (length file-name-from-err-msg)) |
1571 (setq file-name-from-err-msg source-file-name)) | |
55822 | 1572 |
58515 | 1573 (setq real-name (flymake-get-full-patched-file-name file-name-from-err-msg base-dirs files)) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1574 ;; if real-name is nil, than file name from err msg is none of the files we've patched |
58515 | 1575 (if (not real-name) |
1576 (setq real-name (flymake-get-full-nonpatched-file-name file-name-from-err-msg base-dirs))) | |
1577 (if (not real-name) | |
1578 (setq real-name file-name-from-err-msg)) | |
1579 (setq real-name (flymake-fix-file-name real-name)) | |
1580 (flymake-log 3 "get-real-file-name: file-name=%s real-name=%s" file-name-from-err-msg real-name) | |
1581 real-name)) | |
55822 | 1582 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1583 (defun flymake-get-full-patched-file-name (file-name-from-err-msg base-dirs files) |
58515 | 1584 (let* ((base-dirs-count (length base-dirs)) |
1585 (file-count (length files)) | |
1586 (real-name nil)) | |
55822 | 1587 |
58515 | 1588 (while (and (not real-name) (> base-dirs-count 0)) |
1589 (setq file-count (length files)) | |
1590 (while (and (not real-name) (> file-count 0)) | |
1591 (let* ((this-dir (nth (1- base-dirs-count) base-dirs)) | |
1592 (this-file (nth 0 (nth (1- file-count) files))) | |
1593 (this-real-name (nth 1 (nth (1- file-count) files)))) | |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1594 ;;+(flymake-log 0 "this-dir=%s this-file=%s this-real=%s msg-file=%s" this-dir this-file this-real-name file-name-from-err-msg) |
58515 | 1595 (when (and this-dir this-file (flymake-same-files |
61674
b600a84e6555
(flymake-get-absolute-file-name-basedir): Remove. Update callers to use
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
61284
diff
changeset
|
1596 (expand-file-name file-name-from-err-msg this-dir) |
58515 | 1597 this-file)) |
1598 (setq real-name this-real-name))) | |
1599 (setq file-count (1- file-count))) | |
1600 (setq base-dirs-count (1- base-dirs-count))) | |
1601 real-name)) | |
55822 | 1602 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1603 (defun flymake-get-full-nonpatched-file-name (file-name-from-err-msg base-dirs) |
58515 | 1604 (let* ((real-name nil)) |
1605 (if (file-name-absolute-p file-name-from-err-msg) | |
1606 (setq real-name file-name-from-err-msg) | |
1607 (let* ((base-dirs-count (length base-dirs))) | |
1608 (while (and (not real-name) (> base-dirs-count 0)) | |
61674
b600a84e6555
(flymake-get-absolute-file-name-basedir): Remove. Update callers to use
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
61284
diff
changeset
|
1609 (let* ((full-name (expand-file-name file-name-from-err-msg |
b600a84e6555
(flymake-get-absolute-file-name-basedir): Remove. Update callers to use
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
61284
diff
changeset
|
1610 (nth (1- base-dirs-count) base-dirs)))) |
58515 | 1611 (if (file-exists-p full-name) |
1612 (setq real-name full-name)) | |
1613 (setq base-dirs-count (1- base-dirs-count)))))) | |
1614 real-name)) | |
55822 | 1615 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1616 (defun flymake-init-find-buildfile-dir (source-file-name buildfile-name) |
58515 | 1617 "Find buildfile, store its dir in buffer data and return its dir, if found." |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1618 (let* ((buildfile-dir |
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1619 (flymake-find-buildfile buildfile-name |
68113
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
1620 (file-name-directory source-file-name)))) |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1621 (if buildfile-dir |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1622 (setq flymake-base-dir buildfile-dir) |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1623 (flymake-log 1 "no buildfile (%s) for %s" buildfile-name source-file-name) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1624 (flymake-report-fatal-status |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1625 "NOMK" (format "No buildfile (%s) found for %s" |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1626 buildfile-name source-file-name))))) |
55822 | 1627 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1628 (defun flymake-init-create-temp-source-and-master-buffer-copy (get-incl-dirs-f create-temp-f master-file-masks include-regexp) |
75517
c8c69799e144
(flymake-init-create-temp-source-and-master-buffer-copy): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
1629 "Find master file (or buffer), create its copy along with a copy of the source file." |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1630 (let* ((source-file-name buffer-file-name) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1631 (temp-source-file-name (flymake-init-create-temp-buffer-copy create-temp-f)) |
58515 | 1632 (master-and-temp-master (flymake-create-master-file |
1633 source-file-name temp-source-file-name | |
1634 get-incl-dirs-f create-temp-f | |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1635 master-file-masks include-regexp))) |
55822 | 1636 |
58515 | 1637 (if (not master-and-temp-master) |
1638 (progn | |
1639 (flymake-log 1 "cannot find master file for %s" source-file-name) | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1640 (flymake-report-status "!" "") ; NOMASTER |
68003
a45d40da31da
(flymake-base-dir, flymake-master-file-name, flymake-temp-master-file-name)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68002
diff
changeset
|
1641 nil) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1642 (setq flymake-master-file-name (nth 0 master-and-temp-master)) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1643 (setq flymake-temp-master-file-name (nth 1 master-and-temp-master))))) |
55822 | 1644 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1645 (defun flymake-master-cleanup () |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1646 (flymake-simple-cleanup) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1647 (flymake-safe-delete-file flymake-temp-master-file-name)) |
55822 | 1648 |
1649 ;;;; make-specific init-cleanup routines | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1650 (defun flymake-get-syntax-check-program-args (source-file-name base-dir use-relative-base-dir use-relative-source get-cmd-line-f) |
58515 | 1651 "Create a command line for syntax check using GET-CMD-LINE-F." |
68101
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1652 (funcall get-cmd-line-f |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1653 (if use-relative-source |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1654 (file-relative-name source-file-name base-dir) |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1655 source-file-name) |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1656 (if use-relative-base-dir |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1657 (file-relative-name base-dir |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1658 (file-name-directory source-file-name)) |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1659 base-dir))) |
55822 | 1660 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1661 (defun flymake-get-make-cmdline (source base-dir) |
58515 | 1662 (list "make" |
1663 (list "-s" | |
1664 "-C" | |
1665 base-dir | |
1666 (concat "CHK_SOURCES=" source) | |
1667 "SYNTAX_CHECK_MODE=1" | |
1668 "check-syntax"))) | |
55822 | 1669 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1670 (defun flymake-get-ant-cmdline (source base-dir) |
58515 | 1671 (list "ant" |
1672 (list "-buildfile" | |
1673 (concat base-dir "/" "build.xml") | |
1674 (concat "-DCHK_SOURCES=" source) | |
1675 "check-syntax"))) | |
55822 | 1676 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1677 (defun flymake-simple-make-init-impl (create-temp-f use-relative-base-dir use-relative-source build-file-name get-cmdline-f) |
58515 | 1678 "Create syntax check command line for a directly checked source file. |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1679 Use CREATE-TEMP-F for creating temp copy." |
58515 | 1680 (let* ((args nil) |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1681 (source-file-name buffer-file-name) |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1682 (buildfile-dir (flymake-init-find-buildfile-dir source-file-name build-file-name))) |
58515 | 1683 (if buildfile-dir |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1684 (let* ((temp-source-file-name (flymake-init-create-temp-buffer-copy create-temp-f))) |
58515 | 1685 (setq args (flymake-get-syntax-check-program-args temp-source-file-name buildfile-dir |
1686 use-relative-base-dir use-relative-source | |
1687 get-cmdline-f)))) | |
1688 args)) | |
55822 | 1689 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1690 (defun flymake-simple-make-init () |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1691 (flymake-simple-make-init-impl 'flymake-create-temp-inplace t t "Makefile" 'flymake-get-make-cmdline)) |
55822 | 1692 |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1693 (defun flymake-master-make-init (get-incl-dirs-f master-file-masks include-regexp) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1694 "Create make command line for a source file checked via master file compilation." |
58515 | 1695 (let* ((make-args nil) |
1696 (temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1697 get-incl-dirs-f 'flymake-create-temp-inplace |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1698 master-file-masks include-regexp))) |
58515 | 1699 (when temp-master-file-name |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1700 (let* ((buildfile-dir (flymake-init-find-buildfile-dir temp-master-file-name "Makefile"))) |
58515 | 1701 (if buildfile-dir |
1702 (setq make-args (flymake-get-syntax-check-program-args | |
1703 temp-master-file-name buildfile-dir nil nil 'flymake-get-make-cmdline))))) | |
1704 make-args)) | |
55822 | 1705 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1706 (defun flymake-find-make-buildfile (source-dir) |
68113
92cb4eaf9123
(flymake-find-buildfile): Remove invariant arg `dirs'. Adjust callers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68101
diff
changeset
|
1707 (flymake-find-buildfile "Makefile" source-dir)) |
55822 | 1708 |
1709 ;;;; .h/make specific | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1710 (defun flymake-master-make-header-init () |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1711 (flymake-master-make-init 'flymake-get-include-dirs |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1712 '("\\.cpp\\'" "\\.c\\'") |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1713 "[ \t]*#[ \t]*include[ \t]*\"\\([[:word:]0-9/\\_.]*%s\\)\"")) |
55822 | 1714 |
1715 ;;;; .java/make specific | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1716 (defun flymake-simple-make-java-init () |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1717 (flymake-simple-make-init-impl 'flymake-create-temp-with-folder-structure nil nil "Makefile" 'flymake-get-make-cmdline)) |
55822 | 1718 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1719 (defun flymake-simple-ant-java-init () |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1720 (flymake-simple-make-init-impl 'flymake-create-temp-with-folder-structure nil nil "build.xml" 'flymake-get-ant-cmdline)) |
55822 | 1721 |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1722 (defun flymake-simple-java-cleanup () |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1723 "Cleanup after `flymake-simple-make-java-init' -- delete temp file and dirs." |
68049
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1724 (flymake-safe-delete-file flymake-temp-source-file-name) |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1725 (when flymake-temp-source-file-name |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1726 (flymake-delete-temp-directory |
6f8be651fd6a
(flymake-get-cleanup-function): Default to flymake-simple-cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68004
diff
changeset
|
1727 (file-name-directory flymake-temp-source-file-name)))) |
55822 | 1728 |
1729 ;;;; perl-specific init-cleanup routines | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1730 (defun flymake-perl-init () |
60905
6611fdf35049
(flymake-ensure-ends-with-slash): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60904
diff
changeset
|
1731 (let* ((temp-file (flymake-init-create-temp-buffer-copy |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1732 'flymake-create-temp-inplace)) |
68101
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1733 (local-file (file-relative-name |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1734 temp-file |
78318387b7b6
Use `require' rather than autoload for XEmacs's overlays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68049
diff
changeset
|
1735 (file-name-directory buffer-file-name)))) |
58515 | 1736 (list "perl" (list "-wc " local-file)))) |
55822 | 1737 |
1738 ;;;; tex-specific init-cleanup routines | |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1739 (defun flymake-get-tex-args (file-name) |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1740 ;;(list "latex" (list "-c-style-errors" file-name)) |
58515 | 1741 (list "texify" (list "--pdf" "--tex-option=-c-style-errors" file-name))) |
55822 | 1742 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1743 (defun flymake-simple-tex-init () |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1744 (flymake-get-tex-args (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))) |
55822 | 1745 |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1746 (defun flymake-master-tex-init () |
58515 | 1747 (let* ((temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1748 'flymake-get-include-dirs-dot 'flymake-create-temp-inplace |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1749 '("\\.tex\\'") |
68119
fef56eb2c1ba
(flymake-split-string): Remove >1 empty strings at beg/end of the result.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68113
diff
changeset
|
1750 "[ \t]*\\input[ \t]*{\\(.*%s\\)}"))) |
58515 | 1751 (when temp-master-file-name |
1752 (flymake-get-tex-args temp-master-file-name)))) | |
55822 | 1753 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1754 (defun flymake-get-include-dirs-dot (base-dir) |
58515 | 1755 '(".")) |
55822 | 1756 |
1757 ;;;; xml-specific init-cleanup routines | |
68004
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1758 (defun flymake-xml-init () |
1a9ccbce1b6e
(flymake-create-temp-with-folder-structure): Use expand-file-name.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68003
diff
changeset
|
1759 (list "xml" (list "val" (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)))) |
55822 | 1760 |
58514
287d0425c18a
Much whitespace and capitalization change.
Richard M. Stallman <rms@gnu.org>
parents:
57847
diff
changeset
|
1761 (provide 'flymake) |
55822 | 1762 |
60903
29db3b79c3fa
Misc fix up of comments and docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
58561
diff
changeset
|
1763 ;; arch-tag: 8f0d6090-061d-4cac-8862-7c151c4a02dd |
55822 | 1764 ;;; flymake.el ends here |