[Mew-dist 14990] Re: config problem
Tatsuya Kinoshita
tatsuyak at example.com
2000年 11月 23日 (木) 12:11:12 JST
config関連のパッチを作りました。
In message "[Mew-dist 14875] Re: config problem ..."
Tatsuya Kinoshita <tatsuyak at example.com> wrote:
> 「config-guessのタイミング」
> なお1.94.2では、ドラフト作成時、C-c C-m時それぞれについて、
> mew-config-insert-when-prepared, mew-config-insert-when-composed
> によって、推測する・しないを制御できました。
mew-config-insert-when-preparedだけ復活させました。デフォルトはnil
です。(1.95では「config-insert」よりも「config-guess」という方が妥
当かも)
> 「新たなcaseによる、ヘッダの更新」
>
> ドラフト作成時に推測されたcaseや、再編集時のmew-config-outputが、
> ヘッダ(From, Fcc等)に反映されません。
新しいcaseに従ってヘッダが書き換えられるよう、修正しました。
--
木下達也 (Tatsuya Kinoshita)
-------------- next part --------------
This patch is written by Tatsuya Kinoshita.
Permission is granted to use, copy, distribute and/or modify it
without restriction. There is NO WARRANTY.
diff -ur mew-1.95b79/mew-config.el mew-1.95b79-tats20001123/mew-config.el
--- mew-1.95b79/mew-config.el Tue Nov 21 16:44:22 2000
+++ mew-1.95b79-tats20001123/mew-config.el Thu Nov 23 08:51:24 2000
@@ -268,18 +268,18 @@
you can modify the locally stored value. Then this command replace
fields in the header according to the new value."
(interactive "P")
+ (mew-draft-set-config-and-replace-header
+ (if arg
+ (mew-input-config mew-draft-buffer-config "This draft" 'edit)
+ (mew-input-config (mew-draft-get-config-by-guess) "This draft"))))
+
+(defun mew-draft-set-config-and-replace-header (new-config)
(let ((old-config mew-draft-buffer-config))
- (setq mew-draft-buffer-config
- (if arg
- (mew-input-config mew-draft-buffer-config "This draft" 'edit)
- (mew-input-config
- (or (mew-draft-get-config-by-guess) mew-config-output)
- "This draft")))
+ (setq mew-draft-buffer-config new-config)
(mew-draft-mode-name mew-header-message)
(save-excursion
(goto-char (point-min))
- (let ((new-config mew-draft-buffer-config) ;; save length
- from cc dcc)
+ (let (from cc dcc)
(cond
((re-search-forward "^Resent" (mew-header-end) t)
(setq from mew-resent-from:)
@@ -297,8 +297,7 @@
(mew-header-delete-lines
(mapcar (function car) (mew-header-alist old-config)))
(mew-header-goto-end)
- (mew-draft-header-insert-alist
- (mew-header-alist mew-draft-buffer-config))
+ (mew-draft-header-insert-alist (mew-header-alist new-config))
(mew-highlight-header)
(if (null mew-header-message) (mew-draft-header-keymap)))
(save-buffer))))
@@ -308,11 +307,7 @@
(let ((cfgs (mew-refile-guess-by-alist1 mew-config-guess-alist)))
(if cfgs
(mew-join "," cfgs)
- nil)))
-
-(defun mew-draft-set-config-by-guess ()
- (let ((cfg (mew-draft-get-config-by-guess)))
- (if cfg (setq mew-draft-buffer-config cfg))))
+ mew-config-output)))
(provide 'mew-config)
diff -ur mew-1.95b79/mew-draft.el mew-1.95b79-tats20001123/mew-draft.el
--- mew-1.95b79/mew-draft.el Wed Nov 22 12:36:29 2000
+++ mew-1.95b79-tats20001123/mew-draft.el Thu Nov 23 08:51:09 2000
@@ -335,7 +335,6 @@
(mew-insert-address-list2 mew-cc: cc)
(mew-insert-address-list mew-cc: cc del nil))))
(mew-draft-header-insert mew-newsgroups: newsgroups)
- (mew-draft-set-config-by-guess) ;; xxx
(mew-draft-header-insert mew-cc: (mew-cc case))
(mew-draft-header-insert mew-subj: (or subject ""))
(mew-draft-header-insert mew-from: (mew-from case))
diff -ur mew-1.95b79/mew-edit.el mew-1.95b79-tats20001123/mew-edit.el
--- mew-1.95b79/mew-edit.el Wed Nov 22 12:36:29 2000
+++ mew-1.95b79-tats20001123/mew-edit.el Thu Nov 23 08:51:02 2000
@@ -502,6 +502,8 @@
(mew-summary-prepare-draft
(mew-draft-find-and-switch (mew-expand-folder fld msg)) ;; mew-cs-m17n
(mew-summary-edit-header-for-draft)
+ (if (not mew-config-insert-when-prepared)
+ (mew-draft-set-config-and-replace-header mew-config-output))
(mew-draft-mode)
(save-excursion
(if (mew-encode-load-syntax)
@@ -538,6 +540,8 @@
(mew-summary-edit-message fld msg part)
;; get info before backup the original
(mew-summary-edit-header-for-message)
+ (if (not mew-config-insert-when-prepared)
+ (mew-draft-set-config-and-replace-header mew-config-output))
(mew-draft-mode)
(if mew-encode-syntax
(save-excursion
diff -ur mew-1.95b79/mew-syntax.el mew-1.95b79-tats20001123/mew-syntax.el
--- mew-1.95b79/mew-syntax.el Mon Oct 9 19:55:28 2000
+++ mew-1.95b79-tats20001123/mew-syntax.el Thu Nov 23 08:50:47 2000
@@ -950,7 +950,10 @@
(defmacro mew-header-prepared (&optional header)
(` (progn
(mew-header-set (concat mew-header-separator "\n") (, header))
- (mew-highlight-header)
+ (if mew-config-insert-when-prepared
+ (mew-draft-set-config-and-replace-header
+ (mew-draft-get-config-by-guess))
+ (mew-highlight-header))
(if (null (, header)) (mew-draft-header-keymap)))))
(defmacro mew-draft-header-keymap ()
diff -ur mew-1.95b79/mew-vars.el mew-1.95b79-tats20001123/mew-vars.el
--- mew-1.95b79/mew-vars.el Mon Nov 20 21:31:08 2000
+++ mew-1.95b79-tats20001123/mew-vars.el Thu Nov 23 08:51:21 2000
@@ -1313,6 +1313,10 @@
"*If *non-nil*, this value is used to guess values of the Config: field.
The syntax is exactly the same as 'mew-refile-guess-alist'.")
+(defvar mew-config-insert-when-prepared nil
+ "*If *non-nil*, the Config is inserted according to
+'mew-config-guess-alist' when the draft is prepared.")
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Delete
Mew-dist メーリングリストの案内