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

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