[Mew-dist 05351] Making 'References:' field with mew-gnus.el

Toshio HORI toshi at example.com
1998年 7月 4日 (土) 01:44:51 JST


普段、NetNewsを読むのには Gnus + mew-gnus.el を使ってます。

しかし、mew-gnus.elでfollow/replyを書くと元の記事のReferencesが残らず、
follow/replyした記事のMessage-IDだけになってしまってちょっと悲しいので
いじってみました。後ろにpatchをつけます。

修正したのは、mew-draft.el, mew-summary.el, contrib/mew-gnus.elの三つ
で、mew-gnus.elは [Mew-dist 05337] の酒井さんのpatchを当てたあとに当て
てください。

このpatchを当てると

 1. "In-Reply-To:" には従来通り元の記事のMessage-IDが入ります。
 2. "References:" には
	元の記事のReferencesの内容 + "\n\t" + 元の記事のMessage-ID
    が入ります。
 3. "X-Newsreader:" fieldが"X-Mailer:"の前に入ります。
 4. 通常のmailのreplyでも1. & 2.となります。

// 堀 俊夫 / toshi at example.com
// 電子技術総合研究所 知能システム部
// Homepage : http://www.etl.go.jp/~toshi/

-------------- next part --------------
--- mew-draft.el.toshi	Fri Jul  3 21:38:06 1998
+++ mew-draft.el	Fri Jul  3 22:03:06 1998
@@ -354,7 +354,7 @@
 		 del)))
 	 (string-match ":;" c))))
 
-(defun mew-draft-header (&optional subject nl to cc newsgroups in-reply-to references)
+(defun mew-draft-header (&optional subject nl to cc newsgroups in-reply-to mes-id references)
 ;; to -- string or list
 ;; cc -- string or list
 ;; nl -- one empty line under "----", which is necessary if
@@ -427,9 +427,9 @@
   (mew-header-insert-here "Dcc:" mew-dcc)
   (mew-header-insert-here "Reply-To:" mew-reply-to)
   (if in-reply-to
-      (if references
+      (if mes-id
 	  (setq in-reply-to (concat "Your message of \"" 
-				    in-reply-to "\"\n\t" references))
+				    in-reply-to "\"\n\t" mes-id))
 	(setq in-reply-to (concat "Your message of \"" in-reply-to "\""))))
   (mew-header-insert-here "In-Reply-To:" in-reply-to)
   (mew-header-insert-here "References:" references)
--- contrib/mew-gnus.el.toshi	Fri Jul  3 22:07:36 1998
+++ contrib/mew-gnus.el	Fri Jul  3 22:45:51 1998
@@ -110,8 +110,8 @@
       (save-excursion
 	(mew-set-environment)))
   (let ((file (mew-folder-new-message mew-draft-folder))
-	from cc subject date to reply-to newsgroups in-reply-to references
-	distribution)
+	from cc subject date to reply-to newsgroups in-reply-to
+	mes-id references distribution)
     (if (null mew-mail-path) (mew-init))
     (mew-current-set 'window (current-window-configuration))
     (delete-other-windows)
@@ -134,11 +134,16 @@
 			 (gnus-fetch-field "Newsgroups"))
 	  date (gnus-fetch-field "Date")
 	  in-reply-to (mew-header-get-value "Date:")
-	  references (mew-header-get-value "Message-ID:")
+	  mes-id (mew-header-get-value "Message-ID:")
+	  references (mew-header-get-value "References:")
 	  distribution (gnus-fetch-field "Distribution"))
+    (if (stringp references)
+	(setq references (concat references "\n\t" mes-id))
+      (setq references mes-id))
     (switch-to-buffer-other-window (find-file-noselect file))
     (mew-draft-rename file)
-    (mew-draft-header subject nil to cc newsgroups in-reply-to references)
+    (mew-draft-header subject nil to cc newsgroups in-reply-to mes-id
+		      references)
     (mew-draft-mode) ;; for hilight
     (if (stringp distribution)
 	(save-excursion
@@ -146,6 +151,10 @@
 	  (search-forward "Newsgroups:")
 	  (forward-line 1)
 	  (insert (concat "Distribution: " distribution "\n"))))
+    (goto-char (point-min))
+    (search-forward "X-Mailer:")
+    (beginning-of-line)
+    (insert (concat "X-Newsreader: " gnus-version "\n"))
     (make-variable-buffer-local 'mew-message-citation-buffer) 
     (setq mew-message-citation-buffer gnus-article-buffer))
   (if yank
--- mew-summary.el.toshi	Fri Jul  3 21:42:12 1998
+++ mew-summary.el	Fri Jul  3 22:03:31 1998
@@ -1021,7 +1021,7 @@
 	 (file (mew-folder-new-message mew-draft-folder))
 	 (find-file-hooks nil)
 	 (inhibit-quit t)
-	 from to cc newsgroups subject in-reply-to references
+	 from to cc newsgroups subject in-reply-to mes-id references
 	 cbuf)
      (mew-summary-prepare-draft
       (if (get-buffer (mew-buffer-message))
@@ -1074,11 +1074,15 @@
 	(if (and subject (not (string-match mew-reply-regex subject)))
 	    (setq subject (concat mew-reply-string subject)))
 	(setq in-reply-to (mew-header-get-value "Date:"))
-	(setq references (mew-header-get-value "Message-ID:"))
+	(setq mes-id (mew-header-get-value "Message-ID:"))
+	(setq references (mew-header-get-value "References:"))
+	(if (stringp references)
+	    (setq references (concat references "\n\t" mes-id))
+	  (setq references mes-id))
 	)
       ;;
       (mew-pop-to-buffer cbuf) ;; draft
-      (mew-draft-header subject nil to cc newsgroups in-reply-to references)
+      (mew-draft-header subject nil to cc newsgroups in-reply-to mes-id references)
       (cond
        ((eq mew-summary-reply-position 'body)
 	(goto-char (mew-header-end))


Mew-dist メーリングリストの案内