[Mew-dist 17513] Re: auto-detect CT by X-Mailer (test).

Tatsuya Kinoshita tats at example.com
2001年 5月 24日 (木) 07:21:19 JST


In message "[Mew-dist 17512] Re: auto-detect CT by X-Mailer (test)."
ki at example.com wrote:

> mew-config-guess-when-prepared が nil の場合は、両方共に "outlook,mew"
> に guess されるようです。
> 
> 少し調べたところ、一度 "outlook,mew" に guess された後、draft で To:
> だけが用意された状態の時に再度 mew-refile-guess-by-alist1 が呼ばれて
> 上書きされてしまっているような感じです。

なるほど、おっしゃるとおり現状では、when-repliedでguessされたcaseが、
when-preparedで上書きされます。

guessされたcaseを「上書き」ではなく「追加」できるよう、オプションを
用意してみました。(mew-config-guess-addition)

P.S.

mew-refile.elへのパッチは、[Mew-dist 14915]で報告された変数初期化ミス
の修正です。

-- 
木下達也
-------------- next part --------------

 This patch is written by Tatsuya Kinoshita.  Copyright is disclaimed.

diff -ur mew/mew-config.el mew-tats20010524/mew-config.el
--- mew/mew-config.el	Tue May 22 23:13:57 2001
+++ mew-tats20010524/mew-config.el	Thu May 24 06:48:24 2001
@@ -288,13 +288,15 @@
 you can modify the locally stored value. Then this command replace
 fields in the header according to the new value."
   (interactive "P")
-  (let ((old-case (mew-tinfo-get-config)))
-    (mew-tinfo-set-config
-     (if arg
-	 (mew-input-config (mew-tinfo-get-config) "This draft" 'edit)
-       (mew-input-config
-	(or (mew-draft-get-config-by-guess) mew-config-output)
-	"This draft")))
+  (let (new-case (old-case (mew-tinfo-get-config)))
+    (if arg
+	(setq new-case (mew-input-config old-case "This draft" 'edit))
+      (setq new-case (mew-draft-get-config-by-guess))
+      (if mew-config-guess-addition
+	  (setq new-case (mew-draft-add-config old-case new-case)))
+      (setq new-case
+	    (mew-input-config (or new-case mew-config-output) "This draft")))
+    (mew-tinfo-set-config new-case)
     (mew-draft-mode-name (mew-tinfo-get-hdr-file))
     (mew-draft-replace-fields old-case)))
 
@@ -337,7 +339,19 @@
 
 (defun mew-draft-set-config-by-guess ()
   (let ((cfg (mew-draft-get-config-by-guess)))
-    (if cfg (mew-tinfo-set-config cfg))))
+    (when cfg
+      (if mew-config-guess-addition
+	  (setq cfg (mew-draft-add-config (mew-tinfo-get-config) cfg)))
+      (mew-tinfo-set-config cfg))))
+
+(defun mew-draft-add-config (dst src)
+  (let (case-fold-search)
+    (if (mew-config-default-p dst)
+	src
+      (if (and (> (length src) 0)
+	       (not (string-match (concat (regexp-quote src) "$") dst)))
+	  (concat dst "," src)
+	dst))))
 
 (provide 'mew-config)
 
diff -ur mew/mew-refile.el mew-tats20010524/mew-refile.el
--- mew/mew-refile.el	Wed Apr 11 22:38:51 2001
+++ mew-tats20010524/mew-refile.el	Thu May 24 06:47:55 2001
@@ -130,6 +130,7 @@
 	    (while sublist
 	      (setq key (car (car sublist)))
 	      (setq val (cdr (car sublist)))
+	      (setq ent nil)
 	      (if (and (stringp key) (string-match key header))
 		  (cond
 		   ((stringp val)
diff -ur mew/mew-summary.el mew-tats20010524/mew-summary.el
--- mew/mew-summary.el	Tue May 22 23:13:59 2001
+++ mew-tats20010524/mew-summary.el	Thu May 24 06:48:17 2001
@@ -1454,7 +1454,10 @@
 	       (setq references (mew-join "\n\t" tmp-ref)))))
 	 ;;
 	 (mew-pop-to-buffer cbuf) ;; draft
-	 (if case (mew-tinfo-set-config case))
+	 (when case
+	   (if mew-config-guess-addition
+	       (setq case (mew-draft-add-config (mew-tinfo-get-config) case)))
+	   (mew-tinfo-set-config case))
 	 (mew-draft-header subject nil to cc newsgroups in-reply-to references
 			   nil fromme)
 	 (when (eq mew-summary-reply-position 'body)
diff -ur mew/mew-vars.el mew-tats20010524/mew-vars.el
--- mew/mew-vars.el	Wed May 23 16:25:33 2001
+++ mew-tats20010524/mew-vars.el	Thu May 24 06:47:42 2001
@@ -1615,6 +1615,7 @@
 (defvar mew-config-guess-when-replied t)
 (defvar mew-config-guess-when-prepared t)
 (defvar mew-config-guess-when-composed nil)
+(defvar mew-config-guess-addition nil)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;


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