1 ;; -*- Mode: Emacs-Lisp -*-
2 ;; $Id: mew-virtual-thread.el,v 1.1 2000-05-23 08:31:16 steveb Exp $
4 ;; mew-virtual-thread.el --- "Virtual Thread mode for Mew, easy and safety :-)"
6 ;; "Hideyuki SHIRAI" <shirai@rdmg.mgcs.mei.co.jp>
7 ;; Created: <05/25/1999>
8 ;; Revised: Time-stamp: <09/02/1999 11:08 shirai>
11 ;;; 1. Put a below line on your ~/.emacs.
12 ;; (eval-after-load "mew" '(require 'mew-virtual-thread))
14 ;;; 2. When type the "T" in summary-mode, list the threaded messages.
15 ;;; Selection of the messages has the four ways as described below.
17 ;;; 2.1. without "C-u" and no "review mark".
18 ;;; => 'matched input REGEXP' messages.
19 ;;; 2.2. without "C-u" and some "review mark".
20 ;;; => marked messages.
21 ;;; 2.3. with "C-u" and the region.
22 ;;; => messages in the region.
23 ;;; 2.4. with "C-u" and no region.
24 ;;; => messages after point.
26 ;;; 3. When type the "T" in virtual-thread-mode with any marks,
27 ;;; The marks transfer to original folder.
30 (defconst mew-virtual-thread-version "mew-virtual-thread.el 0.16")
32 (eval-when-compile (require 'mew))
34 (defvar mew-virtual-thread-get-remote t
35 "If non-nil, get remote folder's messages, before make a threaded summary buffer.")
37 (add-hook 'mew-summary-mode-hook
39 (define-key mew-summary-mode-map "T" 'mew-virtual-thread)))
41 (defun mew-virtual-thread (&optional arg)
42 "\"Virtual Thread Mode\" execute."
44 (if (and (eq major-mode 'mew-virtual-mode)
45 mew-virtual-thread-original-folder)
46 (mew-virtual-thread-mark-transfer arg)
48 (if (not (mew-summary-exclusive-p))
50 (let* ((fld (buffer-name))
55 (setq range (mew-summary-mark-collect
56 mew-mark-review (point-min) (point-max)))
59 (call-interactively 'mew-virtual-thread-mark-regexp)
60 (setq range (mew-summary-mark-collect
61 mew-mark-review (point-min) (point-max)))
62 (mew-summary-batch-unmark (list mew-mark-review) nil)))
63 (if (or (and (boundp 'mark-active) mark-active)
64 (and (functionp 'region-exists-p) (region-exists-p)))
65 (setq range (mew-virtual-thread-number
66 (min (region-beginning) (region-end))
67 (max (region-beginning) (region-end))))
68 (setq range (mew-virtual-thread-number
69 (progn (beginning-of-line) (point)) (point-max)))))
70 (or (listp range) (setq range (list range)))
71 (if (and mew-virtual-thread-get-remote (mew-folder-remotep fld))
73 (goto-char (point-min))
74 (re-search-forward (concat "^ *" (car range)))