annotate lisp/tm/tm-vm.el @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents 4b173ad71786
children 859a2309aef8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; tm-vm.el --- tm-MUA (MIME Extension module) for VM
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994,1995,1996 Free Software Foundation, Inc.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MASUTANI Yasuhiro <masutani@me.es.osaka-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; Kenji Wakamiya <wkenji@flab.fujitsu.co.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8 ;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;; Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; Created: 1994/10/29
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
12 ;; Version: $Revision: 1.3 $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; Keywords: mail, MIME, multimedia, multilingual, encoded-word
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; This file is part of tm (Tools for MIME).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 ;;; Commentary:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 ;; Plese insert `(require 'tm-vm)' in your ~/.vm file.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
38 (eval-when-compile
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
39 (require 'tm-edit)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
40 (require 'tm-mail)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
41 (require 'vm)
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
42 (require 'vm-window))
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
43
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 (require 'tm-view)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
45 (require 'vm-menu)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
46
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
47
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
48 ;;; @ Variables
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
49
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
50 ;;; @@ User customization variables
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
51
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
52 (defvar tm-vm/use-vm-bindings t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
53 "*If t, use VM compatible keybindings in MIME Preview buffers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
54 Otherwise TM generic bindings for content extraction/playing are
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
55 made available.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
56
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
57 (defvar tm-vm/attach-to-popup-menus t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
58 "*If t append MIME specific commands to VM's popup menus.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
59
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
60 (defvar tm-vm/use-original-url-button nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
61 "*If it is t, use original URL button instead of tm's.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
62
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
63 (defvar tm-vm/automatic-mime-preview t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
64 "*If non-nil, automatically process and show MIME messages.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
65
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
66 (defvar tm-vm/strict-mime t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
67 "*If nil, do MIME processing even if there is no MIME-Version field.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
68
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
69 (defvar tm-vm/use-ps-print (not (featurep 'mule))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
70 "*Use Postscript printing (ps-print) to print MIME messages.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
71
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
72 (defvar tm-vm-load-hook nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
73 "*List of functions called after tm-vm is loaded.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
74
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
75 (defvar tm-vm/select-message-hook nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
76 "*List of functions called every time a message is selected.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
77 tm-vm uses `vm-select-message-hook', use tm-vm/select-message-hook instead.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
78 When the hooks are run current buffer is either VM folder buffer with
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
79 the current message delimited by (point-min) and (point-max) or the MIME
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
80 Preview buffer.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
81
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
82 (defvar tm-vm/forward-message-hook vm-forward-message-hook
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
83 "*List of functions called after a Mail mode buffer has been
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
84 created to forward a message in message/rfc822 type format.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
85 If `vm-forwarding-digest-type' is \"rfc1521\", tm-vm runs this
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
86 hook instead of `vm-forward-message-hook'.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
87
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
88 (defvar tm-vm/send-digest-hook nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
89 "*List of functions called after a Mail mode buffer has been
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
90 created to send a digest in multipart/digest type format.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
91 If `vm-digest-send-type' is \"rfc1521\", tm-vm runs this hook
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
92 instead of `vm-send-digest-hook'.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
93
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
94
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
95 ;;; @@ System/Information variables
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (defconst tm-vm/RCS-ID
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
98 "$Id: tm-vm.el,v 1.3 1997/02/02 05:06:20 steve Exp $")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (defconst tm-vm/version (get-version-string tm-vm/RCS-ID))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
101 (defvar tm-vm/vm-emulation-map
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
102 (let ((map (make-sparse-keymap)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
103 (define-key map "h" 'vm-summarize)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
104 ;(define-key map "\M-n" 'vm-next-unread-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
105 ;(define-key map "\M-p" 'vm-previous-unread-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
106 (define-key map "n" 'vm-next-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
107 (define-key map "p" 'vm-previous-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
108 (define-key map "N" 'vm-next-message-no-skip)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
109 (define-key map "P" 'vm-previous-message-no-skip)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
110 ;(define-key map "\C-\M-n" 'vm-move-message-forward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
111 ;(define-key map "\C-\M-p" 'vm-move-message-backward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
112 ;(define-key map "\t" 'vm-goto-message-last-seen)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
113 ;(define-key map "\r" 'vm-goto-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
114 ;(define-key map "^" 'vm-goto-parent-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
115 (define-key map "t" 'vm-expose-hidden-headers)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
116 (define-key map " " 'vm-scroll-forward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
117 (define-key map "b" 'vm-scroll-backward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
118 (define-key map "\C-?" 'vm-scroll-backward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
119 ;(define-key map "d" 'vm-delete-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
120 ;(define-key map "\C-d" 'vm-delete-message-backward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
121 ;(define-key map "u" 'vm-undelete-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
122 ;(define-key map "U" 'vm-unread-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
123 ;(define-key map "e" 'vm-edit-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
124 ;(define-key map "a" 'vm-set-message-attributes)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
125 ;(define-key map "j" 'vm-discard-cached-data)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
126 ;(define-key map "k" 'vm-kill-subject)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
127 (define-key map "f" 'vm-followup)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
128 (define-key map "F" 'vm-followup-include-text)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
129 (define-key map "r" 'vm-reply)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
130 (define-key map "R" 'vm-reply-include-text)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
131 (define-key map "\M-r" 'vm-resend-bounced-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
132 (define-key map "B" 'vm-resend-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
133 (define-key map "z" 'vm-forward-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
134 ;(define-key map "c" 'vm-continue-composing-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
135 (define-key map "@" 'vm-send-digest)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
136 ;(define-key map "*" 'vm-burst-digest)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
137 (define-key map "m" 'vm-mail)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
138 (define-key map "g" 'vm-get-new-mail)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
139 ;(define-key map "G" 'vm-sort-messages)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
140 (define-key map "v" 'vm-visit-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
141 ;(define-key map "s" 'vm-save-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
142 ;(define-key map "w" 'vm-save-message-sans-headers)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
143 ;(define-key map "A" 'vm-auto-archive-messages)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
144 ;(define-key map "S" 'vm-save-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
145 ;(define-key map "|" 'vm-pipe-message-to-command)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
146 ;(define-key map "#" 'vm-expunge-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
147 (define-key map "q" 'vm-quit)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
148 (define-key map "x" 'vm-quit-no-change)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
149 (define-key map "i" 'vm-iconify-frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
150 (define-key map "?" 'vm-help)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
151 (define-key map "\C-_" 'vm-undo)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
152 (define-key map "\C-xu" 'vm-undo)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
153 (define-key map "!" 'shell-command)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
154 (define-key map "<" 'vm-beginning-of-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
155 (define-key map ">" 'vm-end-of-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
156 ;(define-key map "\M-s" 'vm-isearch-forward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
157 (define-key map "=" 'vm-summarize)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
158 ;(define-key map "L" 'vm-load-init-file)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
159 ;(define-key map "l" (make-sparse-keymap))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
160 ;(define-key map "la" 'vm-add-message-labels)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
161 ;(define-key map "ld" 'vm-delete-message-labels)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
162 ;(define-key map "V" (make-sparse-keymap))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
163 ;(define-key map "VV" 'vm-visit-virtual-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
164 ;(define-key map "VC" 'vm-create-virtual-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
165 ;(define-key map "VA" 'vm-apply-virtual-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
166 ;(define-key map "VM" 'vm-toggle-virtual-mirror)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
167 ;(define-key map "V?" 'vm-virtual-help)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
168 ;(define-key map "M" (make-sparse-keymap))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
169 ;(define-key map "MN" 'vm-next-command-uses-marks)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
170 ;(define-key map "Mn" 'vm-next-command-uses-marks)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
171 ;(define-key map "MM" 'vm-mark-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
172 ;(define-key map "MU" 'vm-unmark-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
173 ;(define-key map "Mm" 'vm-mark-all-messages)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
174 ;(define-key map "Mu" 'vm-clear-all-marks)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
175 ;(define-key map "MC" 'vm-mark-matching-messages)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
176 ;(define-key map "Mc" 'vm-unmark-matching-messages)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
177 ;(define-key map "MT" 'vm-mark-thread-subtree)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
178 ;(define-key map "Mt" 'vm-unmark-thread-subtree)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
179 ;(define-key map "MS" 'vm-mark-messages-same-subject)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
180 ;(define-key map "Ms" 'vm-unmark-messages-same-subject)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
181 ;(define-key map "MA" 'vm-mark-messages-same-author)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
182 ;(define-key map "Ma" 'vm-unmark-messages-same-author)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
183 ;(define-key map "M?" 'vm-mark-help)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
184 ;(define-key map "W" (make-sparse-keymap))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
185 ;(define-key map "WW" 'vm-apply-window-configuration)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
186 ;(define-key map "WS" 'vm-save-window-configuration)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
187 ;(define-key map "WD" 'vm-delete-window-configuration)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
188 ;(define-key map "W?" 'vm-window-help)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
189 ;(define-key map "\C-t" 'vm-toggle-threads-display)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
190 ;(define-key map "\C-x\C-s" 'vm-save-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
191 ;(define-key map "\C-x\C-w" 'vm-write-file)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
192 ;(define-key map "\C-x\C-q" 'vm-toggle-read-only)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
193 ;(define-key map "%" 'vm-change-folder-type)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
194 ;(define-key map "\M-C" 'vm-show-copying-restrictions)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
195 ;(define-key map "\M-W" 'vm-show-no-warranty)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
196 ;; suppress-keymap provides these, but now that we don't use
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
197 ;; suppress-keymap anymore...
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
198 (define-key map "0" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
199 (define-key map "1" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
200 (define-key map "2" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
201 (define-key map "3" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
202 (define-key map "4" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
203 (define-key map "5" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
204 (define-key map "6" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
205 (define-key map "7" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
206 (define-key map "8" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
207 (define-key map "9" 'digit-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
208 (define-key map "-" 'negative-argument)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
209 (if mouse-button-2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
210 (define-key map mouse-button-2 (function tm:button-dispatcher)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
211 (if (vm-menu-fsfemacs-menus-p)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
212 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
213 (vm-menu-initialize-vm-mode-menu-map)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
214 (define-key map [menu-bar]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
215 (lookup-key vm-mode-menu-map [rootmenu vm]))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
216 map)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
217 "VM emulation keymap for MIME-Preview buffers.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
218
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
219 (defvar tm-vm/popup-menu
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
220 (let (fsfmenu
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
221 (dummy (make-sparse-keymap))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
222 (menu (append vm-menu-dispose-menu
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
223 (list "----"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
224 (cons mime-viewer/menu-title
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
225 (mapcar (function
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
226 (lambda (item)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
227 (vector (nth 1 item)(nth 2 item) t)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
228 mime-viewer/menu-list))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
229 (if running-xemacs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
230 menu
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
231 (vm-easy-menu-define fsfmenu (list dummy) nil menu)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
232 fsfmenu))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
233 "VM's popup menu + MIME specific commands")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
234
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 (define-key vm-mode-map "Z" 'tm-vm/view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236 (define-key vm-mode-map "T" 'tm-vm/decode-message-header)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 (define-key vm-mode-map "\et" 'tm-vm/toggle-preview-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
240 ;;; @ MIME encoded-words
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242 (defvar tm-vm/use-tm-patch nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
243 "Does not decode encoded-words in summary buffer if it is t.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244 If you use tiny-mime patch for VM (by RIKITAKE Kenji
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 <kenji@reseau.toyonaka.osaka.jp>), please set it t [tm-vm.el]")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (or tm-vm/use-tm-patch
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 (defvar tm-vm/chop-full-name-function 'tm-vm/default-chop-full-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 (setq vm-chop-full-name-function tm-vm/chop-full-name-function)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 (defun tm-vm/default-chop-full-name (address)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 (let* ((ret (vm-default-chop-full-name address))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 (full-name (car ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (if (stringp full-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 (cons (mime-eword/decode-string full-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 (cdr ret))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260 ret)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 (require 'vm-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (or (fboundp 'tm:vm-su-subject)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (fset 'tm:vm-su-subject (symbol-function 'vm-su-subject))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 (defun vm-su-subject (m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (mime-eword/decode-string (tm:vm-su-subject m))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 (or (fboundp 'tm:vm-su-full-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 (fset 'tm:vm-su-full-name (symbol-function 'vm-su-full-name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273 (defun vm-su-full-name (m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 (mime-eword/decode-string (tm:vm-su-full-name m))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 (or (fboundp 'tm:vm-su-to-names)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 (fset 'tm:vm-su-to-names (symbol-function 'vm-su-to-names))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 (defun vm-su-to-names (m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 (mime-eword/decode-string (tm:vm-su-to-names m))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286 (defun tm-vm/decode-message-header (&optional count)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287 "Decode MIME header of current message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 Numeric prefix argument COUNT means to decode the current message plus
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
289 the next COUNT-1 messages. A negative COUNT means decode the current
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
290 message and the previous COUNT-1 messages.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
291 When invoked on marked messages (via vm-next-command-uses-marks),
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
292 all marked messages are affected, other messages are ignored."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
293 (interactive "p")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
294 (or count (setq count 1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
295 (vm-follow-summary-cursor)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
296 (vm-select-folder-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
297 (vm-check-for-killed-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
298 (vm-error-if-folder-empty)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
299 (vm-error-if-folder-read-only)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
300 (let ((mlist (vm-select-marked-or-prefixed-messages count))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
301 (realm nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302 (vlist nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 (vbufs nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
304 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 (while mlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 (setq realm (vm-real-message-of (car mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
307 ;; Go to real folder of this message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
308 ;; But maybe this message is already real message...
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309 (set-buffer (vm-buffer-of realm))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310 (let ((buffer-read-only nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (vm-save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 (narrow-to-region (vm-headers-of realm) (vm-text-of realm))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 (mime/decode-message-header))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314 (let ((vm-message-pointer (list realm))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315 (last-command nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 (vm-discard-cached-data))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 ;; Mark each virtual and real message for later summary
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 ;; update.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
319 (setq vlist (cons realm (vm-virtual-messages-of realm)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
320 (while vlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 (vm-mark-for-summary-update (car vlist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
322 ;; Remember virtual and real folders related this message,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 ;; for later display update.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 (or (memq (vm-buffer-of (car vlist)) vbufs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
325 (setq vbufs (cons (vm-buffer-of (car vlist)) vbufs)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
326 (setq vlist (cdr vlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
327 (if (eq vm-flush-interval t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
328 (vm-stuff-virtual-attributes realm)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
329 (vm-set-modflag-of realm t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
330 (setq mlist (cdr mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
331 ;; Update mail-buffers and summaries.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
332 (while vbufs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
333 (set-buffer (car vbufs))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
334 (vm-preview-current-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
335 (setq vbufs (cdr vbufs))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
336
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
337 (defun tm-vm/header-filter ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
338 "Filter headers in current buffer according to vm-visible-headers and vm-invisible-header-regexp.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
339 Current buffer is assumed to have a message-like structure."
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
341 (let ((visible-headers vm-visible-headers))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
342 (if (or vm-use-lucid-highlighting
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
343 vm-display-xfaces)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
344 (setq visible-headers (cons "X-Face:" vm-visible-headers)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
345 (vm-reorder-message-headers nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
346 visible-headers
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
347 vm-invisible-header-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
348 (mime/decode-message-header)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
349
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
350 (setq mime-viewer/content-header-filter-alist
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
351 (append '((vm-mode . tm-vm/header-filter)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
352 (vm-virtual-mode . tm-vm/header-filter))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
353 mime-viewer/content-header-filter-alist))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
354
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
355
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
356
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
357 ;;; @ MIME Viewer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
358
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
359 ;;; @@ MIME-Preview buffer management
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
360
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
361 (defvar tm-vm/system-state nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
362
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363 (defun tm-vm/system-state ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
364 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
365 (if mime::preview/article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
366 (set-buffer mime::preview/article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
367 (vm-select-folder-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
368 tm-vm/system-state))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
369
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
370 (defun tm-vm/build-preview-buffer ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
371 "Build the MIME Preview buffer for the current VM message.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
372 Current buffer should be VM's folder buffer."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
373
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
374 (set (make-local-variable 'tm-vm/system-state) 'mime-viewing)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
375 (setq vm-system-state 'reading)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
376
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
377 ;; Update message flags and store them in folder buffer before
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
378 ;; entering MIME viewer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
379 (tm-vm/update-message-status)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
380
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
381 ;; We need to save window configuration because we may be working
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
382 ;; in summary window
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
383 (save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
384 (save-restriction
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
385 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
386 (widen)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
387 (goto-char (vm-start-of (car vm-message-pointer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
388 (forward-line)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
389 (narrow-to-region (point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
390 (vm-end-of (car vm-message-pointer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
391
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
392 (let ((ml vm-message-list))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
393 (mime/viewer-mode nil nil nil nil nil nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
394 (setq vm-mail-buffer mime::preview/article-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
395 (setq vm-message-list ml))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
396 ;; Install VM toolbar for MIME-Preview buffer if not installed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
397 (tm-vm/check-for-toolbar)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
398 (if tm-vm/use-vm-bindings
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
399 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
400 (define-key tm-vm/vm-emulation-map "\C-c" (current-local-map))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
401 (use-local-map tm-vm/vm-emulation-map)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
402 (vm-menu-install-menubar)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
403 (if (and vm-use-menus
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
404 (vm-menu-support-possible-p))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
405 (setq mode-popup-menu tm-vm/popup-menu))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
406
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
407 ;; Highlight message (and display XFace if supported)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
408 (if (or vm-highlighted-header-regexp
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
409 (and (vm-xemacs-p) vm-use-lucid-highlighting))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
410 (vm-highlight-headers))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
411 ;; Energize URLs and buttons
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
412 (if (and tm-vm/use-original-url-button
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
413 vm-use-menus (vm-menu-support-possible-p))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
414 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
415 (vm-energize-urls)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
416 (vm-energize-headers)))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
417
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
418 (defun tm-vm/sync-preview-buffer ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
419 "Ensure that the MIME preview buffer, if it exists, actually corresponds to the current message.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
420 If no MIME Preview buffer is needed then kill it. If no
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
421 MIME Preview buffer exists nothing is done."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
422 ;; Current buffer should be message buffer when calling this function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
423 (let* ((mbuf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
424 (pbuf (and mime::article/preview-buffer
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
425 (get-buffer mime::article/preview-buffer))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
426 (if pbuf
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
427 ;; A MIME Preview buffer exists then it may need to be synch'ed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
428 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
429 (set-buffer mbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
430 (if (and tm-vm/strict-mime
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
431 (not (vm-get-header-contents (car vm-message-pointer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
432 "MIME-Version:")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
433 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
434 (setq mime::article/preview-buffer nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
435 tm-vm/system-state nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
436 (if pbuf (kill-buffer pbuf)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
437 (tm-vm/build-preview-buffer)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
438 ;; Return to previous frame
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
439 )))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
440
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
441 (defun tm-vm/toggle-preview-mode ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
442 "Toggle automatic MIME preview on or off.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
443 In automatic MIME Preview mode each newly selected article is MIME processed if
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
444 it has MIME content without need for an explicit request from the user. This
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
445 behaviour is controlled by the variable tm-vm/automatic-mime-preview."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
446
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
447 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
448 (if tm-vm/automatic-mime-preview
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
449 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
450 (tm-vm/quit-view-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
451 (setq tm-vm/automatic-mime-preview nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
452 (message "Automatic MIME Preview is now disabled."))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
453 ;; Enable Automatic MIME Preview
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
454 (tm-vm/view-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
455 (setq tm-vm/automatic-mime-preview t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
456 (message "Automatic MIME Preview is now enabled.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
457 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
458
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
459 ;;; @@ Display functions
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
460
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
461 (defun tm-vm/update-message-status ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
462 "Update current message display and summary.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
463 Remove 'unread' and 'new' flags. The MIME Preview buffer is not displayed,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
464 tm-vm/display-preview-buffer should be called for that. This function is
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
465 display-configuration safe."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
466 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
467 (set-buffer mime::preview/article-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
468 (vm-select-folder-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
469 (if (or (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
470 (get-buffer mime::article/preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
471 (vm-get-visible-buffer-window mime::article/preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
472 (vm-get-visible-buffer-window (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
473 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
474 (if (vm-new-flag (car vm-message-pointer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
475 (vm-set-new-flag (car vm-message-pointer) nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
476 (if (vm-unread-flag (car vm-message-pointer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
477 (vm-set-unread-flag (car vm-message-pointer) nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
478 (vm-update-summary-and-mode-line)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
479 (tm-vm/howl-if-eom))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
480 (vm-update-summary-and-mode-line)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
481
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
482 (defun tm-vm/display-preview-buffer ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
483 "Replace the VM message buffer with the MIME-Preview buffer if the VM message buffer is currently displayed or undisplay it if tm-vm/system-state is nil."
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
484 (let* ((mbuf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
485 (mwin (vm-get-visible-buffer-window mbuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
486 (pbuf (and mime::article/preview-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
487 (get-buffer mime::article/preview-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
488 (pwin (and pbuf (vm-get-visible-buffer-window pbuf))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
489 (if (and pbuf (tm-vm/system-state))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
490 ;; display preview buffer if preview-buffer exists
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
491 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
492 ((and mwin pwin)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
493 (vm-undisplay-buffer mbuf)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
494 (tm-vm/update-message-status))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
495 ((and mwin (not pwin))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
496 (set-window-buffer mwin pbuf)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
497 (tm-vm/update-message-status))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
498 (pwin
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
499 (tm-vm/update-message-status))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
500 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
501 ;; don't display if neither mwin nor pwin was displayed before.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
502 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
503 ;; display folder buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
504 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
505 ((and mwin pwin)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
506 (vm-undisplay-buffer pbuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
507 ((and (not mwin) pwin)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
508 (set-window-buffer pwin mbuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
509 (mwin
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
510 ;; folder buffer is already displayed.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
511 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
512 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
513 ;; don't display if neither mwin nor pwin was displayed before.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
514 )))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
515 (set-buffer mbuf)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
516
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
517 (defun tm-vm/preview-current-message ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
518 "Either preview message (view first lines only) or MIME-Preview it.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
519 The message is previewed if message previewing is enabled see vm-preview-lines.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
520 If not, MIME-Preview current message (ie. parse MIME
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
521 contents and display appropriately) if it has MIME contents and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
522 tm-vm/automatic-mime-preview is non nil. Installed on vm-visit-folder-hook and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
523 vm-select-message-hook."
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
524 ;; assumed current buffer is folder buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
525 (setq tm-vm/system-state nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
526 (if (get-buffer mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
527 (vm-undisplay-buffer mime/output-buffer-name))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
528 (if (and vm-message-pointer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
529 tm-vm/automatic-mime-preview
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
530 (or (null vm-preview-lines)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
531 (not (eq vm-system-state 'previewing))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
532 (and (not vm-preview-read-messages)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
533 (not (vm-new-flag (car vm-message-pointer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
534 (not (vm-unread-flag (car vm-message-pointer))))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
535 (if (or (not tm-vm/strict-mime)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
536 (vm-get-header-contents (car vm-message-pointer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
537 "MIME-Version:"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
538 ;; do MIME processing.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
539 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
540 (tm-vm/build-preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
541 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
542 (set-buffer mime::article/preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
543 (run-hooks 'tm-vm/select-message-hook)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
544 ;; don't do MIME processing. decode header only.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
545 (let (buffer-read-only)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
546 (mime/decode-message-header)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
547 (run-hooks 'tm-vm/select-message-hook))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
548 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
549 ;; don't preview; do nothing.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
550 (run-hooks 'tm-vm/select-message-hook))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
551 (tm-vm/display-preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
552
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
553 (defun tm-vm/view-message ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
554 "Decode and view the current VM message as a MIME encoded message.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
555 A MIME Preview buffer using mime/viewer-mode is created.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
556 See mime/viewer-mode for more information"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
557 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
558 (vm-follow-summary-cursor)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
559 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
560 (vm-check-for-killed-summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
561 (vm-error-if-folder-empty)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
562 (vm-display (current-buffer) t '(tm-vm/view-message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
563 tm-vm/toggle-preview-mode)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
564 '(tm-vm/view-message reading-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
565 (let ((tm-vm/automatic-mime-preview t))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
566 (tm-vm/preview-current-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
567 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
568
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
569 (defun tm-vm/quit-view-message ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
570 "Quit MIME-Viewer and go back to normal VM.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
571 MIME Preview buffer is killed. This function is called by `mime-viewer/quit'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
572 command via `mime-viewer/quitting-method-alist'."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
573 (if (get-buffer mime/output-buffer-name)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
574 (vm-undisplay-buffer mime/output-buffer-name))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
575 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
576 (let* ((mbuf (current-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
577 (pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
578 (get-buffer mime::article/preview-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
579 (pwin (and pbuf (vm-get-visible-buffer-window pbuf))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
580 (if pbuf (kill-buffer pbuf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
581 (and pwin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
582 (select-window pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
583 (switch-to-buffer mbuf)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
584 (setq tm-vm/system-state nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
585 (vm-display (current-buffer) t (list this-command)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
586 (list 'reading-message)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
587
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
588 (add-hook 'vm-select-message-hook 'tm-vm/preview-current-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
589 (add-hook 'vm-visit-folder-hook 'tm-vm/preview-current-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
590
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
591
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
592
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
593
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
594
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
595 ;;; @@ for tm-view
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
596
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
597 ;;; based on vm-do-reply [vm-reply.el]
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
598 (defun tm-vm/do-reply (buf to-all include-text)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
599 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
600 (set-buffer buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
601 (let ((dir default-directory)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
602 to cc subject in-reply-to references newsgroups)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
603 (cond ((setq to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
604 (let ((reply-to (std11-field-body "Reply-To")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
605 (if (vm-ignored-reply-to reply-to)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
606 nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
607 reply-to))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
608 ((setq to (std11-field-body "From")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
609 ;; (t (error "No From: or Reply-To: header in message"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
610 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
611 (if to-all
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
612 (setq cc (delq nil (cons cc (std11-field-bodies '("To" "Cc"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
613 cc (mapconcat 'identity cc ","))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
614 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
615 (setq subject (std11-field-body "Subject"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
616 (and subject vm-reply-subject-prefix
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
617 (let ((case-fold-search t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
618 (not
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
619 (equal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
620 (string-match (regexp-quote vm-reply-subject-prefix)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
621 subject)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
622 0)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
623 (setq subject (concat vm-reply-subject-prefix subject)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
624 (setq in-reply-to (std11-field-body "Message-Id")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
625 references (nconc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
626 (std11-field-bodies '("References" "In-Reply-To"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
627 (list in-reply-to))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
628 newsgroups (list (or (and to-all
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
629 (std11-field-body "Followup-To"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
630 (std11-field-body "Newsgroups"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
631 (setq to (vm-parse-addresses to)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
632 cc (vm-parse-addresses cc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
633 (if vm-reply-ignored-addresses
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
634 (setq to (vm-strip-ignored-addresses to)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
635 cc (vm-strip-ignored-addresses cc)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
636 (setq to (vm-delete-duplicates to nil t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
637 (setq cc (vm-delete-duplicates
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
638 (append (vm-delete-duplicates cc nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
639 to (copy-sequence to))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
640 t t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
641 (and to (setq to (mapconcat 'identity to ",\n ")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
642 (and cc (setq cc (mapconcat 'identity cc ",\n ")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
643 (and (null to) (setq to cc cc nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
644 (setq references (delq nil references)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
645 references (mapconcat 'identity references " ")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
646 references (vm-parse references "[^<]*\\(<[^>]+>\\)")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
647 references (vm-delete-duplicates references)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
648 references (if references (mapconcat 'identity references "\n\t")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
649 (setq newsgroups (delq nil newsgroups)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
650 newsgroups (mapconcat 'identity newsgroups ",")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
651 newsgroups (vm-parse newsgroups "[ \t\f\r\n,]*\\([^ \t\f\r\n,]+\\)")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
652 newsgroups (vm-delete-duplicates newsgroups)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
653 newsgroups (if newsgroups (mapconcat 'identity newsgroups ",")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
654 (vm-mail-internal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
655 (if to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
656 (format "reply to %s%s"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
657 (std11-full-name-string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
658 (car (std11-parse-address-string to)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
659 (if cc ", ..." "")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
660 to subject in-reply-to cc references newsgroups)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
661 (setq mail-reply-buffer buf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
662 ;; vm-system-state 'replying
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
663 default-directory dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
664 (if include-text
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
665 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
666 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
667 (let ((case-fold-search nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
668 (re-search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
669 (concat "^" (regexp-quote mail-header-separator) "$") nil 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
670 (forward-char 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
671 (tm-vm/yank-content)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
672 (run-hooks 'vm-reply-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
673 (run-hooks 'vm-mail-mode-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
674 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
675
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
676 (defun tm-vm/following-method (buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
677 (tm-vm/do-reply buf 'to-all 'include-text)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
678 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
679
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
680 (defun tm-vm/yank-content ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
681 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
682 (let ((this-command 'vm-yank-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
683 (vm-display nil nil '(vm-yank-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
684 '(vm-yank-message composing-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
685 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
686 (narrow-to-region (point)(point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
687 (insert-buffer mail-reply-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
688 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
689 (push-mark)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
690 (goto-char (point-min)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
691 (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
692 (mail-yank-hooks (run-hooks 'mail-yank-hooks))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
693 (t (mail-indent-citation)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
694 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
695
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
696 (set-alist 'mime-viewer/following-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
697 'vm-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
698 (function tm-vm/following-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
699 (set-alist 'mime-viewer/following-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
700 'vm-virtual-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
701 (function tm-vm/following-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
702
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
703
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
704 (set-alist 'mime-viewer/quitting-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
705 'vm-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
706 'tm-vm/quit-view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
707
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
708 (set-alist 'mime-viewer/quitting-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
709 'vm-virtual-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
710 'tm-vm/quit-view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
711
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
712 ;;; @@ Motion commands
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
713
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
714 (defmacro tm-vm/save-window-excursion (&rest forms)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
715 (list 'let '((tm-vm/selected-window (selected-window)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
716 (list 'unwind-protect
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
717 (cons 'progn forms)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
718 '(if (window-live-p tm-vm/selected-window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
719 (select-window tm-vm/selected-window)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
720
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
721 (defmacro tm-vm/save-frame-excursion (&rest forms)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
722 (list 'let '((tm-vm/selected-frame (vm-selected-frame)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
723 (list 'unwind-protect
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
724 (cons 'progn forms)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
725 '(if (frame-live-p tm-vm/selected-frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
726 (vm-select-frame tm-vm/selected-frame)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
727
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
728 (defadvice vm-scroll-forward (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
729 "Made TM-aware (handles the MIME-Preview buffer)."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
730 (if (and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
731 (not (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
732 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
733 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
734 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
735 (eq vm-system-state 'previewing)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
736 (not (tm-vm/system-state)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
737 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
738 ad-do-it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
739 (tm-vm/display-preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
740 (let* ((mp-changed (vm-follow-summary-cursor))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
741 (mbuf (or (vm-select-folder-buffer) (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
742 (mwin (vm-get-buffer-window mbuf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
743 (pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
744 (get-buffer mime::article/preview-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
745 (pwin (and pbuf (vm-get-buffer-window pbuf)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
746 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
747 (vm-check-for-killed-summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
748 (vm-error-if-folder-empty)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
749 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
750 ; A new message was selected
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
751 ; => leave it to tm-vm/preview-current-message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
752 (mp-changed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
753 nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
754 ((eq vm-system-state 'previewing)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
755 (vm-display (current-buffer) t (list this-command) '(reading-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
756 (vm-show-current-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
757 (tm-vm/preview-current-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
758 ; Preview buffer was killed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
759 ((null pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
760 (tm-vm/preview-current-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
761 ; Preview buffer was undisplayed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
762 ((null pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
763 (if (null mwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
764 (vm-display mbuf t '(vm-scroll-forward vm-scroll-backward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
765 (list this-command 'reading-message)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
766 (tm-vm/display-preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
767 ; Preview buffer is displayed => scroll
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
768 (t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
769 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
770 (select-window pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
771 (set-buffer pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
772 (if (pos-visible-in-window-p (point-max) pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
773 (vm-next-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
774 ;; not at the end of message. scroll preview buffer only.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
775 (scroll-up)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
776 (tm-vm/howl-if-eom))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
777 ))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
778 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
779 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
780
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
781 (defadvice vm-scroll-backward (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
782 "Made TM-aware (handles the MIME-Preview buffer)."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
783 (if (and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
784 (not (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
785 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
786 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
787 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
788 (eq vm-system-state 'previewing)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
789 (not (tm-vm/system-state)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
790 ad-do-it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
791 (let* ((mp-changed (vm-follow-summary-cursor))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
792 (mbuf (or (vm-select-folder-buffer) (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
793 (mwin (vm-get-buffer-window mbuf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
794 (pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
795 (get-buffer mime::article/preview-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
796 (pwin (and pbuf (vm-get-buffer-window pbuf)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
797 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
798 (vm-check-for-killed-summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
799 (vm-error-if-folder-empty)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
800 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
801 ; A new message was selected
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
802 ; => leave it to tm-vm/preview-current-message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
803 (mp-changed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
804 nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
805 ((eq vm-system-state 'previewing)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
806 (tm-vm/update-message-status)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
807 (setq vm-system-state 'reading)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
808 (tm-vm/preview-current-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
809 ; Preview buffer was killed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
810 ((null pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
811 (tm-vm/preview-current-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
812 ; Preview buffer was undisplayed
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
813 ((null pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
814 (if (null mwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
815 (vm-display mbuf t '(vm-scroll-forward vm-scroll-backward)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
816 (list this-command 'reading-message)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
817 (tm-vm/display-preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
818 ; Preview buffer is displayed => scroll
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
819 (t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
820 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
821 (select-window pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
822 (if (pos-visible-in-window-p (point-min) pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
823 nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
824 ;; not at the end of message. scroll preview buffer only.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
825 (scroll-down))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
826 ))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
827 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
828
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
829 (defadvice vm-beginning-of-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
830 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
831 (if (not (tm-vm/system-state))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
832 ad-do-it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
833 (vm-follow-summary-cursor)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
834 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
835 (vm-check-for-killed-summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
836 (vm-error-if-folder-empty)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
837 (let ((mbuf (current-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
838 (pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
839 (get-buffer mime::article/preview-buffer))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
840 (if (null pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
841 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
842 (tm-vm/preview-current-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
843 (setq pbuf (get-buffer mime::article/preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
844 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
845 (vm-display mbuf t '(vm-beginning-of-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
846 '(vm-beginning-of-message reading-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
847 (tm-vm/display-preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
848 (set-buffer pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
849 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
850 (select-window (vm-get-buffer-window pbuf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
851 (push-mark)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
852 (goto-char (point-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
853 ))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
854
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
855 (defadvice vm-end-of-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
856 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
857 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
858 (if (not (tm-vm/system-state))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
859 ad-do-it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
860 (vm-follow-summary-cursor)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
861 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
862 (vm-check-for-killed-summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
863 (vm-error-if-folder-empty)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
864 (let ((mbuf (current-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
865 (pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
866 (get-buffer mime::article/preview-buffer))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
867 (if (null pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
868 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
869 (tm-vm/preview-current-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
870 (setq pbuf (get-buffer mime::article/preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
871 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
872 (vm-display mbuf t '(vm-end-of-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
873 '(vm-end-of-message reading-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
874 (tm-vm/display-preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
875 (set-buffer pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
876 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
877 (select-window (vm-get-buffer-window pbuf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
878 (push-mark)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
879 (goto-char (point-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
880 ))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
881
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
882 ;;; based on vm-howl-if-eom [vm-page.el]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
883 (defun tm-vm/howl-if-eom ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
884 (let* ((pbuf (or mime::article/preview-buffer (current-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
885 (pwin (and (vm-get-visible-buffer-window pbuf))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
886 (and pwin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
887 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
888 (save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
889 (condition-case ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
890 (let ((next-screen-context-lines 0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
891 (tm-vm/save-frame-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
892 (vm-select-frame (vm-window-frame pwin))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
893 (save-selected-window
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
894 (select-window pwin)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
895 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
896 (let ((scroll-in-place-replace-original nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
897 (scroll-up)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
898 nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
899 (error t))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
900 (vm-emit-eom-blurb)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
901 )))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
902
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
903 (defadvice vm-emit-eom-blurb (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
904 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
905 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
906 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
907 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
908 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
909
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
910 (defadvice vm-next-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
911 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
912 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
913 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
914 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
915 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
916
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
917 (defadvice vm-previous-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
918 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
919 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
920 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
921 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
922 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
923
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
924 (defadvice vm-next-message-no-skip (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
925 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
926 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
927 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
928 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
929 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
930
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
931 (defadvice vm-previous-message-no-skip (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
932 "TM wrapper for vm-previous-message-no-skip (which see)."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
933 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
934 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
935 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
936 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
937
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
938 (defadvice vm-next-unread-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
939 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
940 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
941 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
942 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
943 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
944
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
945 (defadvice vm-previous-unread-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
946 "Made TM-aware, works properly in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
947 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
948 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
949 (tm-vm/save-window-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
950 ad-do-it))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
951
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
952
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
953 (set-alist 'mime-viewer/over-to-previous-method-alist
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
954 'vm-mode 'vm-previous-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
955 (set-alist 'mime-viewer/over-to-next-method-alist
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
956 'vm-mode 'vm-next-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
957 (set-alist 'mime-viewer/over-to-previous-method-alist
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
958 'vm-virtual-mode 'vm-previous-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
959 (set-alist 'mime-viewer/over-to-next-method-alist
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
960 'vm-virtual-mode 'vm-next-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
961
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
962
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
963
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
964
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
965
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
966
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
967 ;;; @ MIME Editor
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
968
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
969 ;;; @@ vm-yank-message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
970
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
971 (require 'vm-reply)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
972
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
973 (defvar tm-vm/yank:message-to-restore nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
974 "For internal use by tm-vm only.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
975
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
976 (defun vm-yank-message (&optional message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
977 "Yank message number N into the current buffer at point.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
978 When called interactively N is always read from the minibuffer. When
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
979 called non-interactively the first argument is expected to be a
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
980 message struct.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
981
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
982 This function originally provided by vm-reply has been patched for TM
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
983 in order to provide better citation of MIME messages : if a MIME
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
984 Preview buffer exists for the message then its contents are inserted
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
985 instead of the raw message.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
986
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
987 This command is meant to be used in VM created Mail mode buffers; the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
988 yanked message comes from the mail buffer containing the message you
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
989 are replying to, forwarding, or invoked VM's mail command from.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
990
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
991 All message headers are yanked along with the text. Point is
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
992 left before the inserted text, the mark after. Any hook
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
993 functions bound to mail-citation-hook are run, after inserting
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
994 the text and setting point and mark. For backward compatibility,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
995 if mail-citation-hook is set to nil, `mail-yank-hooks' is run
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
996 instead.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
997
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
998 If mail-citation-hook and mail-yank-hooks are both nil, this
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
999 default action is taken: the yanked headers are trimmed as
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1000 specified by vm-included-text-headers and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1001 vm-included-text-discard-header-regexp, and the value of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1002 vm-included-text-prefix is prepended to every yanked line."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1003 (interactive
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1004 (list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1005 ;; What we really want for the first argument is a message struct,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1006 ;; but if called interactively, we let the user type in a message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1007 ;; number instead.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1008 (let (mp default
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1009 (result 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1010 prompt
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1011 (last-command last-command)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1012 (this-command this-command))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1013 (if (bufferp vm-mail-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1014 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1015 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1016 (setq default (and vm-message-pointer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1017 (vm-number-of (car vm-message-pointer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1018 prompt (if default
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1019 (format "Yank message number: (default %s) "
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1020 default)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1021 "Yank message number: "))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1022 (while (zerop result)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1023 (setq result (read-string prompt))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1024 (and (string= result "") default (setq result default))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1025 (setq result (string-to-int result)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1026 (if (null (setq mp (nthcdr (1- result) vm-message-list)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1027 (error "No such message."))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1028 (setq tm-vm/yank:message-to-restore (string-to-int default))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1029 (save-selected-window
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1030 (vm-goto-message result))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1031 (car mp))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1032 nil))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1033 (if (null message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1034 (if mail-reply-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1035 (tm-vm/yank-content)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1036 (error "This is not a VM Mail mode buffer."))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1037 (if (null (buffer-name vm-mail-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1038 (error "The folder buffer containing message %d has been killed."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1039 (vm-number-of message)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1040 (vm-display nil nil '(vm-yank-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1041 '(vm-yank-message composing-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1042 (let ((b (current-buffer)) (start (point)) end)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1043 (save-restriction
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1044 (widen)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1045 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1046 (set-buffer (vm-buffer-of message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1047 (let (pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1048 (tm-vm/sync-preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1049 (setq pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1050 (get-buffer mime::article/preview-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1051 (if (and pbuf
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1052 (not (eq this-command 'vm-forward-message)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1053 ;; Yank contents of MIME Preview buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1054 (if running-xemacs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1055 (let ((tmp (generate-new-buffer "tm-vm/tmp")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1056 (set-buffer pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1057 (append-to-buffer tmp (point-min) (point-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1058 (set-buffer tmp)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1059 (map-extents
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1060 '(lambda (ext maparg)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1061 (set-extent-property ext 'begin-glyph nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1062 (append-to-buffer b (point-min) (point-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1063 (setq end (vm-marker
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1064 (+ start (length (buffer-string))) b))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1065 (kill-buffer tmp))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1066 (set-buffer pbuf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1067 (append-to-buffer b (point-min) (point-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1068 (setq end (vm-marker
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1069 (+ start (length (buffer-string))) b)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1070 ;; Yank contents of raw VM message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1071 (save-restriction
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1072 (setq message (vm-real-message-of message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1073 (set-buffer (vm-buffer-of message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1074 (widen)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1075 (append-to-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1076 b (vm-headers-of message) (vm-text-end-of message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1077 (setq end
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1078 (vm-marker (+ start (- (vm-text-end-of message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1079 (vm-headers-of message))) b))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1080 (push-mark end)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1081 (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1082 (mail-yank-hooks (run-hooks 'mail-yank-hooks))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1083 (t (vm-mail-yank-default message)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1084 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1085 (if tm-vm/yank:message-to-restore
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1086 (save-selected-window
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1087 (vm-goto-message tm-vm/yank:message-to-restore)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1088 (setq tm-vm/yank:message-to-restore nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1089 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1090
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1091 ;;; @@ for tm-partial
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1092 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1093
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1094 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1095 'tm-partial
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1096 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1097 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1098 (set-atype 'mime/content-decoding-condition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1099 '((type . "message/partial")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1100 (method . mime-article/grab-message/partials)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1101 (major-mode . vm-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1102 (summary-buffer-exp . vm-summary-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1103 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1104 (set-alist 'tm-partial/preview-article-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1105 'vm-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1106 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1107 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1108 (tm-vm/view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1109 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1110 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1111
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1112
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1113 ;;; @@ for tm-edit
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1114 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1115
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1116 (call-after-loaded
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1117 'mime-setup
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1118 (function
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1119 (lambda ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1120 (setq vm-forwarding-digest-type "rfc1521")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1121 (setq vm-digest-send-type "rfc1521")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1122 )))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1123
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1124 ;;; @@@ multipart/digest
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1125
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1126 (defun tm-vm/enclose-messages (mlist &optional preamble)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1127 "Enclose the messages in MLIST as multipart/digest.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1128 The resulting digest is inserted at point in the current buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1129
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1130 MLIST should be a list of message structs (real or virtual).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1131 These are the messages that will be enclosed."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1132 (if mlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1133 (let ((digest (consp (cdr mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1134 (mp mlist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1135 m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1136 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1137 (narrow-to-region (point) (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1138 (while mlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1139 (setq m (vm-real-message-of (car mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1140 (mime-editor/insert-tag "message" "rfc822")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1141 (tm-mail/insert-message m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1142 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1143 (setq mlist (cdr mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1144 (if preamble
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1145 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1146 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1147 (mime-editor/insert-tag "text" "plain")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1148 (vm-unsaved-message "Building digest preamble...")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1149 (while mp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1150 (let ((vm-summary-uninteresting-senders nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1151 (insert
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1152 (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1153 (if vm-digest-center-preamble
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1154 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1155 (forward-char -1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1156 (center-line)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1157 (forward-char 1)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1158 (setq mp (cdr mp)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1159 (if digest
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1160 (mime-editor/enclose-digest-region (point-min) (point-max)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1161 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1162
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1163 (defadvice vm-forward-message (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1164 "Extended to support rfc1521 multipart digests and to work properly in MIME-Preview buffers."
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1165 (if (not (equal vm-forwarding-digest-type "rfc1521"))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1166 ad-do-it
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1167 (if mime::preview/article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1168 (set-buffer mime::preview/article-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1169 (vm-follow-summary-cursor)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1170 (vm-select-folder-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1171 (vm-check-for-killed-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1172 (vm-error-if-folder-empty)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1173 (if (eq last-command 'vm-next-command-uses-marks)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1174 (let ((vm-digest-send-type vm-forwarding-digest-type))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1175 (setq this-command 'vm-next-command-uses-marks)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1176 (command-execute 'tm-vm/send-digest))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1177 (let ((dir default-directory)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1178 (mp vm-message-pointer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1179 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1180 (widen)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1181 (vm-mail-internal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1182 (format "forward of %s's note re: %s"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1183 (vm-su-full-name (car vm-message-pointer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1184 (vm-su-subject (car vm-message-pointer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1185 nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1186 (and vm-forwarding-subject-format
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1187 (let ((vm-summary-uninteresting-senders nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1188 (vm-sprintf 'vm-forwarding-subject-format (car mp)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1189 (make-local-variable 'vm-forward-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1190 (setq vm-system-state 'forwarding
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1191 vm-forward-list (list (car mp))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1192 default-directory dir)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1193 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1194 (re-search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1195 (concat "^" (regexp-quote mail-header-separator) "\n") nil 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1196 (tm-vm/enclose-messages vm-forward-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1197 (mail-position-on-field "To"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1198 (run-hooks 'tm-vm/forward-message-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1199 (run-hooks 'vm-mail-mode-hook)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1200
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1201 (defun tm-vm/send-digest (&optional arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1202 "Send a digest of all messages in the current folder to recipients.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1203 The type of the digest is specified by the variable vm-digest-send-type.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1204 You will be placed in a Mail mode buffer as is usual with replies, but you
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1205 must fill in the To: and Subject: headers manually.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1206
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1207 If invoked on marked messages (via vm-next-command-uses-marks),
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1208 only marked messages will be put into the digest."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1209 (interactive "P")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1210 (if (not (equal vm-digest-send-type "rfc1521"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1211 (vm-send-digest arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1212 (vm-select-folder-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1213 (vm-check-for-killed-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1214 (vm-error-if-folder-empty)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1215 (let ((dir default-directory)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1216 (vm-forward-list (if (eq last-command 'vm-next-command-uses-marks)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1217 (vm-select-marked-or-prefixed-messages 0)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1218 vm-message-list)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1219 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1220 (widen)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1221 (vm-mail-internal (format "digest from %s" (buffer-name)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1222 (setq vm-system-state 'forwarding
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1223 default-directory dir)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1224 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1225 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1226 "\n"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1227 (goto-char (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1228 (vm-unsaved-message "Building %s digest..." vm-digest-send-type)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1229 (tm-vm/enclose-messages vm-forward-list arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1230 (mail-position-on-field "To")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1231 (message "Building %s digest... done" vm-digest-send-type)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1232 (run-hooks 'tm-vm/send-digest-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1233 (run-hooks 'vm-mail-mode-hook)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1234
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1235 (substitute-key-definition 'vm-send-digest
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1236 'tm-vm/send-digest vm-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1237
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1238 ;;; @@@ Menus
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1239
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1240 ;;; modified by Steven L. Baur <steve@miranova.com>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1241 ;;; 1995/12/6 (c.f. [tm-en:209])
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1242 (defun mime-editor/attach-to-vm-mode-menu ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1243 "Arrange to attach MIME editor's popup menu to VM's"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1244 (if (boundp 'vm-menu-mail-menu)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1245 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1246 (setq vm-menu-mail-menu
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1247 (append vm-menu-mail-menu
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1248 (list "----"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1249 mime-editor/popup-menu-for-xemacs)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1250 (remove-hook 'vm-mail-mode-hook 'mime-editor/attach-to-vm-mode-menu)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1251 ))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1252 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1253
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1254 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1255 'tm-edit
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1256 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1257 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1258 (autoload 'tm-mail/insert-message "tm-mail")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1259 (set-alist 'mime-editor/message-inserter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1260 'mail-mode (function tm-mail/insert-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1261 (set-alist 'mime-editor/split-message-sender-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1262 'mail-mode (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1263 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1264 (interactive)
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1265 (funcall send-mail-function)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1266 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1267 (if (and (string-match "XEmacs\\|Lucid" emacs-version)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1268 tm-vm/attach-to-popup-menus)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1269 (add-hook 'vm-mail-mode-hook 'mime-editor/attach-to-vm-mode-menu)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1270 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1271 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1272
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1273
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1274
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1275 ;;; @ VM Integration
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1276
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1277 (add-hook 'vm-quit-hook 'tm-vm/quit-view-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1278
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1279 ;;; @@ Wrappers for miscellaneous VM functions
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1280
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1281 (defadvice vm-summarize (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1282 "Made TM aware. Callable from the MIME Preview buffer."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1283 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1284 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1285 ad-do-it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1286 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1287 (set-buffer vm-summary-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1288 (tm-vm/check-for-toolbar))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1289 (tm-vm/preview-current-message))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1290
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1291 (defadvice vm-expose-hidden-headers (around tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1292 "Made TM aware. Callable from the MIME Preview buffer."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1293 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1294 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1295 (let ((visible-headers vm-visible-headers))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1296 (tm-vm/quit-view-message)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1297 ad-do-it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1298 (let ((vm-visible-headers visible-headers))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1299 (if (= (point-min) (vm-start-of (car vm-message-pointer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1300 (setq vm-visible-headers '(".*")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1301 (tm-vm/preview-current-message))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1302
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1303 (if (vm-mouse-fsfemacs-mouse-p)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1304 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1305 (define-key tm-vm/vm-emulation-map [mouse-3] 'ignore)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1306 (define-key tm-vm/vm-emulation-map [down-mouse-3] 'vm-mouse-button-3)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1307 (defadvice vm-mouse-button-3 (after tm-aware activate)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1308 "Made TM aware. Works in MIME-Preview buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1309 (if (and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1310 vm-use-menus
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1311 (eq major-mode 'mime/viewer-mode))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1312 (vm-menu-popup-mode-menu event))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1313 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1314
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1315
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1316 ;;; @@ VM Toolbar Integration
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1317
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1318 (require 'vm-toolbar)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1319
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1320 ;;; based on vm-toolbar-any-messages-p [vm-toolbar.el]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1321 (defun tm-vm/check-for-toolbar ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1322 "Install VM toolbar if necessary."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1323 (if (and running-xemacs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1324 vm-toolbar-specifier)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1325 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1326 (if (null (specifier-instance vm-toolbar-specifier))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1327 (vm-toolbar-install-toolbar))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1328 (vm-toolbar-update-toolbar))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1329
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1330 (defun vm-toolbar-any-messages-p ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1331 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1332 (if mime::preview/article-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1333 (set-buffer mime::preview/article-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1334 (vm-check-for-killed-folder)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1335 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1336 vm-message-list))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1337
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1338
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1339 ;;; @ BBDB Integration
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1340 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1341
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1342 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1343 'bbdb
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1344 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1345 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1346 (require 'bbdb-vm)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1347 (require 'tm-bbdb)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1348 (defun tm-bbdb/vm-update-record (&optional offer-to-create)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1349 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1350 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1351 (if (and (tm-vm/system-state)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1352 mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1353 (get-buffer mime::article/preview-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1354 (let ((tm-bbdb/auto-create-p bbdb/mail-auto-create-p))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1355 (tm-bbdb/update-record offer-to-create))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1356 (or (bbdb/vm-update-record offer-to-create)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1357 (delete-windows-on (get-buffer "*BBDB*")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1358 )))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1359 (remove-hook 'vm-select-message-hook 'bbdb/vm-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1360 (remove-hook 'vm-show-message-hook 'bbdb/vm-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1361 (add-hook 'tm-vm/select-message-hook 'tm-bbdb/vm-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1362 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1363
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1364 ;;; @ ps-print (Suggested by Anders Stenman <stenman@isy.liu.se>)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1365 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1366
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1367 (if tm-vm/use-ps-print
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1368 (progn
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1369 (autoload 'ps-print-buffer-with-faces "ps-print" "Postscript Print" t)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1370 (add-hook 'vm-mode-hook 'tm-vm/ps-print-setup)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1371 (add-hook 'mime-viewer/define-keymap-hook 'tm-vm/ps-print-setup)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1372 (fset 'vm-toolbar-print-command 'tm-vm/print-message)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1373
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1374 (defun tm-vm/ps-print-setup ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1375 "Set things up for printing MIME messages with ps-print. Set binding to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1376 the [Print Screen] key."
8
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1377 (local-set-key (if running-xemacs
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1378 'f22
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1379 [f22])
4b173ad71786 Import from CVS: tag r19-15b5
cvs
parents: 4
diff changeset
1380 'tm-vm/print-message)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1381 (setq ps-header-lines 3)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1382 (setq ps-left-header
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1383 (list 'ps-article-subject 'ps-article-author 'buffer-name)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1384
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1385 (defun tm-vm/print-message ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1386 "Print current message with ps-print if it's a MIME message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1387 Value of tm-vm/strict-mime is also taken into consideration."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1388 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1389 (vm-follow-summary-cursor)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1390 (vm-select-folder-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1391 (tm-vm/sync-preview-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1392 (let ((pbuf (and mime::article/preview-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 8
diff changeset
1393 (get-buffer mime::article/preview-buffer))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1394 (if pbuf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1395 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1396 (set-buffer pbuf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1397 (require 'ps-print)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1398 (ps-print-buffer-with-faces))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1399 (vm-print-message))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1400
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1401
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1402 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1403
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1404 (provide 'tm-vm)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1405 (run-hooks 'tm-vm-load-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1406
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1407 ;;; tm-vm.el ends here.