annotate lisp/hyperbole/hrmail.el @ 29:7976500f47f9

Added tag r19-15b97 for changeset 1917ad0d78d7
author cvs
date Mon, 13 Aug 2007 08:51:58 +0200
parents 4103f0995bd7
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hrmail.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Support for Hyperbole buttons in mail reader: Rmail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: hypermedia, mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; ORG: Brown U.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 9-May-91 at 04:22:02
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
12 ;; LAST-MOD: 14-Feb-97 at 11:38:57 by Bob Weiner
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Automatically configured for use in "hyperbole.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; If hsite loading fails prior to initializing Hyperbole Rmail support,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
25 ;; {M-x Rmail-init RET}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; will do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (require 'hmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (require 'hact)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (load "hsmail")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (require 'rmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (load "rmailedit")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (provide 'rmailedit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (defun Rmail-init ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 "Initializes Hyperbole support for Rmail mail reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (setq hmail:composer 'mail-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 hmail:lister 'rmail-summary-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 hmail:modifier 'rmail-edit-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 hmail:reader 'rmail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (var:append 'rmail-show-message-hook '(hmail:msg-narrow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; Setup public abstract interface to Hyperbole defined mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; reader-specific functions used in "hmail.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (rmail:init)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;; Setup private abstract interface to mail reader-specific functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; used in "hmail.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (fset 'rmail:get-new 'rmail-get-new-mail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (fset 'rmail:msg-forward 'rmail-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (fset 'rmail:summ-msg-to 'rmail-summary-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (fset 'rmail:summ-new 'rmail-new-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (message "Hyperbole RMAIL mail reader support initialized."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun Rmail-msg-hdrs-full (toggled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "If TOGGLED is non-nil, toggle full/hidden headers, else show full headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (if (or toggled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (let ((tog nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (rmail-maybe-set-message-counters)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (narrow-to-region (rmail-msgbeg rmail-current-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;; Need to show full header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (if (= (following-char) ?1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (setq tog t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 tog))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (progn (rmail-toggle-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (setq toggled t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 toggled))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defun Rmail-msg-narrow ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "Narrows mail reader buffer to current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 This includes Hyperbole button data."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (let ((beg (rmail-msgbeg rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (end (rmail-msgend rmail-current-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (narrow-to-region beg end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (defun Rmail-msg-next () (rmail-next-undeleted-message 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (defun Rmail-msg-num ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 "Returns number of Rmail message that point is within."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (let ((count 0) opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (while (and (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (progn (setq opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (re-search-backward "^\^_" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (if (= opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (backward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (setq count (1+ count)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (defun Rmail-msg-prev () (rmail-previous-undeleted-message 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defun Rmail-msg-to-p (mail-msg-id mail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 "Sets current buffer to start of msg with MAIL-MSG-ID in MAIL-FILE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 Returns t if successful, else nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (if (not (file-readable-p mail-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (let ((buf (get-file-buffer mail-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (cond (buf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (switch-to-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (or (eq major-mode 'rmail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (rmail mail-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (t (rmail mail-file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (if (re-search-forward (concat rmail:msg-hdr-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (regexp-quote mail-msg-id)) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; Found matching msg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (rmail-show-message (Rmail-msg-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defun Rmail-msg-widen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "Widens buffer to full current message including Hyperbole button data."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (let ((start (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (end (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (if (re-search-forward "^\^_" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (progn (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (setq end (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (narrow-to-region start end))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (defun Rmail-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "Sets current buffer to a mail reader buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (and (eq major-mode 'rmail-summary-mode) (set-buffer rmail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (fset 'Rmail-Summ-delete 'rmail-summary-delete-forward)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (fset 'Rmail-Summ-expunge 'rmail-summary-expunge)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (fset 'Rmail-Summ-goto 'rmail-summary-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defun Rmail-Summ-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "Sets current buffer to a mail listing buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (and (eq major-mode 'rmail-mode) (set-buffer rmail-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (fset 'Rmail-Summ-undelete-all 'rmail-summary-undelete-many)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;;; Private functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;;; Overlay version of this function from "rmailedit.el" to include any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;;; hidden Hyperbole button data when computing message length.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (defun rmail-cease-edit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "Finish editing message; switch back to Rmail proper."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; Make sure buffer ends with a newline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (Rmail-msg-widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (if (/= (preceding-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (insert "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; Adjust the marker that points to the end of this message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (set-marker (aref rmail-message-vector (1+ rmail-current-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (hmail:msg-narrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (let ((old rmail-old-text))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; Update the mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (set-buffer-modified-p (buffer-modified-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (rmail-mode-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (if (and (= (length old) (- (point-max) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (string= old (buffer-substring (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (setq old nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (rmail-set-attribute "edited" t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (if (boundp 'rmail-summary-vector)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (aset rmail-summary-vector (1- rmail-current-message) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (rmail-widen-to-current-msgbeg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (function (lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (forward-line 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (if (looking-at "Summary-line: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (let ((buffer-read-only nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (delete-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (progn (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (point))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (rmail-show-message))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (setq buffer-read-only t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;;; Overlay version of this function from "rmail.el" to include any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;;; Hyperbole button data.
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
219 (defun rmail-forward (resend)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
220 "Forward the current message to another user.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
221 With prefix argument, \"resend\" the message instead of forwarding it;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
222 see the documentation of `rmail-resend'."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
223 (interactive "P")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
224 (if resend
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
225 (call-interactively 'rmail-resend)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
226 (let ((forward-buffer (current-buffer))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
227 (subject (concat "["
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
228 (let ((from (or (mail-fetch-field "From")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
229 (mail-fetch-field ">From"))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
230 (if from
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
231 (concat (mail-strip-quoted-names from) ": ")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
232 ""))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
233 (or (mail-fetch-field "Subject") "")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
234 "]")))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
235 (save-restriction
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
236 (Rmail-msg-widen)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
237 ;; Turn off the usual actions for initializing the message body
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
238 ;; because we want to get only the text from the failure message.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
239 (let (mail-signature mail-setup-hook)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
240 ;; If only one window, use it for the mail buffer.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
241 ;; Otherwise, use another window for the mail buffer
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
242 ;; so that the Rmail buffer remains visible
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
243 ;; and sending the mail will get back to it.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
244 (if (funcall (if (one-window-p t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
245 (function mail)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
246 (function mail-other-window))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
247 nil nil subject nil nil nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
248 (list (list (function (lambda (buf msgnum)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
249 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
250 (set-buffer buf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
251 (rmail-set-attribute
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
252 "forwarded" t msgnum))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
253 (current-buffer)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
254 rmail-current-message)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
255 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
256 (goto-char (point-max))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
257 (forward-line 1)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
258 (insert-buffer forward-buffer)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 0
diff changeset
259 (hmail:msg-narrow))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;;; Overlay version of 'rmail-get-new-mail' from "rmail.el" to highlight
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;;; Hyperbole buttons when possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (hypb:function-overload 'rmail-get-new-mail nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 '(if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (progn (widen) (hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (rmail-show-message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;;; Overlay version of 'rmail-new-summary' from "rmailsum.el" to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;;; highlight Hyperbole buttons when possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (or (fboundp 'rmail-new-summary) (load "rmailsum"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (hypb:function-overload 'rmail-new-summary nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 '(if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (hproperty:but-create)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (provide 'hrmail)