comparison lisp/progmodes/compilation-perl.el @ 86039:9e4fbb0dbd2d

New files.
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Mon, 12 Nov 2007 02:59:46 +0000
parents
children d706a3a419e6
comparison
equal deleted inserted replaced
86038:2cb332934e53 86039:9e4fbb0dbd2d
1 ;;; compilation-perl.el --- error regexps for perl podchecker and Test
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: PerlLanguage
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 `compilation-error-regexp-alist'
31 ;; patterns for perl podchecker (the Pod::Checker module) and Test and
32 ;; Test::Harness module error output.
33 ;;
34 ;; Emacs already has patterns for perl's normal compile and run
35 ;; errors, but podchecker and Test are a bit different.
36
37 ;;; Install:
38
39 ;; Put compilation-perl.el somewhere in your `load-path', and in
40 ;; .emacs put
41 ;;
42 ;; (eval-after-load "compile" '(require 'compilation-perl))
43 ;;
44 ;; There's an autoload cookie below for this, if you use
45 ;; `update-file-autoloads' and friends.
46
47 ;;; Emacsen:
48
49 ;; Works in Emacs 22, Emacs 21, and XEmacs 21.
50
51 ;;; History:
52
53 ;; Version 1 - the first version.
54
55
56 ;;; Code:
57
58 ;;;###autoload (eval-after-load "compile" '(require 'compilation-perl))
59
60 (eval-after-load "compile"
61 '(dolist
62 (elem
63 '(;; podchecker error messages, per Pod::Checker.
64 ;; The style is from the Pod::Checker::poderror() function, eg.
65 ;; *** ERROR: Spurious text after =cut at line 193 in file foo.pm
66 ;;
67 ;; Plus end_pod() can give "at line EOF" instead of a
68 ;; number, so for that match "on line N" which is the
69 ;; originating spot, eg.
70 ;; *** ERROR: =over on line 37 without closing =back at line EOF in file bar.pm
71 ;;
72 ;; Plus command() can give both "on line N" and "at line N";
73 ;; the latter is desired and is matched because the .* is
74 ;; greedy.
75 ;; *** ERROR: =over on line 1 without closing =back (at head1) at line 3 in file x.pod
76 ;;
77 (compilation-perl--Pod::Checker
78 "^\\*\\*\\* \\(?:ERROR\\|\\(WARNING\\)\\).* \\(?:at\\|on\\) line \\([0-9]+\\) \\(?:.* \\)?in file \\([^ \t\n]+\\)"
79 3 2 nil (1))
80
81 ;; perl Test module error messages.
82 ;; Style per the ok() function "$context", eg.
83 ;; # Failed test 1 in foo.t at line 6
84 ;;
85 (compilation-perl--Test
86 "^# Failed test [0-9]+ in \\([^ \t\r\n]+\\) at line \\([0-9]+\\)"
87 1 2)
88
89 ;; perl Test::Harness output, eg.
90 ;; NOK 1# Test 1 got: "1234" (t/foo.t at line 46)
91 ;;
92 ;; Test::Harness is slightly designed for tty output, since
93 ;; it prints CRs to overwrite progress messages, but if you
94 ;; run it in with M-x compile this pattern can at least step
95 ;; through the failures.
96 ;;
97 (compilation-perl--Test::Harness
98 "^.*NOK.* \\([^ \t\r\n]+\\) at line \\([0-9]+\\)"
99 1 2)))
100
101 (cond
102 ((boundp 'compilation-error-regexp-systems-list)
103 ;; xemacs21
104 (setq elem (remove '(1) elem)) ; drop "type" specifier
105 (add-to-list 'compilation-error-regexp-alist-alist
106 (list (car elem) (cdr elem)))
107 (compilation-build-compilation-error-regexp-alist))
108
109 ((boundp 'compilation-error-regexp-alist-alist)
110 ;; emacs22
111 (add-to-list 'compilation-error-regexp-alist-alist elem)
112 (add-to-list 'compilation-error-regexp-alist (car elem)))
113
114 (t
115 ;; emacs21
116 (setq elem (remove '(1) elem)) ; drop "type" specifier
117 (add-to-list 'compilation-error-regexp-alist (cdr elem))))))
118
119 (provide 'compilation-perl)
120
121 ;;; compilation-perl.el ends here