annotate lisp/hyperbole/hvm.el @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 8619ce7e4c50
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hvm.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Support Hyperbole buttons in mail reader: Vm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: hypermedia, mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
9 ;; ORG: InfoDock Associates
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 10-Oct-91 at 01:51:12
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
12 ;; LAST-MOD: 20-Mar-97 at 14:52:54 by Bob Weiner
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Automatically configured for use in "hyperbole.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; If hsite loading fails prior to initializing Hyperbole Vm support,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
25 ;; {M-x Vm-init RET}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; will do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (require 'hmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (load "hsmail")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (require 'vm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (or (and (fboundp 'vm-edit-message) (fboundp 'vm-edit-message-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (load "vm-edit"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (vm-session-initialization)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;; Current versions of VM define this next variable in "vm-vars.el". We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;; define it here for earlier VM versions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (defvar vm-edit-message-mode nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 "*Major mode to use when editing messages in VM.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; "hmail.el" procedures will branch improperly if a regular mode, like VM's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;; default 'text-mode', is used for editing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (setq vm-edit-message-mode 'vm-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (defun vm-edit-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 "Major mode for editing vm mail messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 Special commands:\\{vm-edit-message-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 Turning on vm-edit-mode calls the value of the variable vm-edit-message-hook,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 if that value is non-nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (kill-all-local-variables)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (use-local-map vm-edit-message-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (setq mode-name "VM Edit")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (setq major-mode 'vm-edit-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (setq local-abbrev-table text-mode-abbrev-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (set-syntax-table text-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (run-hooks 'vm-edit-message-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defun Vm-init ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "Initializes Hyperbole support for Vm mail reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (setq hmail:composer 'mail-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 hmail:lister 'vm-summary-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 hmail:modifier 'vm-edit-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 hmail:reader 'vm-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; Setup public abstract interface to Hyperbole defined mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; reader-specific functions used in "hmail.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (rmail:init)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;; Setup private abstract interface to mail reader-specific functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;; used in "hmail.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (fset 'rmail:get-new 'vm-get-new-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (fset 'rmail:msg-forward 'vm-forward-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (fset 'rmail:summ-msg-to 'vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (fset 'rmail:summ-new 'vm-summarize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (message "Hyperbole VM mail reader support initialized."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defun Vm-msg-hdrs-full (toggled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "If TOGGLED is non-nil, toggle full/hidden headers, else show full headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (if (or toggled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (let ((exposed (= (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (vm-start-of (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (not exposed)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (progn (vm-expose-hidden-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (setq toggled t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 toggled))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defun Vm-msg-narrow ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "Narrows mail reader buffer to current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 This includes Hyperbole button data."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (narrow-to-region (point-min) (Vm-msg-end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defun Vm-msg-next () (vm-next-message 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defun Vm-msg-num ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "Returns number of vm mail message that point is within, in physical message order."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (let ((count 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (while (re-search-backward Vm-msg-start-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (setq count (1+ count)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (defun Vm-msg-prev () (vm-previous-message 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (defun Vm-msg-to-p (mail-msg-id mail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 "Sets current buffer to start of msg with MAIL-MSG-ID in MAIL-FILE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 Returns t if successful, else nil or signals error."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (if (not (file-readable-p mail-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (vm-visit-folder mail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (if (let ((case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (re-search-forward (concat rmail:msg-hdr-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (regexp-quote mail-msg-id)) nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; Found matching msg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (vm-goto-message-at-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (defun Vm-msg-widen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 "Widens buffer to full current message including Hyperbole button data."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (narrow-to-region (point-min) (Vm-msg-end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (defun Vm-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 "Sets current buffer to a mail reader buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (and (eq major-mode 'vm-summary-mode) (set-buffer vm-mail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun Vm-Summ-delete ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (vm-delete-message 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (fset 'Vm-Summ-expunge 'vm-expunge-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (fset 'Vm-Summ-goto 'vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (defun Vm-Summ-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 "Sets current buffer to a mail listing buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (and (eq major-mode 'vm-mode) (set-buffer vm-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (defun Vm-Summ-undelete-all ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "(Vm-Summ-undelete-all: Vm doesn't have an undelete all msgs function."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;;; Private functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (defun Vm-msg-end ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "Returns end point for current Vm message, including Hyperbole button data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 Has side-effect of widening buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (if (let ((case-fold-search))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (re-search-forward Vm-msg-start-regexp nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (match-beginning 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;;; Overlay version of this function from "vm-page.el" to hide any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;;; Hyperbole button data whenever a message is displayed in its entirety.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (defun vm-show-current-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (hmail:msg-narrow (point-min) (Vm-msg-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (and vm-honor-page-delimiters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (if (search-forward page-delimiter nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (not (looking-at (regexp-quote hmail:hbdata-sep))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (if (looking-at page-delimiter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (forward-page 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (vm-narrow-to-page))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; don't mark the message as read if the user can't see it!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (if (vm-get-buffer-window (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (setq vm-system-state 'showing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (cond ((vm-new-flag (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (vm-set-new-flag (car vm-message-pointer) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (cond ((vm-unread-flag (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (vm-set-unread-flag (car vm-message-pointer) nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (vm-howl-if-eom))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (if (fboundp 'hproperty:but-create) (hproperty:but-create))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (vm-update-summary-and-mode-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;;; Overlay version of this function from "vm-page.el" to treat end of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;;; text (excluding Hyperbole button data) as end of message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (defun vm-scroll-forward-internal (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (let ((direction (prefix-numeric-value arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (w (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (condition-case error-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (progn (scroll-up arg) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (if (or (and (< direction 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (> (point-min) (vm-text-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (and (>= direction 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (/= (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (hmail:hbdata-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (vm-text-end-of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (car vm-message-pointer)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (vm-widen-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (if (>= direction 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (forward-page 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (set-window-start w (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 nil )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (if (or (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (looking-at page-delimiter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (forward-page -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (set-window-start w (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 'tryagain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (if (eq (car error-data) 'end-of-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (if vm-auto-next-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 'next-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (set-window-point w (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 'end-of-message)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;;; Overlay version of this function from "vm-page.el" (called by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;;; vm-scroll-* functions). Make it keep Hyperbole button data hidden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (defun vm-widen-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (if (or (> (point-min) (vm-text-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (/= (point-max) (vm-text-end-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (hmail:msg-narrow (vm-vheaders-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (if (or (vm-new-flag (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (vm-unread-flag (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (vm-text-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (vm-text-end-of (car vm-message-pointer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;;; Overlay version of this function from "vm-edit.el" to hide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;;; Hyperbole button data when insert edited message from temporary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (hypb:function-overload 'vm-edit-message nil '(hmail:msg-narrow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;;; Overlay version of this function from "vm-edit.el" to hide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;;; Hyperbole button data when insert edited message from temporary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (defun vm-edit-message-end ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "End the edit of a message and copy the result to its folder."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (if (null vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (error "This is not a VM message edit buffer."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (if (null (buffer-name (vm-buffer-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (error "The folder buffer for this message has been killed."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; make sure the message ends with a newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (and (/= (preceding-char) ?\n) (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;; munge message separators found in the edited message to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; prevent message from being split into several messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (vm-munge-message-separators (vm-message-type-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 ;; for From_-with-Content-Length recompute the Content-Length header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (if (eq (vm-message-type-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 'From_-with-Content-Length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (let ((buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;; first delete all copies of Content-Length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (while (and (re-search-forward vm-content-length-search-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (null (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (progn (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (vm-match-header vm-content-length-header)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (delete-region (vm-matched-header-start) (vm-matched-header-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ;; now compute the message body length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (search-forward "\n\n" nil 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (setq length (- (point-max) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ;; insert the header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (insert vm-content-length-header " " (int-to-string length) "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (let ((edit-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (mp vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (if (buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (set-buffer (vm-buffer-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (if (not (memq (vm-real-message-of (car mp)) vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (error "The original copy of this message has been expunged."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (vm-save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (goto-char (vm-headers-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (let ((vm-message-pointer mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (insert-buffer-substring edit-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (point) (vm-text-end-of (vm-real-message-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (vm-discard-cached-data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (hmail:msg-narrow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (vm-set-edited-flag-of (car mp) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (vm-mark-for-summary-update (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (if (eq vm-flush-interval t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (vm-stuff-virtual-attributes (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (vm-set-modflag-of (car mp) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (vm-set-buffer-modified-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (vm-clear-modification-flag-undos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (vm-set-edit-buffer-of (car mp) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (set-buffer (vm-buffer-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (if (eq (vm-real-message-of (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (vm-real-message-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (vm-preview-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (vm-update-summary-and-mode-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (message "No change."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (vm-display edit-buf nil '(vm-edit-message-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 '(vm-edit-message-end reading-message startup))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (kill-buffer edit-buf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ;;; Define this function if VM version in use doesn't have it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (or (fboundp 'vm-goto-message-at-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (defun vm-goto-message-at-point ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 "In a VM folder buffer, select the message that contains point."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (cond ((fboundp 'vm-update-search-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (vm-update-search-position t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; vm-show-current-message only adjusts (point-max),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;; it doesn't change (point-min).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (vm-vheaders-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (vm-show-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (setq vm-system-state 'reading))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ((fboundp 'vm-isearch-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (vm-isearch-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (vm-vheaders-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (vm-show-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (setq vm-system-state 'reading))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (t (error "vm search code is missing, can't continue"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ;;; Hide any Hyperbole button data when reply to or forward a message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ;;; See "vm-reply.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (var:append 'vm-mail-mode-hook '(hmail:msg-narrow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;;; Overlay this function from "vm-folder.el" called whenever new mail is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ;;; incorporated so that it will highlight Hyperbole buttons when possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;; Returns non-nil if there were any new messages.
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
375 (defun vm-assimilate-new-messages (&optional
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
376 dont-read-attributes
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
377 gobble-order
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
378 labels)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (let ((tail-cons (vm-last vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 b-list new-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (vm-save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (hproperty:but-create))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (vm-build-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (if (or (null tail-cons) (cdr tail-cons))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (setq vm-ml-sort-keys nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (if dont-read-attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (vm-set-default-attributes (cdr tail-cons))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (vm-read-attributes (cdr tail-cons)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;; Yuck. This has to be done here instead of in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;; vm function because this needs to be done before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;; any initial thread sort (so that if the thread
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;; sort matches the saved order the folder won't be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ;; modified) but after the message list is created.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ;; Since thread sorting is done here this has to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ;; done here too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (if gobble-order
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (vm-gobble-message-order))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (if vm-thread-obarray
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (vm-build-threads (cdr tail-cons))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (setq new-messages (if tail-cons (cdr tail-cons) vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (vm-set-numbering-redo-start-point new-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (vm-set-summary-redo-start-point new-messages))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
407 ;; copy the new-messages list because sorting might scramble
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
408 ;; it. Also something the user does when
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
409 ;; vm-arrived-message-hook is run might affect it.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
410 ;; vm-assimilate-new-messages returns this value so it must
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
411 ;; not be mangled.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
412 (setq new-messages (copy-sequence new-messages))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
413 ;; add the labels
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
414 (if (and labels (boundp 'vm-burst-digest-messages-inherit-labels)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
415 vm-burst-digest-messages-inherit-labels)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
416 (let ((mp new-messages))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
417 (while mp
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
418 (vm-set-labels-of (car mp) (copy-sequence labels))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
419 (setq mp (cdr mp)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (if vm-summary-show-threads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;; get numbering and summary of new messages done now
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;; so that the sort code only has to worry about the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 ;; changes it needs to make.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (vm-sort-messages "thread")))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
427 (if (and vm-arrived-message-hook
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
428 new-messages
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
429 ;; tail-cons == nil means vm-message-list was empty.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
430 ;; Thus new-messages == vm-message-list. In this
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
431 ;; case, run the hooks only if this is not the first
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
432 ;; time vm-assimilate-new-messages has been called
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
433 ;; in this folder. gobble-order non-nil is a good
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
434 ;; indicator that this is the first time because the
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
435 ;; order is gobbled only once per visit and always
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
436 ;; the first time vm-assimilate-new-messages is
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
437 ;; called.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
438 (or tail-cons (null gobble-order)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
439 (let ((new-messages new-messages))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
440 ;; seems wise to do this so that if the user runs VM
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
441 ;; command here they start with as much of a clean
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
442 ;; slate as we can provide, given we're currently deep
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
443 ;; in the guts of VM.
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
444 (vm-update-summary-and-mode-line)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
445 (while new-messages
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
446 (vm-run-message-hook (car new-messages) 'vm-arrived-message-hook)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
447 (setq new-messages (cdr new-messages)))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
448 (vm-update-summary-and-mode-line)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 100
diff changeset
449 (run-hooks 'vm-arrived-messages-hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (if (and new-messages vm-virtual-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (setq b-list vm-virtual-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (while b-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 ;; buffer might be dead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (if (buffer-name (car b-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (let (tail-cons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (set-buffer (car b-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (setq tail-cons (vm-last vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (vm-build-virtual-message-list new-messages)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (if (or (null tail-cons) (cdr tail-cons))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (setq vm-ml-sort-keys nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (if vm-thread-obarray
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (vm-build-threads (cdr tail-cons)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (vm-set-summary-redo-start-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (or (cdr tail-cons) vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (vm-set-numbering-redo-start-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (or (cdr tail-cons) vm-message-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (if (null vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (progn (setq vm-message-pointer vm-message-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 vm-need-summary-pointer-update t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (if vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (vm-preview-current-message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (if vm-summary-show-threads
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (vm-update-summary-and-mode-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (vm-sort-messages "thread")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (setq b-list (cdr b-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 new-messages ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;;; Overlay version of 'vm-force-mode-line-update' from "vm-folder.el"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;;; to highlight Hyperbole buttons in summary buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (defun vm-force-mode-line-update ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 "Force a mode line update in all frames."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (if vm-summary-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (set-buffer vm-summary-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (if (fboundp 'hproperty:but-create) (hproperty:but-create))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (if (fboundp 'force-mode-line-update)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (force-mode-line-update t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (set-buffer (other-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (set-buffer-modified-p (buffer-modified-p)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (defvar Vm-msg-start-regexp "\n\nFrom \\|\n\001\001\001\001"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 "Regular expression that begins a Vm mail message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (provide 'hvm)