annotate lisp/vm/vm-page.el @ 20:859a2309aef8 r19-15b93

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