[Mew-dist 06770] mew-refile-view.el (Re: mew-refile.el)

Takashi P.KATOH p-katoh at example.com
1998年 10月 22日 (木) 12:23:10 JST


From: Hideyuki SHIRAI (白井秀行) <shirai at example.com>
Subject: [Mew-dist 06769] Re: mew-refile.el
> mew-refile.el の話が出ているので、便乗してお願いしてしまうのです
> が、refile 先を summary に表示する機能があると、*安心* できてあ
> りがたいです。

こんなのはどうでしょう?
表示されるのは Summary buffer じゃないですけど。

Summary buffer で M-x mew-refile-view とすると、

----------------------------------------
+mew/mew-06700
   65  10/21 Shun-ichi GOTO     [Mew-dist 06764] Re: Decode of From Line        
   66  10/21 Shun-ichi GOTO     [Mew-dist 06765] Re: Decode of From Line        
   67 M10/21 Kazumasa Utashiro  [Mew-dist 06766] Re: pick problem               
   68  10/21 Takahiro Kambe     [Mew-dist 06767] Re: pgp-mime in multi-part     
----------------------------------------

のように、refile 先の folder ごとに (別 buffer に) 表示され
ます。

私の場合は、ほとんどのメイルがメイリングリストからのものなの
でこういう方が便利なんですが、他の人にとっては... どうでしょ
う?
一々 M-x mew-refile-view とかしなきゃならんのは、ちょっと手
間かもしれませんが...
# key に bind するとしたら l か L あたりですかねぇ?


To do:
- code を綺麗に (特に mew-assoc-add)
- folder name の sort?
- pop-to-buffer でいい?
- mew-summary-refile が呼ばれたら mew-refile-view-buffer を 
  update (したいなぁ)

-- 
かとぺ / 加藤 貴司

-------------- next part --------------
;;; mew-refile-view.el --- View refile alist

;; Author:  Takashi P.KATOH <p-katoh at example.com>
;; Created: Oct 22, 1998
;; Revised: Oct 22, 1998

;;; Code:

(defconst mew-refile-view-version "mew-refile-view.el version 0.01")

(require 'mew)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; View refile alist
;;

(defconst mew-refile-view-buffer "*Mew refile view*")

(defun mew-assoc-add (key alist mem)
  (append (list (append (or (assoc key alist) (list key)) (list mem)))
	  (delete (assoc key alist) alist)))

(defun mew-refile-view-make-alist nil
  ;; mew-summary-buffer-refile -> '(("+foo" "1" "2") ("+bar" "3" "4"))
  (let (result (alist mew-summary-buffer-refile))
    (while alist
      (let ((flist (cdr (car alist))))
	(while flist
	  (setq result (mew-assoc-add (car flist) result (car (car alist)))
		flist (cdr flist))))
      (setq alist (cdr alist)))
    result))

(defun mew-refile-view ()
  (interactive)
  (if (null mew-summary-buffer-refile)
      (message "No refile marks")
    (let ((cb (current-buffer)) view str)
      (save-restriction
	(widen)
	(let ((alist (mew-refile-view-make-alist)) num numlist)
	  (setq view (pop-to-buffer mew-refile-view-buffer))
	  (erase-buffer)

	  ;; xxx sort alist?
	  (while alist
	    (set-buffer view)
	    (insert (concat (car (car alist)) "\n"))
	    (setq numlist (sort (cdr (car alist)) 'string<))
	    (while numlist
	      (setq num (car numlist)
		    numlist (cdr numlist))
	      ;;
	      (set-buffer cb)
	      (mew-summary-jump-message num)
	      (setq str
		    (buffer-substring (point)
				      (save-excursion (end-of-line) (point))))
	      ;;
	      (set-buffer view)
	      (insert str)
	      (let ((mew-highlight-mark-folder-list
		     (list mew-refile-view-buffer)))
		(mew-mark-unmark))
	      (insert "\n"))
	    (insert "\n")
	    (setq alist (cdr alist)))))
      (goto-char (point-min)))))

(provide 'mew-refile-view)

;;; Copyright Notice:

;; Copyright (C) 1998 Mew developing team.
;; All rights reserved.

;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;; 
;; 1. Redistributions of source code must retain the above copyright
;;    notice, this list of conditions and the following disclaimer.
;; 2. Redistributions in binary form must reproduce the above copyright
;;    notice, this list of conditions and the following disclaimer in the
;;    documentation and/or other materials provided with the distribution.
;; 3. Neither the name of the team nor the names of its contributors
;;    may be used to endorse or promote products derived from this software
;;    without specific prior written permission.
;; 
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
;; PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

;;; mew-refile-view.el ends here


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