annotate lisp/vm/vm-page.el @ 169:15872534500d r20-3b11

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