annotate lisp/tm/tm-vm.el @ 98:0d2f883870bc r20-1b1

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