1 ;;; gnus-cite.el --- parse citations in articles for Gnus
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
5 ;; Author: Per Abhiddenware; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 2, or (at your option)
10 ;; GNU Emacs is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with GNU Emacs; see the file COPYING. If not, write to the
17 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 ;; Boston, MA 02111-1307, USA.
24 (eval-when-compile (require 'cl))
32 (defgroup gnus-cite nil
35 :link '(custom-manual "(gnus)Article Highlighting")
38 (defcustom gnus-cite-reply-regexp
39 "^\\(Subject: Re\\|In-Reply-To\\|References\\):"
40 "*If headers match this regexp it is reasonable to believe that
41 article has citations."
45 (defcustom gnus-cite-always-check nil
46 "Check article always for citations. Set it t to check all articles."
48 :type '(choice (const :tag "no" nil)
49 (const :tag "yes" t)))
51 (defcustom gnus-cited-opened-text-button-line-format "%(%{[-]%}%)\n"
52 "Format of opened cited text buttons."
56 (defcustom gnus-cited-closed-text-button-line-format "%(%{[+]%}%)\n"
57 "Format of closed cited text buttons."
61 (defcustom gnus-cited-lines-visible nil
62 "The number of lines of hidden cited text to remain visible.
63 Or a pair (cons) of numbers which are the number of lines at the top
64 and bottom of the text, respectively, to remain visible."
66 :type '(choice (const :tag "none" nil)
68 (cons :tag "Top and Bottom" integer integer)))
70 (defcustom gnus-cite-parse-max-size 25000
71 "Maximum article size (in bytes) where parsing citations is allowed.
72 Set it to nil to parse all articles."
74 :type '(choice (const :tag "all" nil)
77 (defcustom gnus-cite-prefix-regexp
78 "^[]>»|:}+ ]*[]>»|:}+]\\(.*>»\\)?\\|^.*>"
79 "*Regexp matching the longest possible citation prefix on a line."
83 (defcustom gnus-cite-max-prefix 20
84 "Maximum possible length for a citation prefix."
88 (defcustom gnus-supercite-regexp
89 (concat "^\\(" gnus-cite-prefix-regexp "\\)? *"
90 ">>>>> +\"\\([^\"\n]+\\)\" +==")
91 "*Regexp matching normal Supercite attribution lines.
92 The first grouping must match prefixes added by other packages."
96 (defcustom gnus-supercite-secondary-regexp "^.*\"\\([^\"\n]+\\)\" +=="
97 "Regexp matching mangled Supercite attribution lines.
98 The first regexp group should match the Supercite attribution."
102 (defcustom gnus-cite-minimum-match-count 2
103 "Minimum number of identical prefixes before we believe it's a citation."
107 (defcustom gnus-cite-attribution-prefix
108 "In article\\|in <\\|On \\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\),\\|-----Original Message-----"
109 "*Regexp matching the beginning of an attribution line."
113 (defcustom gnus-cite-attribution-suffix
114 "\\(\\(wrote\\|writes\\|said\\|says\\|>\\)\\(:\\|\\.\\.\\.\\)\\|-----Original Message-----\\)[ \t]*$"
115 "*Regexp matching the end of an attribution line.
116 The text matching the first grouping will be used as a button."
120 (defface gnus-cite-attribution-face '((t
122 "Face used for attribution lines.")
124 (defcustom gnus-cite-attribution-face 'gnus-cite-attribution-face
125 "Face used for attribution lines.
126 It is merged with the face for the cited text belonging to the attribution."
130 (defface gnus-cite-face-1 '((((class color)
132 (:foreground "light blue"))
135 (:foreground "MidnightBlue"))
140 (defface gnus-cite-face-2 '((((class color)
142 (:foreground "light cyan"))
145 (:foreground "firebrick"))
150 (defface gnus-cite-face-3 '((((class color)
152 (:foreground "light yellow"))
155 (:foreground "dark green"))
160 (defface gnus-cite-face-4 '((((class color)
162 (:foreground "light pink"))
165 (:foreground "OrangeRed"))
170 (defface gnus-cite-face-5 '((((class color)
172 (:foreground "pale green"))
175 (:foreground "dark khaki"))
180 (defface gnus-cite-face-6 '((((class color)
182 (:foreground "beige"))
185 (:foreground "dark violet"))
190 (defface gnus-cite-face-7 '((((class color)
192 (:foreground "orange"))
195 (:foreground "SteelBlue4"))
200 (defface gnus-cite-face-8 '((((class color)
202 (:foreground "magenta"))
205 (:foreground "magenta"))
210 (defface gnus-cite-face-9 '((((class color)
212 (:foreground "violet"))
215 (:foreground "violet"))