annotate lisp/tm/tm-vm.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 7e54bd776075
children 54cc21c15cbb
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
12 ;; Version: $Revision: 1.1.1.1 $
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
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (require 'tm-view)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
39 (require 'vm)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 (defconst tm-vm/RCS-ID
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
42 "$Id: tm-vm.el,v 1.1.1.1 1996/12/18 22:43:38 steve Exp $")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 (defconst tm-vm/version (get-version-string tm-vm/RCS-ID))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 (define-key vm-mode-map "Z" 'tm-vm/view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (define-key vm-mode-map "T" 'tm-vm/decode-message-header)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 (define-key vm-mode-map "\et" 'tm-vm/toggle-preview-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
49 (defvar tm-vm/use-original-url-button nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
50 "*If it is t, use original URL button instead of tm's.")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
52 (defvar tm-vm-load-hook nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
53 "*List of functions called after tm-vm is loaded.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
54
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
55
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
56 ;;; @ for MIME encoded-words
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
57 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (defvar tm-vm/use-tm-patch nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 "Does not decode encoded-words in summary buffer if it is t.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 If you use tiny-mime patch for VM (by RIKITAKE Kenji
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 <kenji@reseau.toyonaka.osaka.jp>), please set it t [tm-vm.el]")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 (or tm-vm/use-tm-patch
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (progn
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
66 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
67 (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
68 (setq vm-chop-full-name-function tm-vm/chop-full-name-function)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
69
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
70 (defun tm-vm/default-chop-full-name (address)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
71 (let* ((ret (vm-default-chop-full-name address))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
72 (full-name (car ret))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
73 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
74 (if (stringp full-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
75 (cons (mime-eword/decode-string full-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
76 (cdr ret))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
77 ret)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
79 (require 'vm-summary)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
80 (or (fboundp 'tm:vm-su-subject)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
81 (fset 'tm:vm-su-subject (symbol-function 'vm-su-subject))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
82 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
83 (defun vm-su-subject (m)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
84 (mime-eword/decode-string (tm:vm-su-subject m))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
85 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
87 (or (fboundp 'tm:vm-su-full-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
88 (fset 'tm:vm-su-full-name (symbol-function 'vm-su-full-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
89 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
90 (defun vm-su-full-name (m)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
91 (mime-eword/decode-string (tm:vm-su-full-name m))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
92 )
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 20
diff changeset
93
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
94 (or (fboundp 'tm:vm-su-to-names)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
95 (fset 'tm:vm-su-to-names (symbol-function 'vm-su-to-names))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
96 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
97 (defun vm-su-to-names (m)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
98 (mime-eword/decode-string (tm:vm-su-to-names m))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
99 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
100 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (defun tm-vm/decode-message-header (&optional count)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 "Decode MIME header of current message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 Numeric prefix argument COUNT means to decode the current message plus
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 the next COUNT-1 messages. A negative COUNT means decode the current
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 message and the previous COUNT-1 messages.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 When invoked on marked messages (via vm-next-command-uses-marks),
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 all marked messages are affected, other messages are ignored."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 (interactive "p")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (or count (setq count 1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 (vm-follow-summary-cursor)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (vm-select-folder-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (vm-check-for-killed-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (vm-error-if-folder-empty)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (vm-error-if-folder-read-only)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (let ((mlist (vm-select-marked-or-prefixed-messages count))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (realm nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 (vlist nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (vbufs nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 (while mlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (setq realm (vm-real-message-of (car mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 ;; Go to real folder of this message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 ;; But maybe this message is already real message...
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (set-buffer (vm-buffer-of realm))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (let ((buffer-read-only nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (vm-save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (narrow-to-region (vm-headers-of realm) (vm-text-of realm))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 (mime/decode-message-header))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (let ((vm-message-pointer (list realm))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (last-command nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (vm-discard-cached-data))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 ;; Mark each virtual and real message for later summary
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 ;; update.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 (setq vlist (cons realm (vm-virtual-messages-of realm)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (while vlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 (vm-mark-for-summary-update (car vlist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 ;; Remember virtual and real folders related this message,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 ;; for later display update.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 (or (memq (vm-buffer-of (car vlist)) vbufs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (setq vbufs (cons (vm-buffer-of (car vlist)) vbufs)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 (setq vlist (cdr vlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (if (eq vm-flush-interval t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (vm-stuff-virtual-attributes realm)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (vm-set-modflag-of realm t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (setq mlist (cdr mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 ;; Update mail-buffers and summaries.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (while vbufs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (set-buffer (car vbufs))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (vm-preview-current-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (setq vbufs (cdr vbufs))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
154
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
155 ;;; @ automatic MIME preview
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
156 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
157
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
158 (defvar tm-vm/automatic-mime-preview t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
159 "*If non-nil, automatically process and show MIME messages.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
160
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
161 (defvar tm-vm/strict-mime t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
162 "*If nil, do MIME processing even if there is no MIME-Version field.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
163
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
164 (defvar tm-vm/select-message-hook nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
165 "*List of functions called every time a message is selected.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
166 tm-vm uses `vm-select-message-hook', use this hook instead.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
167
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
168 (defvar tm-vm/system-state nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
169
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
170 (setq mime-viewer/content-header-filter-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
171 (append '((vm-mode . tm-vm/header-filter)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
172 (vm-virtual-mode . tm-vm/header-filter))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
173 mime-viewer/content-header-filter-alist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
174
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 (defun tm-vm/header-filter ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
176 "Filter headers in current buffer (assumed to be a message-like buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
177 according to vm-visible-headers and vm-invisible-header-regexp"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
178 (beginning-of-buffer)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 (let ((visible-headers vm-visible-headers))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (if (or vm-use-lucid-highlighting
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 vm-display-xfaces)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (setq visible-headers (cons "X-Face:" vm-visible-headers)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 (vm-reorder-message-headers nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 visible-headers
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 vm-invisible-header-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (mime/decode-message-header)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 (defun tm-vm/system-state ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 (if mime::preview/article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (set-buffer mime::preview/article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 (vm-select-folder-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 tm-vm/system-state))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (defun tm-vm/sync-preview-buffer ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
196 "Ensure that the MIME preview buffer, if it exists actually corresponds to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
197 the current message. If no MIME Preview buffer is needed, delete it. If no
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 MIME Preview buffer exists nothing is done."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 ;; Current buffer should be message buffer when calling this function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 (let* ((mbuf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 (pbuf (and mime::article/preview-buffer
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
202 (get-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
203 (win (or (and pbuf (vm-get-buffer-window pbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
204 (vm-get-buffer-window mbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
205 (frame (selected-frame)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 (if pbuf
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
207 ;; Go to the frame where pbuf or mbuf is (frame-per-composition t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
208 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
209 (if win
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
210 (vm-select-frame (vm-window-frame win)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
211 ;; Rebuild MIME Preview buffer to ensure it corresponds to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
212 ;; current message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
213 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
214 (save-selected-window
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
215 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
216 (set-buffer mbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
217 (setq mime::article/preview-buffer nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
218 (if pbuf (kill-buffer pbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
219 (tm-vm/view-message)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 ;; Return to previous frame
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
221 (vm-select-frame frame)))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 (defun tm-vm/display-preview-buffer ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224 (let* ((mbuf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 (mwin (vm-get-visible-buffer-window mbuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 (pbuf (and mime::article/preview-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227 (get-buffer mime::article/preview-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
228 (pwin (and pbuf (vm-get-visible-buffer-window pbuf))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229 (if (and pbuf (tm-vm/system-state))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
230 ;; display preview buffer
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 ((and mwin pwin)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233 (vm-undisplay-buffer mbuf)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
234 (tm-vm/show-current-message))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 ((and mwin (not pwin))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236 (set-window-buffer mwin pbuf)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
237 (tm-vm/show-current-message))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 (pwin
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
239 (tm-vm/show-current-message))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241 ;; don't display if neither mwin nor pwin was displayed before.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
243 ;; display folder buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 ((and mwin pwin)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246 (vm-undisplay-buffer pbuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 ((and (not mwin) pwin)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 (set-window-buffer pwin mbuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (mwin
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 ;; folder buffer is already displayed.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 ;; don't display if neither mwin nor pwin was displayed before.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
254 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
255 (set-buffer mbuf)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (defun tm-vm/preview-current-message ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
258 "Preview current message if it has a MIME contents and
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
259 tm-vm/automatic-mime-preview is non nil. Installed on
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
260 vm-visit-folder-hook and vm-select-message-hook."
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 ;; assumed current buffer is folder buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 (setq tm-vm/system-state nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (if (get-buffer mime/output-buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (vm-undisplay-buffer mime/output-buffer-name))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
265 (if (and vm-message-pointer tm-vm/automatic-mime-preview)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 (if (or (not tm-vm/strict-mime)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (vm-get-header-contents (car vm-message-pointer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 "MIME-Version:"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 ;; do MIME processing.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
270 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
271 ;; Consider message as shown => update its flags and store them
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
272 ;; in folder buffer before entering MIME viewer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
273 (tm-vm/show-current-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
274 (set (make-local-variable 'tm-vm/system-state) 'previewing)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
275 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
276 (vm-widen-page)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
277 (goto-char (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
278 (widen)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
279 (narrow-to-region (point)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
280 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
281 (goto-char
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
282 (vm-start-of (car vm-message-pointer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
283 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
284 (forward-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
285 (point)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
286 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
287
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
288 (mime/viewer-mode nil nil nil nil nil vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
289 ;; Highlight message (and display XFace if supported)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
290 (if (or vm-highlighted-header-regexp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
291 (and (vm-xemacs-p) vm-use-lucid-highlighting))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
292 (vm-highlight-headers))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
293 ;; Energize URLs and buttons
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
294 (if (and tm-vm/use-original-url-button
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
295 vm-use-menus (vm-menu-support-possible-p))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
296 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
297 (vm-energize-urls)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
298 (vm-energize-headers)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
299 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
300 (narrow-to-region (point) (search-forward "\n\n" nil t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
301 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302 ;; don't do MIME processing. decode header only.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 (let (buffer-read-only)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
304 (mime/decode-message-header))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 ;; don't preview; do nothing.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
307 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
308 (tm-vm/display-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
309 (run-hooks 'tm-vm/select-message-hook))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
311 (defun tm-vm/show-current-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
312 "Update current message display and summary. Remove 'unread' and 'new' flags. "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
313 (if mime::preview/article-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
314 (set-buffer mime::preview/article-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
315 (vm-select-folder-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
316 (if mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
317 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
318 (set-buffer mime::article/preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
319 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
320 (widen)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
321 (if (or (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
322 (vm-get-visible-buffer-window mime::article/preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
323 (vm-get-visible-buffer-window (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
324 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
325 (setq tm-vm/system-state 'reading)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
326 (if (vm-new-flag (car vm-message-pointer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
327 (vm-set-new-flag (car vm-message-pointer) nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
328 (if (vm-unread-flag (car vm-message-pointer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
329 (vm-set-unread-flag (car vm-message-pointer) nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
330 (vm-update-summary-and-mode-line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
331 (tm-vm/howl-if-eom))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
332 (vm-update-summary-and-mode-line)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
333
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
334 (defun tm-vm/toggle-preview-mode ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
335 "Toggle automatic MIME preview on or off. In automatic MIME Preview mode
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
336 each newly selected article is MIME processed if it has MIME content without
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
337 need for an explicit request from the user. This behaviour is controlled by the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
338 variable tm-vm/automatic-mime-preview."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
339 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
340 (if tm-vm/automatic-mime-preview
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
341 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
342 (tm-vm/quit-view-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
343 (setq tm-vm/automatic-mime-preview nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
344 (message "Automatic MIME Preview is now disabled."))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
345 ;; Enable Automatic MIME Preview
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
346 (tm-vm/view-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
347 (setq tm-vm/automatic-mime-preview t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
348 (message "Automatic MIME Preview is now enabled.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
349 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
350
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
351 (add-hook 'vm-select-message-hook 'tm-vm/preview-current-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
352 (add-hook 'vm-visit-folder-hook 'tm-vm/preview-current-message)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
353
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
354 ;;; tm-vm move commands
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
355 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
356
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
357 (defmacro tm-vm/save-window-excursion (&rest forms)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
358 (list 'let '((tm-vm/selected-window (selected-window)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
359 (list 'unwind-protect
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
360 (cons 'progn forms)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
361 '(if (window-live-p tm-vm/selected-window)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
362 (select-window tm-vm/selected-window)))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
364 ;;; based on vm-scroll-forward [vm-page.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
365 (defun tm-vm/scroll-forward (&optional arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
366 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
367 (let ((this-command 'vm-scroll-forward))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
368 (if (not (tm-vm/system-state))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
369 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
370 (vm-scroll-forward arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
371 (tm-vm/display-preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
372 (let* ((mp-changed (vm-follow-summary-cursor))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
373 (mbuf (or (vm-select-folder-buffer) (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
374 (mwin (vm-get-buffer-window mbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
375 (pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
376 (get-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
377 (pwin (and pbuf (vm-get-buffer-window pbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
378 (was-invisible (and (null mwin) (null pwin)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
379 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
380 ;; now current buffer is folder buffer.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
381 (tm-vm/save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
382 (if (or mp-changed was-invisible)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
383 (vm-display mbuf t '(vm-scroll-forward vm-scroll-backward)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
384 (list this-command 'reading-message)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
385 (tm-vm/display-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
386 (setq mwin (vm-get-buffer-window mbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
387 pwin (and pbuf (vm-get-buffer-window pbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
388 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
389 ((or mp-changed was-invisible)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
390 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
391 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
392 ((null pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
393 ;; preview buffer is killed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
394 (tm-vm/preview-current-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
395 (vm-update-summary-and-mode-line))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
396 ((eq (tm-vm/system-state) 'previewing)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
397 (tm-vm/show-current-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
398 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
399 (select-window pwin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
400 (set-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
401 (if (pos-visible-in-window-p (point-max) pwin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
402 (tm-vm/next-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
403 ;; not end of message. scroll preview buffer only.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
404 (scroll-up)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
405 (tm-vm/howl-if-eom)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
406 (set-buffer mbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
407 ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
408 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
409
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
410 ;;; based on vm-scroll-backward [vm-page.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
411 (defun tm-vm/scroll-backward (&optional arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
412 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
413 (let ((this-command 'vm-scroll-backward))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
414 (if (not (tm-vm/system-state))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
415 (vm-scroll-backward arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
416 (let* ((mp-changed (vm-follow-summary-cursor))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
417 (mbuf (or (vm-select-folder-buffer) (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
418 (mwin (vm-get-buffer-window mbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
419 (pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
420 (get-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
421 (pwin (and pbuf (vm-get-buffer-window pbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
422 (was-invisible (and (null mwin) (null pwin)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
423 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
424 ;; now current buffer is folder buffer.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
425 (if (or mp-changed was-invisible)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
426 (vm-display mbuf t '(vm-scroll-forward vm-scroll-backward)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
427 (list this-command 'reading-message)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
428 (tm-vm/save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
429 (tm-vm/display-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
430 (setq mwin (vm-get-buffer-window mbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
431 pwin (and pbuf (vm-get-buffer-window pbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
432 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
433 (was-invisible
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
434 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
435 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
436 ((null pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
437 ;; preview buffer is killed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
438 (tm-vm/preview-current-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
439 (vm-update-summary-and-mode-line))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
440 ((eq (tm-vm/system-state) 'previewing)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
441 (tm-vm/show-current-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
442 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
443 (select-window pwin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
444 (set-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
445 (if (pos-visible-in-window-p (point-min) pwin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
446 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
447 ;; scroll preview buffer only.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
448 (scroll-down)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
449 (set-buffer mbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
450 ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
451 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
452
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
453 ;;; based on vm-beginning-of-message [vm-page.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
454 (defun tm-vm/beginning-of-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
455 "Moves to the beginning of the current message."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
456 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
457 (if (not (tm-vm/system-state))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
458 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
459 (setq this-command 'vm-beginning-of-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
460 (vm-beginning-of-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
461 (vm-follow-summary-cursor)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
462 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
463 (vm-check-for-killed-summary)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
464 (vm-error-if-folder-empty)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
465 (let ((mbuf (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
466 (pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
467 (get-buffer mime::article/preview-buffer))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
468 (if (null pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
469 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
470 (tm-vm/preview-current-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
471 (setq pbuf (get-buffer mime::article/preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
472 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
473 (vm-display mbuf t '(vm-beginning-of-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
474 '(vm-beginning-of-message reading-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
475 (tm-vm/display-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
476 (set-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
477 (tm-vm/save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
478 (select-window (vm-get-buffer-window pbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
479 (push-mark)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
480 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
481 ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
482
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
483 ;;; based on vm-end-of-message [vm-page.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
484 (defun tm-vm/end-of-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
485 "Moves to the end of the current message."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
486 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
487 (if (not (tm-vm/system-state))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
488 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
489 (setq this-command 'vm-end-of-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
490 (vm-end-of-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
491 (vm-follow-summary-cursor)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
492 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
493 (vm-check-for-killed-summary)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
494 (vm-error-if-folder-empty)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
495 (let ((mbuf (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
496 (pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
497 (get-buffer mime::article/preview-buffer))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
498 (if (null pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
499 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
500 (tm-vm/preview-current-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
501 (setq pbuf (get-buffer mime::article/preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
502 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
503 (vm-display mbuf t '(vm-end-of-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
504 '(vm-end-of-message reading-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
505 (tm-vm/display-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
506 (set-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
507 (tm-vm/save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
508 (select-window (vm-get-buffer-window pbuf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
509 (push-mark)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
510 (goto-char (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
511 ))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
512
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
513 ;;; based on vm-howl-if-eom [vm-page.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
514 (defun tm-vm/howl-if-eom ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
515 (let* ((pbuf (or mime::article/preview-buffer (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
516 (pwin (and (vm-get-visible-buffer-window pbuf))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
517 (and pwin
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
518 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
519 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
520 (condition-case ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
521 (let ((next-screen-context-lines 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
522 (select-window pwin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
523 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
524 (save-window-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
525 (let ((scroll-in-place-replace-original nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
526 (scroll-up))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
527 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
528 (error t))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
529 (tm-vm/emit-eom-blurb)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
530 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
531
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
532 ;;; based on vm-emit-eom-blurb [vm-page.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
533 (defun tm-vm/emit-eom-blurb ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
534 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
535 (if mime::preview/article-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
536 (set-buffer mime::preview/article-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
537 (vm-emit-eom-blurb)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
538
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
539 ;;; based on vm-quit [vm-folder.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
540 (defun tm-vm/quit ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
541 "Quit VM saving the folder buffer and killing the MIME Preview buffer if any"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
542 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
543 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
544 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
545 (if (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
546 (get-buffer mime::article/preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
547 (kill-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
548 (vm-quit))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
549
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
550 (defun tm-vm/quit-no-change ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
551 "Quit VM without saving the folder buffer but killing the MIME Preview buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
552 if any"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
553 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
554 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
555 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
556 (if (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
557 (get-buffer mime::article/preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
558 (kill-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
559 (vm-quit-no-change))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
560
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
561 (substitute-key-definition 'vm-scroll-forward
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
562 'tm-vm/scroll-forward vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
563 (substitute-key-definition 'vm-scroll-backward
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
564 'tm-vm/scroll-backward vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
565 (substitute-key-definition 'vm-beginning-of-message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
566 'tm-vm/beginning-of-message vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
567 (substitute-key-definition 'vm-end-of-message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
568 'tm-vm/end-of-message vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
569 (substitute-key-definition 'vm-quit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
570 'tm-vm/quit vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
571 (substitute-key-definition 'vm-quit-no-change
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
572 'tm-vm/quit-no-change vm-mode-map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
573
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
574 ;;; based on vm-next-message [vm-motion.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
575 (defun tm-vm/next-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
576 (set-buffer mime::preview/article-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
577 (let ((this-command 'vm-next-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
578 (owin (selected-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
579 (vm-preview-lines nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
580 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
581 (vm-next-message 1 nil t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
582 (if (window-live-p owin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
583 (select-window owin))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
584
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
585 ;;; based on vm-previous-message [vm-motion.el]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
586 (defun tm-vm/previous-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
587 (set-buffer mime::preview/article-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
588 (let ((this-command 'vm-previous-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
589 (owin (selected-window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
590 (vm-preview-lines nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
591 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
592 (vm-previous-message 1 nil t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
593 (if (window-live-p owin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
594 (select-window owin))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
595
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
596 (set-alist 'mime-viewer/over-to-previous-method-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
597 'vm-mode 'tm-vm/previous-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
598 (set-alist 'mime-viewer/over-to-next-method-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
599 'vm-mode 'tm-vm/next-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
600 (set-alist 'mime-viewer/over-to-previous-method-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
601 'vm-virtual-mode 'tm-vm/previous-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
602 (set-alist 'mime-viewer/over-to-next-method-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
603 'vm-virtual-mode 'tm-vm/next-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
604
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
605 ;;; @@ vm-yank-message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
606 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
607 ;; 1996/3/28 by Oscar Figueiredo <figueire@lspsun16.epfl.ch>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
608
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
609 (require 'vm-reply)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
610
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
611 (defvar tm-vm/yank:message-to-restore nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
612 "For internal use by tm-vm only.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
613
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
614 (defun vm-yank-message (&optional message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
615 "Yank message number N into the current buffer at point.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
616 When called interactively N is always read from the minibuffer. When
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
617 called non-interactively the first argument is expected to be a
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
618 message struct.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
619
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
620 This function originally provided by vm-reply has been patched for TM
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
621 in order to provide better citation of MIME messages : if a MIME
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
622 Preview buffer exists for the message then its contents are inserted
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
623 instead of the raw message.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
624
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
625 This command is meant to be used in VM created Mail mode buffers; the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
626 yanked message comes from the mail buffer containing the message you
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
627 are replying to, forwarding, or invoked VM's mail command from.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
628
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
629 All message headers are yanked along with the text. Point is
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
630 left before the inserted text, the mark after. Any hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
631 functions bound to mail-citation-hook are run, after inserting
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
632 the text and setting point and mark. For backward compatibility,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
633 if mail-citation-hook is set to nil, `mail-yank-hooks' is run
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
634 instead.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
635
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
636 If mail-citation-hook and mail-yank-hooks are both nil, this
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
637 default action is taken: the yanked headers are trimmed as
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
638 specified by vm-included-text-headers and
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
639 vm-included-text-discard-header-regexp, and the value of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
640 vm-included-text-prefix is prepended to every yanked line."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
641 (interactive
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
642 (list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
643 ;; What we really want for the first argument is a message struct,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
644 ;; but if called interactively, we let the user type in a message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
645 ;; number instead.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
646 (let (mp default
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
647 (result 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
648 prompt
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
649 (last-command last-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
650 (this-command this-command))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
651 (if (bufferp vm-mail-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
652 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
653 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
654 (setq default (and vm-message-pointer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
655 (vm-number-of (car vm-message-pointer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
656 prompt (if default
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
657 (format "Yank message number: (default %s) "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
658 default)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
659 "Yank message number: "))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
660 (while (zerop result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
661 (setq result (read-string prompt))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
662 (and (string= result "") default (setq result default))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
663 (setq result (string-to-int result)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
664 (if (null (setq mp (nthcdr (1- result) vm-message-list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
665 (error "No such message."))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
666 (setq tm-vm/yank:message-to-restore (string-to-int default))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
667 (save-selected-window
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
668 (vm-goto-message result))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
669 (car mp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
670 nil))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
671 (if (null message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
672 (if mail-reply-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
673 (tm-vm/yank-content)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
674 (error "This is not a VM Mail mode buffer."))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
675 (if (null (buffer-name vm-mail-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
676 (error "The folder buffer containing message %d has been killed."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
677 (vm-number-of message)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
678 (vm-display nil nil '(vm-yank-message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
679 '(vm-yank-message composing-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
680 (let ((b (current-buffer)) (start (point)) end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
681 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
682 (widen)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
683 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
684 (set-buffer (vm-buffer-of message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
685 (let* ((mbuf (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
686 pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
687 (tm-vm/sync-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
688 (setq pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
689 (get-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
690 (if pbuf
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
691 (if running-xemacs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
692 (let ((tmp (generate-new-buffer "tm-vm/tmp")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
693 (set-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
694 (append-to-buffer tmp (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
695 (set-buffer tmp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
696 (map-extents
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
697 '(lambda (ext maparg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
698 (set-extent-property ext 'begin-glyph nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
699 (append-to-buffer b (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
700 (setq end (vm-marker
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
701 (+ start (length (buffer-string))) b))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
702 (kill-buffer tmp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
703 (set-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
704 (append-to-buffer b (point-min) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
705 (setq end (vm-marker
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
706 (+ start (length (buffer-string))) b)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
707 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
708 (setq message (vm-real-message-of message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
709 (set-buffer (vm-buffer-of message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
710 (widen)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
711 (append-to-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
712 b (vm-headers-of message) (vm-text-end-of message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
713 (setq end
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
714 (vm-marker (+ start (- (vm-text-end-of message)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
715 (vm-headers-of message))) b))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
716 (push-mark end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
717 (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
718 (mail-yank-hooks (run-hooks 'mail-yank-hooks))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
719 (t (vm-mail-yank-default message)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
720 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
721 (if tm-vm/yank:message-to-restore
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
722 (save-selected-window
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
723 (vm-goto-message tm-vm/yank:message-to-restore)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
724 (setq tm-vm/yank:message-to-restore nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
725 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
726
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
727
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
728 ;;; @ for tm-view
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
729 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
730
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
731 ;;; based on vm-do-reply [vm-reply.el]
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
732 (defun tm-vm/do-reply (buf to-all include-text)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
733 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
734 (set-buffer buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
735 (let ((dir default-directory)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
736 to cc subject mp in-reply-to references newsgroups)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
737 (cond ((setq to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
738 (let ((reply-to (std11-field-body "Reply-To")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
739 (if (vm-ignored-reply-to reply-to)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
740 nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
741 reply-to))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
742 ((setq to (std11-field-body "From")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
743 ;; (t (error "No From: or Reply-To: header in message"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
744 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
745 (if to-all
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
746 (setq cc (delq nil (cons cc (std11-field-bodies '("To" "Cc"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
747 cc (mapconcat 'identity cc ","))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
748 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
749 (setq subject (std11-field-body "Subject"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
750 (and subject vm-reply-subject-prefix
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
751 (let ((case-fold-search t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
752 (not
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
753 (equal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
754 (string-match (regexp-quote vm-reply-subject-prefix)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
755 subject)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
756 0)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
757 (setq subject (concat vm-reply-subject-prefix subject)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
758 (setq in-reply-to (std11-field-body "Message-Id")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
759 references (nconc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
760 (std11-field-bodies '("References" "In-Reply-To"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
761 (list in-reply-to))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
762 newsgroups (list (or (and to-all
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
763 (std11-field-body "Followup-To"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
764 (std11-field-body "Newsgroups"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
765 (setq to (vm-parse-addresses to)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
766 cc (vm-parse-addresses cc))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
767 (if vm-reply-ignored-addresses
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
768 (setq to (vm-strip-ignored-addresses to)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
769 cc (vm-strip-ignored-addresses cc)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
770 (setq to (vm-delete-duplicates to nil t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
771 (setq cc (vm-delete-duplicates
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
772 (append (vm-delete-duplicates cc nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
773 to (copy-sequence to))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
774 t t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
775 (and to (setq to (mapconcat 'identity to ",\n ")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
776 (and cc (setq cc (mapconcat 'identity cc ",\n ")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
777 (and (null to) (setq to cc cc nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
778 (setq references (delq nil references)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
779 references (mapconcat 'identity references " ")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
780 references (vm-parse references "[^<]*\\(<[^>]+>\\)")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
781 references (vm-delete-duplicates references)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
782 references (if references (mapconcat 'identity references "\n\t")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
783 (setq newsgroups (delq nil newsgroups)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
784 newsgroups (mapconcat 'identity newsgroups ",")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
785 newsgroups (vm-parse newsgroups "[ \t\f\r\n,]*\\([^ \t\f\r\n,]+\\)")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
786 newsgroups (vm-delete-duplicates newsgroups)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
787 newsgroups (if newsgroups (mapconcat 'identity newsgroups ",")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
788 (vm-mail-internal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
789 (if to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
790 (format "reply to %s%s"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
791 (std11-full-name-string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
792 (car (std11-parse-address-string to)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
793 (if cc ", ..." "")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
794 to subject in-reply-to cc references newsgroups)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
795 (setq mail-reply-buffer buf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
796 ;; vm-system-state 'replying
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
797 default-directory dir))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
798 (if include-text
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
799 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
800 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
801 (let ((case-fold-search nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
802 (re-search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
803 (concat "^" (regexp-quote mail-header-separator) "$") nil 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
804 (forward-char 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
805 (tm-vm/yank-content)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
806 (run-hooks 'vm-reply-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
807 (run-hooks 'vm-mail-mode-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
808 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
809
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
810 (defun tm-vm/following-method (buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
811 (tm-vm/do-reply buf 'to-all 'include-text)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
812 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
813
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
814 (defun tm-vm/yank-content ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
815 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
816 (let ((this-command 'vm-yank-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
817 (vm-display nil nil '(vm-yank-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
818 '(vm-yank-message composing-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
819 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
820 (narrow-to-region (point)(point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
821 (insert-buffer mail-reply-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
822 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
823 (push-mark)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
824 (goto-char (point-min)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
825 (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
826 (mail-yank-hooks (run-hooks 'mail-yank-hooks))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
827 (t (mail-indent-citation)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
828 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
829
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
830 (set-alist 'mime-viewer/following-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
831 'vm-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
832 (function tm-vm/following-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
833 (set-alist 'mime-viewer/following-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
834 'vm-virtual-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
835 (function tm-vm/following-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
836
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
837
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
838 (defun tm-vm/quit-view-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
839 "Quit MIME-Viewer and go back to normal VM. MIME Preview buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
840 is killed. This function is called by `mime-viewer/quit' command
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
841 via `mime-viewer/quitting-method-alist'."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
842 (if (get-buffer mime/output-buffer-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
843 (vm-undisplay-buffer mime/output-buffer-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
844 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
845 (let* ((mbuf (current-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
846 (pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
847 (get-buffer mime::article/preview-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
848 (pwin (and pbuf (vm-get-visible-buffer-window pbuf))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
849 (kill-buffer pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
850 (and pwin
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
851 (select-window pwin)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
852 (switch-to-buffer mbuf)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
853 (setq tm-vm/system-state nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
854 (vm-display (current-buffer) t (list this-command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
855 (list 'reading-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
856 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
857
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
858 (defun tm-vm/view-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
859 "Decode and view a MIME encoded message under VM.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
860 A MIME Preview buffer using mime/viewer-mode is created.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
861 See mime/viewer-mode for more information"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
862 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
863 (vm-follow-summary-cursor)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
864 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
865 (vm-check-for-killed-summary)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
866 (vm-error-if-folder-empty)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
867 (vm-display (current-buffer) t '(tm-vm/view-message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
868 tm-vm/toggle-preview-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
869 '(tm-vm/view-message reading-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
870 (let ((tm-vm/automatic-mime-preview t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
871 (tm-vm/preview-current-message))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
872 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
873
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
874 (set-alist 'mime-viewer/quitting-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
875 'vm-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
876 'tm-vm/quit-view-message)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
877
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
878 (set-alist 'mime-viewer/quitting-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
879 'vm-virtual-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
880 'tm-vm/quit-view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
881
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
882
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
883 ;;; @ for tm-partial
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
884 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
885
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
886 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
887 'tm-partial
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
888 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
889 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
890 (set-atype 'mime/content-decoding-condition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
891 '((type . "message/partial")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
892 (method . mime-article/grab-message/partials)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
893 (major-mode . vm-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
894 (summary-buffer-exp . vm-summary-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
895 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
896 (set-alist 'tm-partial/preview-article-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
897 'vm-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
898 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
899 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
900 (tm-vm/view-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
901 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
902 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
903
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
904
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
905 ;;; @ for tm-edit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
906 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
907
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
908 ;;; @@ for multipart/digest
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
909 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
910
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
911 (defvar tm-vm/forward-message-hook nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
912 "*List of functions called after a Mail mode buffer has been
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
913 created to forward a message in message/rfc822 type format.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
914 If `vm-forwarding-digest-type' is \"rfc1521\", tm-vm runs this
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
915 hook instead of `vm-forward-message-hook'.")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
916
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
917 (defvar tm-vm/send-digest-hook nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
918 "*List of functions called after a Mail mode buffer has been
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
919 created to send a digest in multipart/digest type format.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
920 If `vm-digest-send-type' is \"rfc1521\", tm-vm runs this hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
921 instead of `vm-send-digest-hook'.")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
922
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
923 (defun tm-vm/enclose-messages (mlist &optional preamble)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
924 "Enclose the messages in MLIST as multipart/digest.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
925 The resulting digest is inserted at point in the current buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
926
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
927 MLIST should be a list of message structs (real or virtual).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
928 These are the messages that will be enclosed."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
929 (if mlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
930 (let ((digest (consp (cdr mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
931 (mp mlist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
932 m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
933 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
934 (narrow-to-region (point) (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
935 (while mlist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
936 (setq m (vm-real-message-of (car mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
937 (mime-editor/insert-tag "message" "rfc822")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
938 (tm-mail/insert-message m)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
939 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
940 (setq mlist (cdr mlist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
941 (if preamble
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
942 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
943 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
944 (mime-editor/insert-tag "text" "plain")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
945 (vm-unsaved-message "Building digest preamble...")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
946 (while mp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
947 (let ((vm-summary-uninteresting-senders nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
948 (insert
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
949 (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
950 (if vm-digest-center-preamble
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
951 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
952 (forward-char -1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
953 (center-line)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
954 (forward-char 1)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
955 (setq mp (cdr mp)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
956 (if digest
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
957 (mime-editor/enclose-digest-region (point-min) (point-max)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
958 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
959
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
960 (defun tm-vm/forward-message ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
961 "Forward the current message to one or more recipients.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
962 You will be placed in a Mail mode buffer as you would with a
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
963 reply, but you must fill in the To: header and perhaps the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
964 Subject: header manually."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
965 (interactive)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
966 (if (not (equal vm-forwarding-digest-type "rfc1521"))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
967 (vm-forward-message)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
968 (vm-follow-summary-cursor)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
969 (vm-select-folder-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
970 (vm-check-for-killed-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
971 (vm-error-if-folder-empty)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
972 (if (eq last-command 'vm-next-command-uses-marks)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
973 (let ((vm-digest-send-type vm-forwarding-digest-type))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
974 (setq this-command 'vm-next-command-uses-marks)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
975 (command-execute 'tm-vm/send-digest))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
976 (let ((dir default-directory)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
977 (mp vm-message-pointer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
978 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
979 (widen)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
980 (vm-mail-internal
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
981 (format "forward of %s's note re: %s"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
982 (vm-su-full-name (car vm-message-pointer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
983 (vm-su-subject (car vm-message-pointer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
984 nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
985 (and vm-forwarding-subject-format
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
986 (let ((vm-summary-uninteresting-senders nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
987 (vm-sprintf 'vm-forwarding-subject-format (car mp)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
988 (make-local-variable 'vm-forward-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
989 (setq vm-system-state 'forwarding
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
990 vm-forward-list (list (car mp))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
991 default-directory dir)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
992 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
993 (re-search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
994 (concat "^" (regexp-quote mail-header-separator) "\n") nil 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
995 (tm-vm/enclose-messages vm-forward-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
996 (mail-position-on-field "To"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
997 (run-hooks 'tm-vm/forward-message-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
998 (run-hooks 'vm-mail-mode-hook)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
999
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1000 (defun tm-vm/send-digest (&optional arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1001 "Send a digest of all messages in the current folder to recipients.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1002 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
1003 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
1004 must fill in the To: and Subject: headers manually.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1005
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1006 If invoked on marked messages (via vm-next-command-uses-marks),
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1007 only marked messages will be put into the digest."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1008 (interactive "P")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1009 (if (not (equal vm-digest-send-type "rfc1521"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1010 (vm-send-digest arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1011 (vm-select-folder-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1012 (vm-check-for-killed-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1013 (vm-error-if-folder-empty)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1014 (let ((dir default-directory)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1015 (vm-forward-list (if (eq last-command 'vm-next-command-uses-marks)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1016 (vm-select-marked-or-prefixed-messages 0)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1017 vm-message-list))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1018 start)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1019 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1020 (widen)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1021 (vm-mail-internal (format "digest from %s" (buffer-name)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1022 (setq vm-system-state 'forwarding
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1023 default-directory dir)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1024 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1025 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1026 "\n"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1027 (goto-char (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1028 (vm-unsaved-message "Building %s digest..." vm-digest-send-type)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1029 (tm-vm/enclose-messages vm-forward-list arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1030 (mail-position-on-field "To")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1031 (message "Building %s digest... done" vm-digest-send-type)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1032 (run-hooks 'tm-vm/send-digest-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1033 (run-hooks 'vm-mail-mode-hook)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1034
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1035 (substitute-key-definition 'vm-forward-message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1036 'tm-vm/forward-message vm-mode-map)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1037 (substitute-key-definition 'vm-send-digest
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1038 'tm-vm/send-digest vm-mode-map)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1039
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1040
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1041 ;;; @@ setting
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1042 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1043
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1044 (defvar tm-vm/use-xemacs-popup-menu t)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1045
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1046 ;;; modified by Steven L. Baur <steve@miranova.com>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1047 ;;; 1995/12/6 (c.f. [tm-en:209])
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1048 (defun mime-editor/attach-to-vm-mode-menu ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1049 "Arrange to attach MIME editor's popup menu to VM's"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1050 (if (boundp 'vm-menu-mail-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1051 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1052 (setq vm-menu-mail-menu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1053 (append vm-menu-mail-menu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1054 (list "----"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1055 mime-editor/popup-menu-for-xemacs)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1056 (remove-hook 'vm-mail-mode-hook 'mime-editor/attach-to-vm-mode-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1057 )))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1058
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1059 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1060 'tm-edit
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1061 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1062 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1063 (autoload 'tm-mail/insert-message "tm-mail")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1064 (set-alist 'mime-editor/message-inserter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1065 'mail-mode (function tm-mail/insert-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1066 (set-alist 'mime-editor/split-message-sender-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1067 'mail-mode (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1068 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1069 (interactive)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1070 (sendmail-send-it)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1071 )))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1072 (if (and (string-match "XEmacs\\|Lucid" emacs-version)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1073 tm-vm/use-xemacs-popup-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1074 (add-hook 'vm-mail-mode-hook 'mime-editor/attach-to-vm-mode-menu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1075 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1076 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1077
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1078 (call-after-loaded
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1079 'mime-setup
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1080 (function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1081 (lambda ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1082 (setq vm-forwarding-digest-type "rfc1521")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1083 (setq vm-digest-send-type "rfc1521")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1084 )))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1085
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1086
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1087 ;;; @ for BBDB
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1088 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1089
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1090 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1091 'bbdb
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1092 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1093 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1094 (require 'bbdb-vm)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1095 (require 'tm-bbdb)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1096 (defun tm-bbdb/vm-update-record (&optional offer-to-create)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1097 (vm-select-folder-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1098 (if (and (tm-vm/system-state)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1099 mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1100 (get-buffer mime::article/preview-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1101 (let ((tm-bbdb/auto-create-p bbdb/mail-auto-create-p))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1102 (tm-bbdb/update-record offer-to-create))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1103 (or (bbdb/vm-update-record offer-to-create)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1104 (delete-windows-on (get-buffer "*BBDB*")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1105 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1106 (remove-hook 'vm-select-message-hook 'bbdb/vm-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1107 (remove-hook 'vm-show-message-hook 'bbdb/vm-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1108 (add-hook 'tm-vm/select-message-hook 'tm-bbdb/vm-update-record)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1109 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1110
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1111 ;;; @ for ps-print (Suggestted by Anders Stenman <stenman@isy.liu.se>)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1112 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1113
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1114 (require 'ps-print)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1115
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1116 (add-hook 'vm-mode-hook 'tm-vm/ps-print-setup)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1117 (add-hook 'mime-viewer/define-keymap-hook 'tm-vm/ps-print-setup)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1118 (fset 'vm-toolbar-print-command 'tm-vm/print-message)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1119
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1120 (defun tm-vm/ps-print-setup ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1121 "Set things up for printing MIME messages with ps-print. Set binding to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1122 the [Print Screen] key."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1123 (local-set-key (ps-prsc) 'tm-vm/print-message)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1124 (setq ps-header-lines 3)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1125 (setq ps-left-header
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1126 (list 'ps-article-subject 'ps-article-author 'buffer-name)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1127
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1128 (defun tm-vm/print-message ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1129 "Print current message with ps-print if it's a MIME message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1130 Value of tm-vm/strict-mime is also taken into consideration."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1131 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1132 (vm-follow-summary-cursor)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1133 (let* ((mbuf (or (vm-select-folder-buffer) (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1134 pbuf)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1135 (tm-vm/sync-preview-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1136 (setq pbuf (and mime::article/preview-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1137 (get-buffer mime::article/preview-buffer)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1138 (if pbuf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1139 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1140 (set-buffer pbuf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1141 (require 'ps-print)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1142 (ps-print-buffer-with-faces))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1143 (vm-print-message))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1144
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1145 ;;; @ end
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1146 ;;;
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1147
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1148 (provide 'tm-vm)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1149
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1150 (run-hooks 'tm-vm-load-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1151
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1152 ;;; tm-vm.el ends here.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 40
diff changeset
1153