[Mew-dist 03492] Re: Mew 1.93b6: mew-config breaks out mew-config-list setting ?
Maybe TABOO
y-koga at example.com
1998年 1月 26日 (月) 19:37:52 JST
Kazu Yamamoto (山本和彦) <Kazu at example.com>:
> > > このようにすると、draft 編集段階で手動で Config: ヘッダの挿入を行うか
> > > どうかは mew-config で切り換え、送信直前に自動的に Config: ヘッダの挿
> > > 入を行うかどうかは新規変数で切り換えられるため、仕様が直行することにな
> > > るかと思います。
> > それでよいと思います。
> 合意がとれたので、だれか動機のある人が実装して下さい。
こんな感じでどうでしょう。
- mew-auto-insert-config がセットされている場合は Config: 行を自動挿入
- mew-config が 'guess の場合、mew-config-guess-alist に従って guess する
- mew-config が 'guess の場合で guess できなかったときは、
mew-config-alist の最初の値を使用
- mew-config が文字列の場合は、この値を使用
- mew-config が設定されていない場合は何もしない
という mew-draft-insert-config という関数を作り、これを適当なタイミン
グで呼ぶようにしています。
diff -urN ../orig/mew-draft.el ./mew-draft.el
--- ../orig/mew-draft.el Sun Jan 25 21:05:05 1998
+++ ./mew-draft.el Mon Jan 26 19:36:07 1998
@@ -446,7 +446,6 @@
(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))
- (and mew-config (mew-header-insert-here "Config:" mew-config))
(and mew-fcc (mew-header-insert-here "Fcc:" mew-fcc))
(and mew-dcc (mew-header-insert-here "Dcc:" mew-dcc))
(and mew-reply-to (mew-header-insert-here "Reply-To:" mew-reply-to))
@@ -476,6 +475,7 @@
)
(mew-header-insert-here "Mime-Version:" mew-mv:-num)
(insert mew-header-separator "\n")
+ (mew-draft-insert-config)
(mew-draft-refresh)
(if nl (insert "\n"))
(if to ;; there is no To:
@@ -524,7 +524,7 @@
(setq existp t))
))
(if (and existp
- (not (y-or-n-p "Do you want to post to NetNews ?")))
+ (not (y-or-n-p "Do you want to post to NetNews?")))
(mew-header-delete-lines '("Newsgroups:")))
))
(run-hooks 'mew-send-hook)
@@ -839,6 +839,36 @@
(format "Folder %s remains" mimefolder)
(mew-delete-directory-recursively mimedir))))
(message "Draft was not killed"))
+ ))
+
+(defun mew-draft-insert-config ()
+ (interactive)
+ (let ((config-new nil)
+ (config-cur (mew-header-get-value "Config:"))
+ (config-guess (mew-config-guess-by-alist)))
+ (cond
+ (mew-auto-insert-config
+ (cond
+ ((equal mew-config 'guess)
+ (if config-guess (setq config-new (car config-guess))
+ (and mew-config-list (setq config-new (car mew-config-list)))))
+ (mew-config (setq config-new mew-config)))
+ (if (and mew-config
+ (or (not config-cur)
+ (and (not (equal config-new config-cur))
+ (y-or-n-p
+ (format "Do you want to change Config: value to %s?" config-new)))
+ ))
+ (progn
+ (widen)
+ (mew-header-delete-lines '("Config:"))
+ (goto-char (point-min))
+ (re-search-forward mew-eoh2)
+ (beginning-of-line)
+ (mew-header-insert-here "Config:" config-new)
+ (forward-line -1)
+ (end-of-line)))
+ ))
))
(defun mew-draft-insert-signature ()
diff -urN ../orig/mew-encode.el ./mew-encode.el
--- ../orig/mew-encode.el Sun Jan 25 21:05:07 1998
+++ ./mew-encode.el Mon Jan 26 19:35:51 1998
@@ -50,6 +50,7 @@
"Make a MIME message. Charset guess, mapping directory structure
to multipart, and so on."
(interactive)
+ (mew-draft-insert-config)
(if (mew-header-get-value mew-ct:)
(progn
(ding)
@@ -87,11 +88,6 @@
(re-search-forward mew-eoh2)
(beginning-of-line)
(setq mew-draft-buffer-header (point-marker)) ;; just in case
- ;; Insert Config: if necessary.
- (let ((config (mew-config-guess-by-alist)))
- (if (and config (not (mew-header-get-value "Config:")))
- (mew-header-insert-here "Config:" (car config))
- ))
(mew-highlight-header-region
(point-min) (marker-position mew-draft-buffer-header))
)
diff -urN ../orig/mew-summary.el ./mew-summary.el
--- ../orig/mew-summary.el Sun Jan 25 21:05:35 1998
+++ ./mew-summary.el Mon Jan 26 18:23:54 1998
@@ -1480,8 +1480,6 @@
(mew-header-insert-here "Dcc:" mew-dcc))
(if (and mew-from (not (mew-header-get-value "From:")))
(mew-header-insert-here "From:" mew-from))
- (if (and mew-config (not (mew-header-get-value "Config:")))
- (mew-header-insert-here "Config:" mew-config))
(if (and mew-reply-to (not (mew-header-get-value "Reply-To:")))
(mew-header-insert-here "Reply-To:" mew-reply-to))
(if (and mew-x-mailer (not (mew-header-get-value "X-Mailer:")))
diff -urN ../orig/mew-vars.el ./mew-vars.el
--- ../orig/mew-vars.el Sun Jan 25 21:05:40 1998
+++ ./mew-vars.el Mon Jan 26 19:04:21 1998
@@ -412,6 +412,8 @@
(defvar mew-config (car mew-config-list)
"*A value inserted into Config: field in Draft mode if non-nil.")
+(defvar mew-auto-insert-config nil)
+
(defvar mew-config-guess-alist nil)
(defvar mew-header-alist nil
----
NEC ネットワーキング技術研究所 & 慶應義塾SFC研究所
こがよういちろう <y-koga at example.com>
Mew-dist メーリングリストの案内