Add arch tagline
[bpt/emacs.git] / lisp / progmodes / compilation-weblint.el
1 ;;; compilation-weblint.el --- error regexps for weblint
2
3 ;; Copyright (C) 2007 Free Software Foundation, Inc.
4
5 ;; Author: Kevin Ryde <user42@zip.com.au>
6 ;; Version: 1
7 ;; Keywords: processes
8 ;; URL: http://www.geocities.com/user42_kevin/compilation/index.html
9 ;; EmacsWiki: CompilationMode
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
15 ;; the Free Software Foundation; either version 3, or (at your option)
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
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
27
28 ;;; Commentary:
29
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).
33
34 ;;; Install:
35
36 ;; Put compilation-weblint.el somewhere in your `load-path', and in
37 ;; .emacs put
38 ;;
39 ;; (eval-after-load "compile" '(require 'compilation-weblint))
40 ;;
41 ;; There's an autoload cookie below for this, if you use
42 ;; `update-file-autoloads' and friends.
43
44 ;;; Emacsen:
45
46 ;; Works in Emacs 22, Emacs 21, and XEmacs 21.
47
48 ;;; History:
49
50 ;; Version 1 - the first version.
51
52
53 ;;; Code:
54
55 ;;;DISABLE ###autoload (eval-after-load "compile" '(require 'compilation-weblint))
56
57 (eval-after-load "compile"
58 '(progn
59 ;; The style comes from HTML::Lint::Error::as_string(), eg.
60 ;; index.html (13:1) Unknown element <fdjsk>
61 ;;
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.
65 ;;
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
69 ;; filename.
70 ;;
71 (let ((elem '(compilation-weblint
72 "^\\([^ \t\r\n(]+\\) (\\([0-9]+\\):\\([0-9]+\\)) "
73 1 2 3)))
74
75 (cond
76 ((boundp 'compilation-error-regexp-systems-list)
77 ;; xemacs21
78 (add-to-list 'compilation-error-regexp-alist-alist
79 (list (car elem) (cdr elem)))
80 (compilation-build-compilation-error-regexp-alist))
81
82 ((boundp 'compilation-error-regexp-alist-alist)
83 ;; emacs22
84 (add-to-list 'compilation-error-regexp-alist-alist elem)
85 (add-to-list 'compilation-error-regexp-alist (car elem)))
86
87 (t
88 ;; emacs21
89 (add-to-list 'compilation-error-regexp-alist (cdr elem))
90
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
94 ;;
95 ;; bloofle defined( /users/wolfgang/foo.c(4) ) ...
96 ;;
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!
101 ;;
102 ;; xemacs21 has the same pattern, but somehow the problem
103 ;; doesn't arise, so leave it alone there, for now.
104 ;;
105 (setq compilation-error-regexp-alist
106 (remove '(".*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2)
107 compilation-error-regexp-alist)))))))
108
109 (provide 'compilation-weblint)
110
111 ;; arch-tag: c7e7f18f-71bd-4c43-b3d3-1d669036ef5d
112 ;;; compilation-weblint.el ends here