Initial Commit
[packages] / xemacs-packages / mew / mew / mew-virtual.el
1 ;;; mew-virtual.el --- Virtual mode for Mew
2
3 ;; Author:  Kazu Yamamoto <Kazu@Mew.org>
4 ;; Created: Oct  2, 1996
5 ;; Revised: Aug 30, 1999
6
7 ;;; Code:
8
9 (defconst mew-virtual-version "mew-virtual.el version 0.18")
10
11 (require 'mew)
12
13 ;;;
14 ;;; Virtual mode
15 ;;;
16
17 (defun mew-virtual-mode ()
18   "Mew Virtual mode:: major mode to visualize messages in a virtual folder.
19 For more information, see the document of 'mew-summary-mode'."
20   (interactive)
21   (setq major-mode 'mew-virtual-mode)
22   (setq mode-name "Virtual")
23   (setq mode-line-buffer-identification mew-mode-line-id)
24   (use-local-map mew-summary-mode-map)
25   (setq buffer-read-only t)
26   (setq truncate-lines t)
27   (setq selective-display t)
28   (setq selective-display-ellipses nil)
29   (mew-summary-setup-mode-line)
30   (mew-summary-setup-menu)
31   (mew-virtual-highlight-setup)
32   (mew-highlight-cursor-line)
33   (run-hooks 'mew-virtual-mode-hook))
34
35 (defun mew-virtual-folder-message ()
36   "Display the real folder of this message."
37   (interactive)
38   (looking-at "^ *\\([0-9]+\\).*\r\\(.*\\)$")
39   (message "%s" (mew-match 2)))
40
41 (defun mew-summary-virtual ()
42   "Create one Virtual mode with inputed pattern."
43   (interactive)
44   (mew-summary-only
45    (let ((folder (concat 
46                   "++" 
47                   (mew-input-string "Virtual folder name %s(%s): " 
48                                     "" ;; dummy
49                                     "virtual")))
50          (folders (mew-input-folders (buffer-name)))
51          (grep (mew-input-pick-pattern)))
52      (mew-folder-setup folder)
53      (mew-buffers-setup folder)
54      (mew-summary-scan-body mew-prog-imls
55                             'mew-virtual-mode
56                             folder
57                             mew-cs-virtual
58                             nil
59                             folders
60                             grep))))
61
62 (provide 'mew-virtual)
63
64 ;;; Copyright Notice:
65
66 ;; Copyright (C) 1996, 1997, 1998, 1999 Mew developing team.
67 ;; All rights reserved.
68
69 ;; Redistribution and use in source and binary forms, with or without
70 ;; modification, are permitted provided that the following conditions
71 ;; are met:
72 ;; 
73 ;; 1. Redistributions of source code must retain the above copyright
74 ;;    notice, this list of conditions and the following disclaimer.
75 ;; 2. Redistributions in binary form must reproduce the above copyright
76 ;;    notice, this list of conditions and the following disclaimer in the
77 ;;    documentation and/or other materials provided with the distribution.
78 ;; 3. Neither the name of the team nor the names of its contributors
79 ;;    may be used to endorse or promote products derived from this software
80 ;;    without specific prior written permission.
81 ;; 
82 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
83 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
84 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
85 ;; PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
86 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
87 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
88 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
89 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
90 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
91 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
92 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
93
94 ;;; mew-virtual.el ends here