1 ;;; compilation-weblint.el --- error regexps for weblint
3 ;; Copyright (C) 2007 Free Software Foundation, Inc.
5 ;; Author: Kevin Ryde <user42@zip.com.au>
8 ;; URL: http://www.geocities.com/user42_kevin/compilation/index.html
9 ;; EmacsWiki: CompilationMode
11 ;; This file is part of GNU Emacs.
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
15 ;; the Free Software Foundation; either version 3, or (at your option)
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.
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
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
30 ;; This is a spot of code adding a `compilation-error-regexp-alist'
31 ;; pattern for messages from the weblint program (the one based on the
32 ;; perl HTML::Lint modules).
36 ;; Put compilation-weblint.el somewhere in your `load-path', and in
39 ;; (eval-after-load "compile" '(require 'compilation-weblint))
41 ;; There's an autoload cookie below for this, if you use
42 ;; `update-file-autoloads' and friends.
46 ;; Works in Emacs 22, Emacs 21, and XEmacs 21.
50 ;; Version 1 - the first version.
55 ;;;DISABLE ###autoload (eval-after-load "compile" '(require 'compilation-weblint))
57 (eval-after-load "compile"
59 ;; The style comes from HTML::Lint::Error::as_string(), eg.
60 ;; index.html (13:1) Unknown element <fdjsk>
62 ;; The pattern only matches filenames without spaces, since that
63 ;; should be usual and should help reduce the chance of a false
64 ;; match of a message from some unrelated program.
66 ;; This message style is quite close to the "ibm" entry of
67 ;; emacs22 `compilation-error-regexp-alist-alist' which is for
68 ;; IBM C, though that ibm bit doesn't put a space after the
71 (let ((elem '(compilation-weblint
72 "^\\([^ \t\r\n(]+\\) (\\([0-9]+\\):\\([0-9]+\\)) "
76 ((boundp 'compilation-error-regexp-systems-list
)
78 (add-to-list 'compilation-error-regexp-alist-alist
79 (list (car elem
) (cdr elem
)))
80 (compilation-build-compilation-error-regexp-alist))
82 ((boundp 'compilation-error-regexp-alist-alist
)
84 (add-to-list 'compilation-error-regexp-alist-alist elem
)
85 (add-to-list 'compilation-error-regexp-alist
(car elem
)))
89 (add-to-list 'compilation-error-regexp-alist
(cdr elem
))
91 ;; Remove the "4.3BSD lint pass 3" element because it wrongly
92 ;; matches weblint messages. It's apparently supposed to
93 ;; match something like
95 ;; bloofle defined( /users/wolfgang/foo.c(4) ) ...
97 ;; but it's rather loose and ends up matching the "(13:1)"
98 ;; part from weblint as if "13" is the filename and "1" is
99 ;; the line number. Forcibly removing this is a bit nasty,
100 ;; but emacs22 has dropped it, so consider it an upgrade!
102 ;; xemacs21 has the same pattern, but somehow the problem
103 ;; doesn't arise, so leave it alone there, for now.
105 (setq compilation-error-regexp-alist
106 (remove '(".*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2)
107 compilation-error-regexp-alist
)))))))
109 (provide 'compilation-weblint
)
111 ;; arch-tag: c7e7f18f-71bd-4c43-b3d3-1d669036ef5d
112 ;;; compilation-weblint.el ends here