[Mew-dist 06236] Re: refile-from-alist
SAKAI Kiyotaka
ksakai at example.com
1998年 9月 1日 (火) 13:55:37 JST
>> In article <19980901122100N.kazu at example.com>, Kazu Yamamoto (山本和彦) <kazu at example.com> writes:
>> # mew-refile.el では mew-refile-{from,msgid}-alist が nil だと
>> # mew-refile-alist-load を何度も呼び出していますが、Mew の起動時に
>> # 1回だけ呼び出すというのでは駄目なのでしょうか?
> 僕も常々そう nom さんに言っているんですがね。簡単に直るなら、直してく
> れると嬉しいです。
以下のように mew-refile-init という関数を定義して、その中で実行するよ
うにすればいいのではないでしょうか。
# mew.el から呼び出すのは、mew-init からではなく mew-set-environment
# からの方がいいかもしれませんが。
--
酒井 清隆 (E-mail: ksakai at example.com)
-------------- next part --------------
Index: mew-refile.el
===================================================================
RCS file: /home/cvsroot/mew-1.93pre2/mew-refile.el,v
retrieving revision 1.2
diff -u -r1.2 mew-refile.el
--- mew-refile.el 1998/09/01 04:38:32 1.2
+++ mew-refile.el 1998/09/01 04:45:55
@@ -73,6 +73,19 @@
"*If *non-nil*, mew-summary-auto-refile doesn't touch
any alredy marked message.")
+;;
+;; initialize function
+;;
+(defun mew-refile-init ()
+ ;; load message id alist
+ (or mew-refile-msgid-alist
+ (setq mew-refile-msgid-alist
+ (mew-refile-alist-load mew-refile-msgid-file-name)))
+ ;; load from alist
+ (or mew-refile-from-alist
+ (setq mew-refile-from-alist
+ (mew-refile-alist-load mew-refile-from-file-name))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Guess functions
@@ -225,10 +238,6 @@
(defun mew-refile-guess-by-msgid ()
(let ((msgid (or (mew-header-get-value mew-references:)
(mew-header-get-value mew-in-reply-to:))))
- ;; load message id alist
- (if (not mew-refile-msgid-alist)
- (setq mew-refile-msgid-alist
- (mew-refile-alist-load mew-refile-msgid-file-name)))
;; search for msgid
(if (and msgid
(string-match "\\(<[^ \t\n]*>\\)[^>]*\0" (concat msgid "\0")))
@@ -242,10 +251,6 @@
;;
(defun mew-refile-guess-by-from (&optional addr)
(let ((from (or addr (mew-header-parse-address mew-from:) "")) default)
- ;; load alist if not
- (if (not mew-refile-from-alist)
- (setq mew-refile-from-alist
- (mew-refile-alist-load mew-refile-from-file-name)))
;; search from alist
(setq default (mew-refile-guess-by-default from))
(if (file-exists-p (mew-expand-folder default))
@@ -327,10 +332,6 @@
(setq msgid (substring msgid (match-beginning 0) (match-end 0))))
(if (or (not msgid) (not chosen))
()
- ;; load message id alist
- (if (not mew-refile-msgid-alist)
- (setq mew-refile-msgid-alist
- (mew-refile-alist-load mew-refile-msgid-file-name)))
;; if my opninion was right, I learn it.
;; or a folder was not in other people's opinion,
;; I accept it.
@@ -366,10 +367,6 @@
(setq chosen (cdr chosen))))
(if folder
(progn
- ;; load message from alist
- (if (not mew-refile-from-alist)
- (setq mew-refile-from-alist
- (mew-refile-alist-load mew-refile-from-file-name)))
(setq mew-refile-from-alist
(mew-refile-alist-purge from mew-refile-from-alist))
(if mew-refile-from-alist
@@ -388,9 +385,6 @@
(defun mew-refile-treat-alias-insert (address)
(if (and (stringp address) (string-match "@" address))
(let (user)
- (if (not mew-refile-from-alist)
- (setq mew-refile-from-alist
- (mew-refile-alist-load mew-refile-from-file-name)))
;; Add empty information ("nom at example.com" . nil) if key is absent.
(if (assoc address mew-refile-from-alist)
()
@@ -411,10 +405,6 @@
;;
(defun mew-refile-alist-append-alias (alias-alist)
- ;; load alist if not
- (if (not mew-refile-from-alist)
- (setq mew-refile-from-alist
- (mew-refile-alist-load mew-refile-from-file-name)))
;; must be uniqfy for alias completion
(let ((loop-alist mew-refile-from-alist)
ret addr user)
@@ -468,10 +458,6 @@
(message "<%s> is not complete address notation.")
(if (not (y-or-n-p (format "Add alias for %s ? " addr)))
()
- ;; load alist if not
- (if (not mew-refile-from-alist)
- (setq mew-refile-from-alist
- (mew-refile-alist-load mew-refile-from-file-name)))
;; if key is absent, add empty information ("nom at example.com" . nil).
;; if key is already exists, move it to the top of the alist.
(if (setq value (assoc addr mew-refile-from-alist))
Index: mew.el
===================================================================
RCS file: /home/cvsroot/mew-1.93pre2/mew.el,v
retrieving revision 1.2
diff -u -r1.2 mew.el
--- mew.el 1998/09/01 02:51:44 1.2
+++ mew.el 1998/09/01 04:46:39
@@ -82,6 +82,7 @@
(mew-set-environment)
(if mew-use-bbdb (require 'bbdb-com)) ;; bbdb is implicitly required
(run-hooks 'mew-init-hook)
+ (mew-refile-init)
(mew-status-update t)
(message "Setting Mew world ... done"))
Mew-dist メーリングリストの案内