[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

sb-ruby.el (non-member post)



sb-ruby.elに対するパッチを2つ添付します。

一つ目は、sb-ruby.elがメッセージを取りこぼすことがあるので、
それを修正するものです。

二つ目は、その他些細な部分の修正と、Message-IdとReferencesをつけるようにする
機能拡張です。Message-Idは、<"ml-name":"ml-count"@ruby-lang.org>という
形式で付けています。

二つ目のパッチの扱いについては作者の方におまかせしますが、一つ目は
問題がなければぜひ取り入れてくださるようお願いします。

---
SAITO Takuya <reed@lily.freemail.ne.jp>
--- sb-ruby.el.orig	Mon Mar 11 23:09:16 2002
+++ sb-ruby.el	Mon Mar 11 23:09:31 2002
@@ -92,8 +92,8 @@
 	  (subst-char-in-region (point-min) (point-max) ?\t ?  t)
 	  (let ((case-fold-search t)
 		id url date subject from)
-	    (goto-char (point-min))
-	    (while (re-search-forward
+	    (goto-char (point-max))
+	    (while (re-search-backward
 		    "^<DT><A NAME=\"[0-9]+\"></A><A HREF=\"\\([^>]+\\)\">\\([0-9]+\\)</A> \\([ /:0-9]+\\) \\[\\([^[]+\\)\\] \\(.+\\)$"
 		    nil t)
 	      (setq url (concat shimbun-ruby-url (match-string 1))
@@ -106,7 +106,6 @@
 		    subject (match-string 5))
 	      (if (shimbun-search-id shimbun id)
 		  (throw 'stop nil))
-	      (forward-line 1)
 	      (push (shimbun-make-header
 		     0
 		     (shimbun-mime-encode-string subject)
--- sb-ruby.el.fix	Mon Mar 11 23:10:30 2002
+++ sb-ruby.el	Mon Mar 11 23:10:37 2002
@@ -57,6 +57,16 @@
 				  (match-string 4 str))
       str)))
 
+(defun shimbun-ruby-convert-link-to-id ()
+  (let (id)
+    (save-excursion
+      (goto-char (point-min))
+      (while (re-search-forward "<a href=\"/cgi-bin/scat\\.rb/ruby/\\([^/]+\\)/\\([0-9]+\\)\">[0-9]+</a>" nil t)
+	(setq id (format "<%s:%s@ruby-lang.org>"
+			 (match-string 1) (match-string 2)))
+	(delete-region (match-beginning 0) (match-end 0))
+	(insert id)))))
+
 (luna-define-method shimbun-index-url ((shimbun shimbun-ruby))
   (concat (shimbun-url-internal shimbun)
 	  "/"
@@ -67,7 +77,7 @@
 (luna-define-method shimbun-get-headers ((shimbun shimbun-ruby)
 					 &optional range)
   (let ((case-fold-search t)
-	(start (progn (re-search-forward "^<table" nil t nil)
+	(start (progn (re-search-forward "<table" nil t nil)
 		      (forward-line 1) (beginning-of-line 1)
 		      (point)))
 	(end (progn (re-search-forward "</table>" nil t nil)
@@ -87,7 +97,7 @@
 		   "/"
 		   (cdr (assoc (shimbun-current-group-internal shimbun)
 			       shimbun-ruby-group-path-alist))
-	   "/"
+		   "/"
 		   (setq aux (car auxs))))
 	  (subst-char-in-region (point-min) (point-max) ?\t ?  t)
 	  (let ((case-fold-search t)
@@ -116,7 +126,7 @@
 
 (luna-define-method shimbun-make-contents ((shimbun shimbun-ruby) header)
   (let ((headers '(("^Subject: \\(.+\\)$" . shimbun-header-set-subject)
-		   ("^From:\\(.+\\)$" . shimbun-header-set-from)
+		   ("^From: \\(.+\\)$" . shimbun-header-set-from)
 		   ("^Date: \\(.+\\)$" . shimbun-header-set-date)))
 	;; any other headers to be included?
 	;;<A NAME=head></A><pre><A HREF="/cgi-bin/scat.rb/ruby/ruby-list/29726">...<a href="/ruby/ruby-list/29727">o</a> <a href="/cgi-bin/scat.rb/ruby/ruby-list/29727?help">HELP</a>
@@ -144,6 +154,21 @@
 					 (buffer-string)))
 	   (funcall (cdr (car headers)) header value)))
       (setq headers (cdr headers)))
+    ;;Message-Id:
+    (goto-char (point-min))
+    (let ((subject (shimbun-header-subject header)))
+      (if (string-match "^\\[\\([^]]+\\)\\]" subject)
+	  (shimbun-header-set-id header (format "<%s@ruby-lang.org>"
+						(match-string 1 subject)))))
+    ;;References:
+    (goto-char (point-min))
+    (if (re-search-forward "^References: \\(.+\\)$" nil t)
+	(and
+	 (setq value (match-string-no-properties 1))
+	 (setq value (with-temp-buffer (insert value)
+				       (shimbun-ruby-convert-link-to-id)
+				       (buffer-string)))
+	 (shimbun-header-set-references header value)))
     (search-forward "<hr>" nil t nil)
     (delete-region (point) headerstart)
     (shimbun-header-insert shimbun header)