Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Better handling for Microsoft citations (resend)
@ 2003-02-12 18:03 Michael Shields
  2003-02-12 20:25 ` Kai Großjohann
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michael Shields @ 2003-02-12 18:03 UTC (permalink / raw)


Resending since I now have papers on file.

2003-02-13  Michael Shields  <shields@msrl.com>

	* gnus-cite.el
	(gnus-cite-attribution-suffix, gnus-cite-parse):
	Better handling for Microsoft citation styles.
	(gnus-unsightly-citation-regexp): New.

Index: lisp/gnus-cite.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-cite.el,v
retrieving revision 6.21
diff -u -r6.21 gnus-cite.el
--- lisp/gnus-cite.el	12 Feb 2003 15:06:16 -0000	6.21
+++ lisp/gnus-cite.el	12 Feb 2003 18:03:16 -0000
@@ -90,19 +90,42 @@
   :group 'gnus-cite
   :type 'integer)
 
+;; Some Microsoft products put in a citation that extends to the
+;; remainder of the message:
+;;
+;;     -----Original Message-----
+;;     From: ...
+;;     To: ...
+;;     Sent: ...   [date, in non-RFC-2822 format]
+;;     Subject: ...
+;;
+;;     Cited message, with no prefixes
+;;
+;; The four headers are always the same.  But note they are prone to
+;; folding without additional indentation.
+;;
+;; Others use "----- Original Message -----" instead, and properly quote
+;; the body using "> ".  This style is handled without special cases.
+
 (defcustom gnus-cite-attribution-prefix
-  "In article\\|in <\\|On \\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\),\\|-----Original Message-----"
+  "In article\\|in <\\|On \\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\),\\|----- ?Original Message ?-----"
   "*Regexp matching the beginning of an attribution line."
   :group 'gnus-cite
   :type 'regexp)
 
 (defcustom gnus-cite-attribution-suffix
-  "\\(\\(wrote\\|writes\\|said\\|says\\|>\\)\\(:\\|\\.\\.\\.\\)\\|-----Original Message-----\\)[ \t]*$"
+  "\\(\\(wrote\\|writes\\|said\\|says\\|>\\)\\(:\\|\\.\\.\\.\\)\\|----- ?Original Message ?-----\\)[ \t]*$"
   "*Regexp matching the end of an attribution line.
 The text matching the first grouping will be used as a button."
   :group 'gnus-cite
   :type 'regexp)
 
+(defcustom gnus-unsightly-citation-regexp
+  "^-----Original Message-----\nFrom: \\(.+\n\\)+\n"
+  "Regexp matching Microsoft-type rest-of-message citations."
+  :group 'gnus-cite
+  :type 'regexp)
+
 (defface gnus-cite-attribution-face '((t
 				       (:italic t)))
   "Face used for attribution lines.")
@@ -724,9 +747,19 @@
 	(goto-char begin))
       (goto-char start)
       (setq line (1+ line)))
+    ;; Horrible special case for some Microsoft mailers.
+    (goto-char (point-min))
+    (when (re-search-forward gnus-unsightly-citation-regexp max t)
+      (setq begin (count-lines (point-min) (point)))
+      (setq end (count-lines (point-min) max))
+      (setq entry nil)
+      (while (< begin end)
+	(push begin entry)
+	(setq begin (1+ begin)))
+      (push (cons "" entry) alist))
     ;; We got all the potential prefixes.  Now create
     ;; `gnus-cite-prefix-alist' containing the oldest prefix for each
-    ;; line that appears at least gnus-cite-minimum-match-count
+    ;; line that appears at least `gnus-cite-minimum-match-count'
     ;; times.  First sort them by length.  Longer is older.
     (setq alist (sort alist (lambda (a b)
 			      (> (length (car a)) (length (car b))))))

-- 
Shields.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-02-19 19:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-12 18:03 [PATCH] Better handling for Microsoft citations (resend) Michael Shields
2003-02-12 20:25 ` Kai Großjohann
2003-02-12 20:27 ` Kai Großjohann
2003-02-12 23:41   ` Michael Shields
2003-02-13 11:29     ` Kai Großjohann
2003-02-12 22:30 ` Reiner Steib
2003-02-13 11:30   ` Kai Großjohann
2003-02-19 18:00     ` Reiner Steib
2003-02-19 19:08       ` Kai Großjohann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).