[Mew-dist 80] Re: Following up with Mew and impost (Re: Mew 1.51)

Maybe TABOO y-koga at example.com
1996年 11月 21日 (木) 12:59:28 JST


>>>> On Thu, 21 Nov 1996 12:40:17 +0900,
>>>> Maybe TABOO <y-koga at example.com> said:

> 投稿時に確認するようにしてみました (うっかり意図していないのに NetNews 
> に投稿することを防ぐため)。mew-ask-newsgroups が nonnil なら確認し、n 
> を入力したら Newsgroups: フィールドを削除します。
> 
> ついでに、指定したヘッダフィールドを削除する関数を用意して、ct:, cte: 
> の削除のところを少しすっきりさせました。

たびたびすみません。
無駄な箇所の修正とエラー予防を追加しました。
----
こがよういちろう@NEC NW技研
y-koga at example.com

--- mew-draft.el.ORG	Thu Nov 21 00:07:39 1996
+++ mew-draft.el	Thu Nov 21 12:58:20 1996
@@ -22,7 +22,7 @@
 
 (defvar mew-fields
   '("To:" "Cc:" "Subject:" "Dcc:" "Fcc:" "Bcc:"
-    "Reply-To:" "Followup-To:" "From:")
+    "Reply-To:" "Followup-To:" "From:" "Newsgroups:")
   "*Completion field list on draft mode"
   )
 
@@ -375,7 +375,7 @@
 		     del)))
 	 (string-match ":;" c))))
 
-(defun mew-draft-header (&optional subject nl to cc in-reply-to references)
+(defun mew-draft-header (&optional subject nl to cc newsgroups in-reply-to references)
 ;; to -- string or list
 ;; cc -- string or list
 ;; nl -- one empty line under "----", which is necessary if
@@ -439,7 +439,12 @@
 	  (setq del (cons c del))
 	  ))
 	(if cep (insert "\n")))
-     ))
+     )
+    (cond
+     ((null newsgroups) ()) ; do nothing
+     ((stringp newsgroups)
+      (mew-header-insert-here "Newsgroups:" newsgroups))
+    ))
   (and mew-cc   (mew-header-insert-here "Cc:" mew-cc))
   (mew-header-insert-here "Subject:" (if subject subject "")) ;; tricky
   (and mew-from (mew-header-insert-here "From:" mew-from))
@@ -489,6 +494,12 @@
 	(if (string-match "^Subject: +$"
 			  (buffer-substring (match-beginning 0) (match-end 0)))
 	    (insert (read-from-minibuffer "Subject: " nil nil)))))
+  (if mew-ask-newsgroups
+      (save-excursion
+	(goto-char (point-min))
+	(if (and (re-search-forward "^Newsgroups:" nil t)
+		 (not (mew-y-or-n-p "Do you want to post to NetNews ?")))
+	    (mew-draft-delete-headerfield "newsgroups:"))))
   (run-hooks 'mew-send-hook)
   (save-excursion
     (if (mew-header-get-value mew-ct:)
@@ -509,26 +520,30 @@
     ))
 
 (defun mew-draft-delete-content-type ()
+  (mew-draft-delete-headerfield mew-ct:)
+  (mew-draft-delete-headerfield mew-cte:)
+  (goto-char (point-min))
+  (save-excursion
+    (goto-char (marker-position mew-draft-buffer-header))
+    (insert "----")
+  ))
+
+(defun mew-draft-delete-headerfield (headerfield)
   (goto-char (point-min))
   (save-restriction
     (narrow-to-region (point) (marker-position mew-draft-buffer-header))
     (let ((case-fold-search t)
 	  (begin nil))
-      (re-search-forward (concat "^" mew-ct:))
-      (beginning-of-line) ;; for safty
-      (setq begin (point))
-      (if (looking-at "Content-Type: multipart")
-	  ()
-	(forward-line)
-	(while (looking-at "[ \t]")
-	  (forward-line 1))
-	(if (looking-at mew-cte:)
-	  (forward-line 1))
-	(delete-region begin (point))
-	(insert "----")
-	)
-      )
-    ))
+      (if (re-search-forward (concat "^" headerfield) nil t)
+	  (progn
+	    (beginning-of-line) ;; for safty
+	    (setq begin (point))
+	    (forward-line)
+	    (while (looking-at "[ \t]")
+	      (forward-line 1))
+	    (delete-region begin (point))
+	    ))
+      )))
 
 (defun mew-draft-real-send-letter (&optional arg)
   (let* ((mimefolder (mew-draft-to-mime (buffer-name)))
--- mew-summary.el.ORG	Thu Nov 21 00:07:35 1996
+++ mew-summary.el	Thu Nov 21 11:26:13 1996
@@ -1238,7 +1238,7 @@
     (mew-current-set 'window (current-window-configuration))
     (let ((buf (buffer-name))
 	  (file (mew-draft-get-new))
-	  from to cc subject in-reply-to references
+	  from to cc newsgroups subject in-reply-to references
 	  cbuf cache
 	  num folder)
       (unwind-protect
@@ -1288,6 +1288,8 @@
 	       )
 	      )
 	     )
+	    (setq newsgroups (or (mew-header-get-value "Followup-To:")
+				 (mew-header-get-value "Newsgroups:")))
 	    (setq subject (mew-header-get-value "Subject:"))
 	    (if (and subject (not (string-match "^Re:" subject)))
 		(setq subject (concat "Re: " subject)))
@@ -1295,7 +1297,7 @@
 	    (setq references (mew-header-get-value "Message-ID:"))
 	    ;;
 	    (pop-to-buffer cbuf) ;; draft
-	    (mew-draft-header subject nil to cc in-reply-to references)
+	    (mew-draft-header subject nil to cc newsgroups in-reply-to references)
 	    (mew-draft-mode) ;; for hilight
 	    )
 	(save-buffer))) ;; to make sure not to use this draft again
--- mew.el.ORG	Thu Nov 21 00:07:41 1996
+++ mew.el	Thu Nov 21 11:45:45 1996
@@ -120,6 +120,8 @@
 (defvar mew-ask-range t
   "*If non-nil, ask for a range for scanning. If false, always
 use default.")
+(defvar mew-ask-newsgroups nil
+  "*If non-nil, prompt user if he/she want to include Newsgroups: field")
 
 
 



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