annotate lisp/vm/vm-page.el @ 36:c53a95d3c46d r19-15b101

Import from CVS: tag r19-15b101
author cvs
date Mon, 13 Aug 2007 08:53:38 +0200
parents ec9a17fef872
children 05472e90ae02
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 ;;; Commands to move around within a VM message
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
2 ;;; Copyright (C) 1989-1997 Kyle E. Jones
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defun vm-scroll-forward (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 "Scroll forward a screenful of text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 If the current message is being previewed, the message body is revealed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 If at the end of the current message, moves to the next message iff the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 value of vm-auto-next-message is non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 Prefix argument N means scroll forward N lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (let ((mp-changed (vm-follow-summary-cursor))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (was-invisible nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (vm-check-for-killed-summary)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
31 (vm-check-for-killed-presentation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (vm-error-if-folder-empty)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
33 (and vm-presentation-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
34 (set-buffer vm-presentation-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
35 (let ((point (point))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
36 (w (vm-get-visible-buffer-window (current-buffer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
37 (if (or (null w)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
38 (not (vm-frame-totally-visible-p (vm-window-frame w))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
39 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
40 (vm-display (current-buffer) t
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
41 '(vm-scroll-forward vm-scroll-backward)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
42 (list this-command 'reading-message))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
43 ;; window start sticks to end of clip region when clip
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
44 ;; region moves back past it in the buffer. fix it.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
45 (setq w (vm-get-visible-buffer-window (current-buffer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (if (= (window-start w) (point-max))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
47 (set-window-start w (point-min)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
48 (setq was-invisible t))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (if (or mp-changed was-invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (and (eq vm-system-state 'previewing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (pos-visible-in-window-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (vm-get-visible-buffer-window (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (if (not was-invisible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (let ((w (vm-get-visible-buffer-window (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 old-w-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (setq old-w-start (window-start w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (vm-display nil nil '(vm-scroll-forward vm-scroll-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (list this-command 'reading-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (setq w (vm-get-visible-buffer-window (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (and w (set-window-start w old-w-start))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (if (eq vm-system-state 'previewing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (vm-show-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (vm-howl-if-eom))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (let ((vmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (msg-buf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (h-diff 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 w old-w old-w-height old-w-start result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (if (eq vm-system-state 'previewing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (vm-show-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (setq vm-system-state 'reading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (setq old-w (vm-get-visible-buffer-window msg-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 old-w-height (window-height old-w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 old-w-start (window-start old-w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (vm-display nil nil '(vm-scroll-forward vm-scroll-backward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (list this-command 'reading-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (setq w (vm-get-visible-buffer-window msg-buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (if (null w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (error "current window configuration hides the message buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (setq h-diff (- (window-height w) old-w-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; must restore this since it gets clobbered by window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;; teardown and rebuild done by the window config stuff.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (set-window-start w old-w-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (setq old-w (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (let ((next-screen-context-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (+ next-screen-context-lines h-diff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (while (eq (setq result (vm-scroll-forward-internal arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 'tryagain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (cond ((and (not (eq result 'next-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 vm-honor-page-delimiters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (vm-narrow-to-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;; This voodoo is required! For some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; reason the 18.52 emacs display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; doesn't immediately reflect the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;; clip region change that occurs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;; above without this mantra.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (scroll-up 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (select-window old-w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (set-buffer msg-buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (cond ((eq result 'next-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (vm-next-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ((eq result 'end-of-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (let ((vm-message-pointer vmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (vm-emit-eom-blurb)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (and (> (prefix-numeric-value arg) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (vm-howl-if-eom)))))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
112 (if (not vm-startup-message-displayed)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (vm-display-startup-message)))
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-scroll-forward-internal (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (let ((direction (prefix-numeric-value arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (w (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (condition-case error-data
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
119 (progn (scroll-up arg) nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
120 ;; this looks like it should work, but doesn't because the
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
121 ;; redisplay code is schizophrenic when it comes to updates. A
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
122 ;; window position may no longer be visible but
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
123 ;; pos-visible-in-window-p will still say it is because it was
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
124 ;; visible before some window size change happened.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
125 ;; (progn
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
126 ;; (if (and (> direction 0)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
127 ;; (pos-visible-in-window-p
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
128 ;; (vm-text-end-of (car vm-message-pointer))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
129 ;; (signal 'end-of-buffer nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
130 ;; (scroll-up arg))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
131 ;; nil )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (if (or (and (< direction 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (> (point-min) (vm-text-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (and (>= direction 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (/= (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (vm-text-end-of (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (vm-widen-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (if (>= direction 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (forward-page 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (set-window-start w (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 nil )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (if (or (bolp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (looking-at page-delimiter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (forward-page -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (set-window-start w (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 'tryagain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (if (eq (car error-data) 'end-of-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (if vm-auto-next-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 'next-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (set-window-point w (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 'end-of-message)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; exploratory scrolling, what a concept.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; we do this because pos-visible-in-window-p checks the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; window configuration, while this exploratory scrolling forces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; Emacs to recompute the display, giving us an up to the moment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; answer about where the end of the message is going to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; visible when redisplay finally does occur.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (defun vm-howl-if-eom ()
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
167 (let ((w (get-buffer-window (current-buffer))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (and w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (let ((next-screen-context-lines 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; scroll-fix.el replaces scroll-up and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; doesn't behave properly when it hits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; end of buffer. It does this!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;; (ding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; (message (get 'beginning-of-buffer 'error-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (let ((scroll-in-place-replace-original nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (scroll-up nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (error t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (= (vm-text-end-of (car vm-message-pointer)) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (vm-emit-eom-blurb))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (defun vm-emit-eom-blurb ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (if (vm-full-name-of (car vm-message-pointer))
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
190 (message "End of message %s from %s"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (vm-number-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (vm-full-name-of (car vm-message-pointer)))
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
193 (message "End of message %s"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (vm-number-of (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (defun vm-scroll-backward (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "Scroll backward a screenful of text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 Prefix N scrolls backward N lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (vm-scroll-forward (cond ((null arg) '-)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ((consp arg) (list (- (car arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ((numberp arg) (- arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ((symbolp arg) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (t arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (defun vm-highlight-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ((and (vm-xemacs-p) vm-use-lucid-highlighting)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (require 'highlight-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; disable the url marking stuff, since VM has its own interface.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (let ((highlight-headers-mark-urls nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (highlight-headers-regexp (or vm-highlighted-header-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 highlight-headers-regexp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (highlight-headers (point-min) (point-max) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ((vm-xemacs-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (let (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (map-extents (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (lambda (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (if (extent-property e 'vm-highlight)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (delete-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (current-buffer) (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (while (vm-match-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (cond ((vm-match-header vm-highlighted-header-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (setq e (make-extent (vm-matched-header-contents-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (vm-matched-header-contents-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (set-extent-property e 'face vm-highlighted-header-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (set-extent-property e 'vm-highlight t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (goto-char (vm-matched-header-end)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ((fboundp 'overlay-put)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (let (o-lists p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (setq o-lists (overlay-lists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 p (car o-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (and (overlay-get (car p) 'vm-highlight)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (delete-overlay (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (setq p (cdr o-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (and (overlay-get (car p) 'vm-highlight)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (delete-overlay (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (while (vm-match-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (cond ((vm-match-header vm-highlighted-header-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (setq p (make-overlay (vm-matched-header-contents-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (vm-matched-header-contents-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (overlay-put p 'face vm-highlighted-header-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (overlay-put p 'vm-highlight t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (goto-char (vm-matched-header-end)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defun vm-energize-urls ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;; Don't search too long in large regions. If the region is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ;; large, search just the head and the tail of the region since
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ;; they tend to contain the interesting text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (let ((search-limit vm-url-search-limit)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
258 search-pairs n)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (if (and search-limit (> (- (point-max) (point-min)) search-limit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (setq search-pairs (list (cons (point-min)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (+ (point-min) (/ search-limit 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (cons (- (point-max) (/ search-limit 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (setq search-pairs (list (cons (point-min) (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ((vm-xemacs-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (let (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (map-extents (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (lambda (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (if (extent-property e 'vm-url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (delete-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (current-buffer) (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (while search-pairs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (goto-char (car (car search-pairs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (while (re-search-forward vm-url-regexp (cdr (car search-pairs)) t)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
277 (setq n 1)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
278 (while (null (match-beginning n))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
279 (vm-increment n))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
280 (setq e (make-extent (match-beginning n) (match-end n)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (set-extent-property e 'vm-url t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (if vm-highlight-url-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (set-extent-property e 'face vm-highlight-url-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (if vm-url-browser
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (let ((keymap (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (define-key keymap 'button2 'vm-mouse-send-url-at-event)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
287 (if vm-popup-menu-on-mouse-3
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
288 (define-key keymap 'button3 'vm-menu-popup-url-browser-menu))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (define-key keymap "\r"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (function (lambda () (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (vm-mouse-send-url-at-position (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (set-extent-property e 'keymap keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (set-extent-property e 'balloon-help 'vm-url-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (set-extent-property e 'highlight t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (setq search-pairs (cdr search-pairs)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ((and (vm-fsfemacs-19-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (fboundp 'overlay-put))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (let (o-lists o p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (setq o-lists (overlay-lists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 p (car o-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (and (overlay-get (car p) 'vm-url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (delete-overlay (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (setq p (cdr o-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (and (overlay-get (car p) 'vm-url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (delete-overlay (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (while search-pairs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (goto-char (car (car search-pairs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (while (re-search-forward vm-url-regexp (cdr (car search-pairs)) t)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
313 (setq n 1)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
314 (while (null (match-beginning n))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
315 (vm-increment n))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
316 (setq o (make-overlay (match-beginning n) (match-end n)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (overlay-put o 'vm-url t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (if vm-highlight-url-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (overlay-put o 'face vm-highlight-url-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (if vm-url-browser
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
321 (let ((keymap (make-sparse-keymap)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
322 (overlay-put o 'mouse-face 'highlight)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
323 (setq keymap (nconc keymap (current-local-map)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
324 (define-key keymap "\r"
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
325 (function (lambda () (interactive)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
326 (vm-mouse-send-url-at-position (point)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
327 (overlay-put o 'local-map keymap))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (setq search-pairs (cdr search-pairs))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (defun vm-energize-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 ((vm-xemacs-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (let ((search-tuples '(("^From:" vm-menu-author-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 ("^Subject:" vm-menu-subject-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 regexp menu keymap e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (map-extents (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (lambda (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (if (extent-property e 'vm-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (delete-extent e))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (current-buffer) (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (while search-tuples
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq regexp (nth 0 (car search-tuples))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 menu (symbol-value (nth 1 (car search-tuples))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (while (re-search-forward regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (save-excursion (goto-char (match-beginning 0)) (vm-match-header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (setq e (make-extent (vm-matched-header-contents-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (vm-matched-header-contents-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (set-extent-property e 'vm-header t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (setq keymap (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;; Might as well make button2 do what button3 does in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ;; this case, since there is no default 'select'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 ;; action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (define-key keymap 'button2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (list 'lambda () '(interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (list 'popup-menu (list 'quote menu))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
358 (if vm-popup-menu-on-mouse-3
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
359 (define-key keymap 'button3
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
360 (list 'lambda () '(interactive)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
361 (list 'popup-menu (list 'quote menu)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (set-extent-property e 'keymap keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (set-extent-property e 'balloon-help 'vm-mouse-3-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (set-extent-property e 'highlight t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (setq search-tuples (cdr search-tuples)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ((and (vm-fsfemacs-19-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (fboundp 'overlay-put))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (let ((search-tuples '(("^From:" vm-menu-fsfemacs-author-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ("^Subject:" vm-menu-fsfemacs-subject-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 regexp menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 o-lists o p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (setq o-lists (overlay-lists)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 p (car o-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (and (overlay-get (car p) 'vm-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (delete-overlay (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (setq p (cdr o-lists))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (and (overlay-get (car p) 'vm-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (delete-overlay (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (while search-tuples
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (setq regexp (nth 0 (car search-tuples))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 menu (symbol-value (nth 1 (car search-tuples))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (while (re-search-forward regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (save-excursion (goto-char (match-beginning 0)) (vm-match-header))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (setq o (make-overlay (vm-matched-header-contents-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (vm-matched-header-contents-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (overlay-put o 'vm-header menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (overlay-put o 'mouse-face 'highlight))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (setq search-tuples (cdr search-tuples)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (defun vm-display-xface ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (let ((case-fold-search t) e g h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (if (map-extents (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (lambda (e ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (if (extent-property e 'vm-xface)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (current-buffer) (point-min) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (if (find-face 'vm-xface)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (make-face 'vm-xface)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (set-face-background 'vm-xface "white")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (set-face-foreground 'vm-xface "black"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (if (re-search-forward "^X-Face:" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (vm-match-header)
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
415 (setq h (concat "X-Face: " (vm-matched-header-contents)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (setq g (intern h vm-xface-cache))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (if (boundp g)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (setq g (symbol-value g))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (set g (make-glyph h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (setq g (symbol-value g))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ;; XXX broken. Gives extra pixel lines at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;; bottom of the glyph in 19.12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;;(set-glyph-baseline g 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (set-glyph-face g 'vm-xface))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (setq e (make-extent (vm-vheaders-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (vm-vheaders-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (set-extent-property e 'vm-xface t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (set-extent-begin-glyph e g))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (defun vm-url-help (object)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 "Use mouse button 2 to send the URL to %s.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 Use mouse button 3 to choose a Web browser for the URL."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (cond ((stringp vm-url-browser) vm-url-browser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 ((eq vm-url-browser 'w3-fetch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 "Emacs W3")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 ((eq vm-url-browser 'w3-fetch-other-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 "Emacs W3")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 ((eq vm-url-browser 'vm-mouse-send-url-to-mosaic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 "Mosaic")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ((eq vm-url-browser 'vm-mouse-send-url-to-netscape)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 "Netscape")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (t (symbol-name vm-url-browser)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
445 (defun vm-energize-urls-in-message-region (&optional start end)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
446 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
447 (or start (setq start (vm-headers-of (car vm-message-pointer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
448 (or end (setq end (vm-text-end-of (car vm-message-pointer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
449 ;; energize the URLs
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
450 (if (or vm-highlight-url-face vm-url-browser)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
451 (save-restriction
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
452 (widen)
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
453 (narrow-to-region start end)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
454 (vm-energize-urls)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
455
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
456 (defun vm-highlight-headers-maybe ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
457 ;; highlight the headers
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
458 (if (or vm-highlighted-header-regexp
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
459 (and (vm-xemacs-p) vm-use-lucid-highlighting))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
460 (save-restriction
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
461 (widen)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
462 (narrow-to-region (vm-headers-of (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
463 (vm-text-end-of (car vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
464 (vm-highlight-headers))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
465
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
466 (defun vm-energize-headers-and-xfaces ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
467 ;; energize certain headers
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
468 (if (and vm-use-menus (vm-menu-support-possible-p))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
469 (save-restriction
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
470 (widen)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
471 (narrow-to-region (vm-headers-of (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
472 (vm-text-of (car vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
473 (vm-energize-headers)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
474 ;; display xfaces, if we can
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
475 (if (and vm-display-xfaces
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
476 (vm-xemacs-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
477 (vm-multiple-frames-possible-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
478 (featurep 'xface))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
479 (save-restriction
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
480 (widen)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
481 (narrow-to-region (vm-headers-of (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
482 (vm-text-of (car vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
483 (vm-display-xface))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
484
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
485 (defun vm-narrow-for-preview ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ;; hide as much of the message body as vm-preview-lines specifies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (vm-vheaders-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (cond ((not (eq vm-preview-lines t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (min
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (vm-text-end-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (goto-char (vm-text-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (forward-line (if (natnump vm-preview-lines) vm-preview-lines 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (point))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
497 (t (vm-text-end-of (car vm-message-pointer))))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
498
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
499 (defun vm-preview-current-message ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
500 (vm-save-buffer-excursion
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
501 (setq vm-system-state 'previewing
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
502 vm-mime-decoded nil)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
503 (if vm-real-buffers
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
504 (vm-make-virtual-copy (car vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
505
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
506 ;; run the message select hooks.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
507 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
508 (vm-select-folder-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
509 (vm-run-message-hook (car vm-message-pointer) 'vm-select-message-hook)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
510 (and vm-select-new-message-hook (vm-new-flag (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
511 (vm-run-message-hook (car vm-message-pointer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
512 'vm-select-new-message-hook))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
513 (and vm-select-unread-message-hook
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
514 (vm-unread-flag (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
515 (vm-run-message-hook (car vm-message-pointer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
516 'vm-select-unread-message-hook)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
518 (vm-narrow-for-preview)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
519 (if (or vm-mime-display-function
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
520 (and vm-display-using-mime
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
521 (not (vm-mime-plain-message-p (car vm-message-pointer)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
522 (let ((layout (vm-mm-layout (car vm-message-pointer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
523 (vm-make-presentation-copy (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
524 (vm-save-buffer-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
525 (vm-replace-buffer-in-windows (current-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
526 vm-presentation-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
527 (set-buffer vm-presentation-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
528 (setq vm-system-state 'previewing)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
529 (vm-narrow-for-preview))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
530 (setq vm-presentation-buffer nil)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
531 (and vm-presentation-buffer-handle
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
532 (vm-replace-buffer-in-windows vm-presentation-buffer-handle
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
533 (current-buffer))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
535 ;; at this point the current buffer is the presentation buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
536 ;; if we're using one for this message.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
537
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 26
diff changeset
538 (vm-unbury-buffer (current-buffer))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
539 (vm-energize-urls-in-message-region)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
540 (vm-highlight-headers-maybe)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
541 (vm-energize-headers-and-xfaces)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
543 (if vm-honor-page-delimiters
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
544 (vm-narrow-to-page))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
545 (goto-char (vm-text-of (car vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
546 ;; If we have a window, set window start appropriately.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
547 (let ((w (vm-get-visible-buffer-window (current-buffer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
548 (if w
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
549 (progn (set-window-start w (point-min))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
550 (set-window-point w (vm-text-of (car vm-message-pointer))))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
551 (if (or (null vm-preview-lines)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
552 (and (not vm-preview-read-messages)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
553 (not (vm-new-flag (car vm-message-pointer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
554 (not (vm-unread-flag (car vm-message-pointer)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
555 (vm-show-current-message)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
556 (vm-update-summary-and-mode-line))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (defun vm-show-current-message ()
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
559 (and vm-display-using-mime
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
560 vm-auto-decode-mime-messages
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
561 (if vm-mail-buffer
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
562 (not (vm-buffer-variable-value vm-mail-buffer 'vm-mime-decoded))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
563 (not vm-mime-decoded))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
564 (not (vm-mime-plain-message-p (car vm-message-pointer)))
36
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
565 (condition-case data
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
566 (vm-decode-mime-message)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
567 (vm-mime-error (vm-set-mime-layout-of (car vm-message-pointer)
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
568 (car (cdr data)))
c53a95d3c46d Import from CVS: tag r19-15b101
cvs
parents: 30
diff changeset
569 (message "%s" (car (cdr data))))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
570 (vm-save-buffer-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
571 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
572 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
573 (goto-char (point-min))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
574 (widen)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
575 (narrow-to-region (point) (vm-text-end-of (car vm-message-pointer))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
576 (if vm-honor-page-delimiters
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
577 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
578 (if (looking-at page-delimiter)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
579 (forward-page 1))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
580 (vm-narrow-to-page))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
581 ;; don't mark the message as read if the user can't see it!
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
582 (if (vm-get-visible-buffer-window (current-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
583 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
584 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
585 (setq vm-system-state 'showing)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
586 (if vm-mail-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
587 (vm-set-buffer-variable vm-mail-buffer 'vm-system-state
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
588 'showing))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
589 ;; We could be in the presentation buffer here. Since
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
590 ;; the presentation buffer's message pointer and sole
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
591 ;; message are a mockup, they will cause trouble if
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
592 ;; passed into the undo/update system. So we switch
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
593 ;; into the real message buffer to do attribute
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
594 ;; updates.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
595 (vm-select-folder-buffer)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
596 (cond ((vm-new-flag (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
597 (vm-set-new-flag (car vm-message-pointer) nil)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
598 (cond ((vm-unread-flag (car vm-message-pointer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
599 (vm-set-unread-flag (car vm-message-pointer) nil))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
600 (vm-update-summary-and-mode-line)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
601 (vm-howl-if-eom))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
602 (vm-update-summary-and-mode-line))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (defun vm-expose-hidden-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 "Toggle exposing and hiding message headers that are normally not visible."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (vm-check-for-killed-summary)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
610 (vm-check-for-killed-presentation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (vm-error-if-folder-empty)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
612 (and vm-presentation-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
613 (set-buffer vm-presentation-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (vm-display (current-buffer) t '(vm-expose-hidden-headers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 '(vm-expose-hidden-headers reading-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (let* ((exposed (= (point-min) (vm-start-of (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (vm-widen-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (if exposed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (narrow-to-region (point) (vm-vheaders-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (narrow-to-region (point) (vm-start-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (let (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (setq w (vm-get-visible-buffer-window (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (and w (set-window-point w (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (and w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (= (window-start w) (vm-vheaders-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (not exposed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (set-window-start w (vm-start-of (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (if vm-honor-page-delimiters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (vm-narrow-to-page))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (defun vm-widen-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (if (or (> (point-min) (vm-text-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (/= (point-max) (vm-text-end-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (narrow-to-region (vm-vheaders-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (if (or (vm-new-flag (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (vm-unread-flag (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (vm-text-of (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (vm-text-end-of (car vm-message-pointer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (defun vm-narrow-to-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (let (min max (omin (point-min)) (omax (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (if (or (bolp) (not (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (looking-at page-delimiter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (forward-page -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (setq min (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (forward-page 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (setq max (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (narrow-to-region min max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (defun vm-beginning-of-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 "Moves to the beginning of the current message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (vm-check-for-killed-summary)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
662 (vm-check-for-killed-presentation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (vm-error-if-folder-empty)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
664 (and vm-presentation-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
665 (set-buffer vm-presentation-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (vm-widen-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (push-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (vm-display (current-buffer) t '(vm-beginning-of-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 '(vm-beginning-of-message reading-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (let ((osw (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (select-window (vm-get-visible-buffer-window (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (if (not (eq osw (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (select-window osw))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (if vm-honor-page-delimiters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (vm-narrow-to-page)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (defun vm-end-of-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 "Moves to the end of the current message, exposing and flagging it read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 as necessary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (vm-check-for-killed-summary)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
687 (vm-check-for-killed-presentation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (vm-error-if-folder-empty)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
689 (and vm-presentation-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 0
diff changeset
690 (set-buffer vm-presentation-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (if (eq vm-system-state 'previewing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (vm-show-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (setq vm-system-state 'reading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (vm-widen-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (push-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (vm-display (current-buffer) t '(vm-end-of-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 '(vm-end-of-message reading-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (let ((osw (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (select-window (vm-get-visible-buffer-window (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (if (not (eq osw (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (select-window osw))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (if vm-honor-page-delimiters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (vm-narrow-to-page)))