[Mew-dist 1884] mew-summary-search-parent
Mito
mit at example.com
1997年 9月 4日 (木) 19:52:35 JST
References か In-Reply-To ヘッダから親のメッセージを検索する
mew-summary-search-parent というのを以前からたま〜に使ってい
たのですが、imhist 対応してだいぶ使えるようになったので公開
します。
よかったら使ってください。
# MsgDBFile にないものは検索できません。
--
9/4 19:50頃
NECソフトウェア新潟 水戸
mailto:mit at example.com
-------------- next part --------------
(defvar mew-prog-imhist "imhist")
;(add-hook 'mew-summary-mode-hook
; '(lambda () (local-set-key "^" 'mew-summary-search-parent)))
(defun mew-summary-search-parent ()
(interactive)
(let ((folder (mew-summary-folder-name))
(pnum "0")
(nomatch t)
mess ref pid pf)
(if (not (or (mew-summary-message-number) (mew-summary-part-number)))
(error "No message")
(mew-summary-display t)
(setq mess (or (mew-cache-hit
(cons (buffer-name) (mew-summary-message-number)))
(mew-buffer-message)))
(set-mark (point))
(set-buffer mess)
(setq ref (mew-header-get-value "References:"))
(if ref ()
(setq ref (mew-header-get-value "In-Reply-To:")))
(if (and ref (string-match "<[^>]*>\\( *<[^>]*>\\)*" ref))
(setq ref (substring ref (match-beginning 0) (match-end 0))))
(if (not ref)
(error "No References header")
(while ref
(if (not (string-match "<[^>]*>" ref))
(setq ref nil)
(setq pid (substring ref (match-beginning 0) (match-end 0)))
(setq ref (substring ref (match-end 0)))))
(set-buffer (get-buffer-create mew-buffer-tmp))
(erase-buffer)
(message "searching parent...")
(call-process mew-prog-imhist nil t nil (concat "--lookup=" pid))
(message "searching parent...done")
(goto-char (point-min))
(while
(and nomatch
(re-search-forward "\\(\\+[^,]*\\)/\\([1-9][0-9]*\\)" nil t))
(let ((next (match-end 0)))
(setq pf (buffer-substring (match-beginning 1) (match-end 1)))
(setq pnum (buffer-substring
(match-beginning 2) (match-end 2)))
(if (string= folder pf)
(if (string= pnum "0")
(error "No parent message in this folder.")
(set-buffer folder)
(mew-summary-jump-message pnum)
(setq nomatch nil))
(goto-char next))))
(if nomatch
(if (string= pnum "0")
(error "No parent message")
(message (concat "Parent message is " pnum
" in " pf " folder"))))
))))
Mew-dist メーリングリストの案内