Mercurial > emacs
annotate lisp/mh-e/mh-letter.el @ 69245:f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
(mh-folder-mode): Call mh-tool-bar-init conditionally in XEmacs. Set
scoped variables image-load-path and load-path with updated
mh-image-load-path before calling mh-tool-bar-folder-buttons-init.
* mh-letter.el (mh-tool-bar-init): Autoload.
(mh-letter-mode): Call mh-tool-bar-init conditionally in XEmacs. Set
scoped variables image-load-path and load-path with updated
mh-image-load-path before calling mh-tool-bar-letter-buttons-init.
* mh-show.el (mh-tool-bar-init): Autoload.
(mh-show-mode): Perform tool bar stuff conditionally in XEmacs and GNU
Emacs.
* mh-tool-bar.el (mh-tool-bar-define): Don't quote stuff in error
messages per conventions.
(mh-tool-bar-folder-buttons-init)
(mh-tool-bar-letter-buttons-init): Don't call mh-image-load-path.
(mh-tool-bar-define call): Format.
* mh-utils.el (mh-image-directory, mh-image-load-path-called-flag):
Delete.
(mh-image-load-path): Incorporate changes from Gnus team. Biggest
changes are that it no longer uses/sets mh-image-directory or
mh-image-load-path-called-flag, and returns the updated path rather
than change it.
(mh-logo-display): Change usage of mh-image-load-path.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Fri, 03 Mar 2006 00:27:49 +0000 |
parents | 7daec5f4a289 |
children | b52e0cc8af61 |
rev | line source |
---|---|
68465 | 1 ;;; mh-letter.el --- MH-Letter mode |
2 | |
3 ;; Copyright (C) 1993, 1995, 1997, | |
4 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. | |
5 | |
6 ;; Author: Bill Wohler <wohler@newt.com> | |
7 ;; Maintainer: Bill Wohler <wohler@newt.com> | |
8 ;; Keywords: mail | |
9 ;; See: mh-e.el | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
26 ;; Boston, MA 02110-1301, USA. | |
27 | |
28 ;;; Commentary: | |
29 | |
30 ;; Mode for composing and sending a draft message. | |
31 | |
32 ;; Functions that would ordinarily be in here that are needed by | |
33 ;; mh-show.el should be placed in the Message Utilities section in | |
34 ;; mh-utils.el. That will help prevent the loading of this file until | |
35 ;; a message is actually composed. | |
36 | |
37 ;;; Change Log: | |
38 | |
39 ;;; Code: | |
40 | |
41 (require 'mh-e) | |
42 | |
43 (require 'gnus-util) | |
44 | |
69245
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
45 ;; Dynamically-created functions not found in mh-loaddefs.el. |
68465 | 46 (autoload 'mh-tool-bar-letter-buttons-init "mh-tool-bar") |
69245
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
47 (autoload 'mh-tool-bar-init "mh-tool-bar") |
68465 | 48 |
49 (autoload 'mml-insert-tag "mml") | |
50 | |
51 ;;; Variables | |
52 | |
53 (defvar mh-letter-complete-function-alist | |
54 '((bcc . mh-alias-letter-expand-alias) | |
55 (cc . mh-alias-letter-expand-alias) | |
56 (dcc . mh-alias-letter-expand-alias) | |
57 (fcc . mh-folder-expand-at-point) | |
58 (from . mh-alias-letter-expand-alias) | |
59 (mail-followup-to . mh-alias-letter-expand-alias) | |
60 (mail-reply-to . mh-alias-letter-expand-alias) | |
61 (reply-to . mh-alias-letter-expand-alias) | |
62 (to . mh-alias-letter-expand-alias)) | |
63 "Alist of header fields and completion functions to use.") | |
64 | |
65 (defvar mh-yank-hooks nil | |
66 "Obsolete hook for modifying a citation just inserted in the mail buffer. | |
67 | |
68 Each hook function can find the citation between point and mark. | |
69 And each hook function should leave point and mark around the | |
70 citation text as modified. | |
71 | |
72 This is a normal hook, misnamed for historical reasons. It is | |
73 semi-obsolete and is only used if `mail-citation-hook' is nil.") | |
74 | |
75 | |
76 | |
77 ;;; Letter Menu | |
78 | |
79 (easy-menu-define | |
80 mh-letter-menu mh-letter-mode-map "Menu for MH-E letter mode." | |
81 '("Letter" | |
82 ["Send This Draft" mh-send-letter t] | |
83 ["Split Current Line" mh-open-line t] | |
84 ["Check Recipient" mh-check-whom t] | |
85 ["Yank Current Message" mh-yank-cur-msg t] | |
86 ["Insert a Message..." mh-insert-letter t] | |
87 ["Insert Signature" mh-insert-signature t] | |
88 ("Encrypt/Sign Message" | |
89 ["Sign Message" | |
90 mh-mml-secure-message-sign mh-pgp-support-flag] | |
91 ["Encrypt Message" | |
92 mh-mml-secure-message-encrypt mh-pgp-support-flag] | |
93 ["Sign+Encrypt Message" | |
94 mh-mml-secure-message-signencrypt mh-pgp-support-flag] | |
95 ["Disable Security" | |
96 mh-mml-unsecure-message mh-pgp-support-flag] | |
97 "--" | |
98 "Security Method" | |
99 ["PGP (MIME)" (setq mh-mml-method-default "pgpmime") | |
100 :style radio | |
101 :selected (equal mh-mml-method-default "pgpmime")] | |
102 ["PGP" (setq mh-mml-method-default "pgp") | |
103 :style radio | |
104 :selected (equal mh-mml-method-default "pgp")] | |
105 ["S/MIME" (setq mh-mml-method-default "smime") | |
106 :style radio | |
107 :selected (equal mh-mml-method-default "smime")] | |
108 "--" | |
109 ["Save Method as Default" | |
110 (customize-save-variable 'mh-mml-method-default mh-mml-method-default) t] | |
111 ) | |
112 ["Compose Insertion..." mh-compose-insertion t] | |
113 ["Compose Compressed tar (MH)..." | |
114 mh-mh-compose-external-compressed-tar t] | |
115 ["Compose Get File (MH)..." mh-mh-compose-anon-ftp t] | |
116 ["Compose Forward..." mh-compose-forward t] | |
117 ;; The next two will have to be merged. But I also need to make sure the | |
118 ;; user can't mix tags of both types. | |
119 ["Pull in All Compositions (MH)" | |
120 mh-mh-to-mime (mh-mh-directive-present-p)] | |
121 ["Pull in All Compositions (MML)" | |
122 mh-mml-to-mime (mh-mml-tag-present-p)] | |
123 ["Revert to Non-MIME Edit (MH)" | |
124 mh-mh-to-mime-undo (equal mh-compose-insertion 'mh)] | |
125 ["Kill This Draft" mh-fully-kill-draft t])) | |
126 | |
127 | |
128 | |
129 ;;; MH-Letter Keys | |
130 | |
131 ;; If this changes, modify mh-letter-mode-help-messages accordingly, above. | |
132 (gnus-define-keys mh-letter-mode-map | |
133 " " mh-letter-complete-or-space | |
134 "," mh-letter-confirm-address | |
135 "\C-c?" mh-help | |
136 "\C-c\C-\\" mh-fully-kill-draft ;if no C-q | |
137 "\C-c\C-^" mh-insert-signature ;if no C-s | |
138 "\C-c\C-c" mh-send-letter | |
139 "\C-c\C-d" mh-insert-identity | |
140 "\C-c\C-e" mh-mh-to-mime | |
141 "\C-c\C-f\C-a" mh-to-field | |
142 "\C-c\C-f\C-b" mh-to-field | |
143 "\C-c\C-f\C-c" mh-to-field | |
144 "\C-c\C-f\C-d" mh-to-field | |
145 "\C-c\C-f\C-f" mh-to-fcc | |
146 "\C-c\C-f\C-l" mh-to-field | |
147 "\C-c\C-f\C-m" mh-to-field | |
148 "\C-c\C-f\C-r" mh-to-field | |
149 "\C-c\C-f\C-s" mh-to-field | |
150 "\C-c\C-f\C-t" mh-to-field | |
151 "\C-c\C-fa" mh-to-field | |
152 "\C-c\C-fb" mh-to-field | |
153 "\C-c\C-fc" mh-to-field | |
154 "\C-c\C-fd" mh-to-field | |
155 "\C-c\C-ff" mh-to-fcc | |
156 "\C-c\C-fl" mh-to-field | |
157 "\C-c\C-fm" mh-to-field | |
158 "\C-c\C-fr" mh-to-field | |
159 "\C-c\C-fs" mh-to-field | |
160 "\C-c\C-ft" mh-to-field | |
161 "\C-c\C-i" mh-insert-letter | |
162 "\C-c\C-m\C-e" mh-mml-secure-message-encrypt | |
163 "\C-c\C-m\C-f" mh-compose-forward | |
164 "\C-c\C-m\C-g" mh-mh-compose-anon-ftp | |
165 "\C-c\C-m\C-i" mh-compose-insertion | |
166 "\C-c\C-m\C-m" mh-mml-to-mime | |
167 "\C-c\C-m\C-n" mh-mml-unsecure-message | |
168 "\C-c\C-m\C-s" mh-mml-secure-message-sign | |
169 "\C-c\C-m\C-t" mh-mh-compose-external-compressed-tar | |
170 "\C-c\C-m\C-u" mh-mh-to-mime-undo | |
171 "\C-c\C-m\C-x" mh-mh-compose-external-type | |
172 "\C-c\C-mee" mh-mml-secure-message-encrypt | |
173 "\C-c\C-mes" mh-mml-secure-message-signencrypt | |
174 "\C-c\C-mf" mh-compose-forward | |
175 "\C-c\C-mg" mh-mh-compose-anon-ftp | |
176 "\C-c\C-mi" mh-compose-insertion | |
177 "\C-c\C-mm" mh-mml-to-mime | |
178 "\C-c\C-mn" mh-mml-unsecure-message | |
179 "\C-c\C-mse" mh-mml-secure-message-signencrypt | |
180 "\C-c\C-mss" mh-mml-secure-message-sign | |
181 "\C-c\C-mt" mh-mh-compose-external-compressed-tar | |
182 "\C-c\C-mu" mh-mh-to-mime-undo | |
183 "\C-c\C-mx" mh-mh-compose-external-type | |
184 "\C-c\C-o" mh-open-line | |
185 "\C-c\C-q" mh-fully-kill-draft | |
186 "\C-c\C-s" mh-insert-signature | |
187 "\C-c\C-t" mh-letter-toggle-header-field-display | |
188 "\C-c\C-w" mh-check-whom | |
189 "\C-c\C-y" mh-yank-cur-msg | |
190 "\C-c\M-d" mh-insert-auto-fields | |
191 "\M-\t" mh-letter-complete | |
192 "\t" mh-letter-next-header-field-or-indent | |
193 [backtab] mh-letter-previous-header-field) | |
194 | |
195 ;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el. | |
196 | |
197 | |
198 | |
199 ;;; MH-Letter Help Messages | |
200 | |
201 ;; Group messages logically, more or less. | |
202 (defvar mh-letter-mode-help-messages | |
203 '((nil | |
204 "Send letter: \\[mh-send-letter] " | |
205 "Open line: \\[mh-open-line]\n" | |
206 "Kill letter: \\[mh-fully-kill-draft] " | |
207 "Check recipients: \\[mh-check-whom]\n\n" | |
208 "Insert:\n" | |
209 " Current message: \\[mh-yank-cur-msg]\n" | |
210 " Attachment: \\[mh-compose-insertion]\n" | |
211 " Message to forward: \\[mh-compose-forward]\n" | |
212 " Signature: \\[mh-insert-signature]\n\n" | |
213 "Security:\n" | |
214 " Encrypt message: \\[mh-mml-secure-message-encrypt]\n" | |
215 " Sign message: \\[mh-mml-secure-message-sign]\n" | |
216 " Sign+Encrypt message: \\[mh-mml-secure-message-signencrypt]")) | |
217 "Key binding cheat sheet. | |
218 | |
219 This is an associative array which is used to show the most | |
220 common commands. The key is a prefix char. The value is one or | |
221 more strings which are concatenated together and displayed in the | |
222 minibuffer if ? is pressed after the prefix character. The | |
223 special key nil is used to display the non-prefixed commands. | |
224 | |
225 The substitutions described in `substitute-command-keys' are | |
226 performed as well.") | |
227 | |
228 | |
229 | |
230 ;;; MH-Letter Font Lock | |
231 | |
232 (defvar mh-letter-font-lock-keywords | |
233 `(,@(mh-show-font-lock-keywords-with-cite) | |
234 (mh-font-lock-field-data | |
235 (1 'mh-letter-header-field prepend t))) | |
236 "Additional expressions to highlight in MH-Letter buffers.") | |
237 | |
238 (defun mh-font-lock-field-data (limit) | |
239 "Find header field region between point and LIMIT." | |
240 (and (< (point) (mh-letter-header-end)) | |
241 (< (point) limit) | |
242 (let ((end (min limit (mh-letter-header-end))) | |
243 (point (point)) | |
244 data-end data-begin field) | |
245 (end-of-line) | |
246 (setq data-end (if (re-search-forward "^[^ \t]" end t) | |
247 (match-beginning 0) | |
248 end)) | |
249 (goto-char (1- data-end)) | |
250 (if (not (re-search-backward "\\(^[^ \t][^:]*\\):[ \t]*" nil t)) | |
251 (setq data-begin (point-min)) | |
252 (setq data-begin (match-end 0)) | |
253 (setq field (match-string 1))) | |
254 (setq data-begin (max point data-begin)) | |
255 (goto-char (if (equal point data-end) (1+ data-end) data-end)) | |
256 (cond ((and field (mh-letter-skipped-header-field-p field)) | |
257 (set-match-data nil) | |
258 nil) | |
259 (t (set-match-data | |
260 (list data-begin data-end data-begin data-end)) | |
261 t))))) | |
262 | |
263 (defun mh-letter-header-end () | |
264 "Find the end of the message header. | |
265 This function is to be used only for font locking. It works by | |
266 searching for `mh-mail-header-separator' in the buffer." | |
267 (save-excursion | |
268 (goto-char (point-min)) | |
269 (cond ((equal mh-mail-header-separator "") (point-min)) | |
270 ((search-forward (format "\n%s\n" mh-mail-header-separator) nil t) | |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68519
diff
changeset
|
271 (mh-line-beginning-position 0)) |
68465 | 272 (t (point-min))))) |
273 | |
274 | |
275 | |
276 ;;; MH-Letter Mode | |
277 | |
278 (defvar mh-letter-buttons-init-flag nil) | |
279 | |
280 ;; Shush compiler. | |
281 (eval-when-compile (mh-do-in-xemacs (defvar font-lock-defaults))) | |
282 | |
283 ;; Ensure new buffers won't get this mode if default-major-mode is nil. | |
284 (put 'mh-letter-mode 'mode-class 'special) | |
285 | |
286 ;;;###mh-autoload | |
287 (define-derived-mode mh-letter-mode mail-mode "MH-Letter" | |
288 "Mode for composing letters in MH-E\\<mh-letter-mode-map>. | |
289 | |
290 When you have finished composing, type \\[mh-send-letter] to send | |
291 the message using the MH mail handling system. | |
292 | |
293 There are two types of tags used by MH-E when composing MIME | |
294 messages: MML and MH. The option `mh-compose-insertion' controls | |
295 what type of tags are inserted by MH-E commands. These tags can | |
296 be converted to MIME body parts by running \\[mh-mh-to-mime] for | |
297 MH-style directives or \\[mh-mml-to-mime] for MML tags. | |
298 | |
299 Options that control this mode can be changed with | |
300 \\[customize-group]; specify the \"mh-compose\" group. | |
301 | |
302 When a message is composed, the hooks `text-mode-hook', | |
303 `mail-mode-hook', and `mh-letter-mode-hook' are run (in that | |
304 order). | |
305 | |
306 \\{mh-letter-mode-map}" | |
307 (mh-find-path) | |
308 (make-local-variable 'mh-send-args) | |
309 (make-local-variable 'mh-annotate-char) | |
310 (make-local-variable 'mh-annotate-field) | |
311 (make-local-variable 'mh-previous-window-config) | |
312 (make-local-variable 'mh-sent-from-folder) | |
313 (make-local-variable 'mh-sent-from-msg) | |
314 (mh-do-in-gnu-emacs | |
69245
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
315 (unless mh-letter-buttons-init-flag |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
316 (let ((load-path |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
317 (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path)) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
318 (image-load-path |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
319 (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path))) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
320 (mh-tool-bar-letter-buttons-init) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
321 (setq mh-letter-buttons-init-flag t))) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
322 (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)) |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
323 (mh-do-in-xemacs |
f3bbf5f32462
* mh-folder.el (mh-tool-bar-init): Autoload.
Bill Wohler <wohler@newt.com>
parents:
68529
diff
changeset
|
324 (mh-tool-bar-init :letter)) |
68465 | 325 ;; Set the local value of mh-mail-header-separator according to what is |
326 ;; present in the buffer... | |
327 (set (make-local-variable 'mh-mail-header-separator) | |
328 (save-excursion | |
329 (goto-char (mh-mail-header-end)) | |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68519
diff
changeset
|
330 (buffer-substring-no-properties (point) (mh-line-end-position)))) |
68465 | 331 (make-local-variable 'mail-header-separator) |
332 (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el | |
333 (mh-set-help mh-letter-mode-help-messages) | |
334 (setq buffer-invisibility-spec '((vanish . t) t)) | |
335 (set (make-local-variable 'line-move-ignore-invisible) t) | |
336 | |
337 ;; Enable undo since a show-mode buffer might have been reused. | |
338 (buffer-enable-undo) | |
339 (make-local-variable 'font-lock-defaults) | |
340 (cond | |
341 ((or (equal mh-highlight-citation-style 'font-lock) | |
342 (equal mh-highlight-citation-style 'gnus)) | |
343 ;; Let's use font-lock even if gnus is used in show-mode. The reason | |
344 ;; is that gnus uses static text properties which are not appropriate | |
345 ;; for a buffer that will be edited. So the choice here is either fontify | |
346 ;; the citations and header... | |
347 (setq font-lock-defaults '(mh-letter-font-lock-keywords t))) | |
348 (t | |
349 ;; ...or the header only | |
350 (setq font-lock-defaults '((mh-show-font-lock-keywords) t)))) | |
351 (easy-menu-add mh-letter-menu) | |
68473
e238dd02cdad
(mh-letter-menu): Remove. Defvar no longer needed to shush compiler.
Bill Wohler <wohler@newt.com>
parents:
68470
diff
changeset
|
352 ;; Maybe we want to use the existing Mail menu from mail-mode in |
e238dd02cdad
(mh-letter-menu): Remove. Defvar no longer needed to shush compiler.
Bill Wohler <wohler@newt.com>
parents:
68470
diff
changeset
|
353 ;; 9.0; in the mean time, let's remove it since the redundancy will |
e238dd02cdad
(mh-letter-menu): Remove. Defvar no longer needed to shush compiler.
Bill Wohler <wohler@newt.com>
parents:
68470
diff
changeset
|
354 ;; only produce confusion. |
e238dd02cdad
(mh-letter-menu): Remove. Defvar no longer needed to shush compiler.
Bill Wohler <wohler@newt.com>
parents:
68470
diff
changeset
|
355 (define-key mh-letter-mode-map [menu-bar mail] 'undefined) |
e238dd02cdad
(mh-letter-menu): Remove. Defvar no longer needed to shush compiler.
Bill Wohler <wohler@newt.com>
parents:
68470
diff
changeset
|
356 (mh-do-in-xemacs (easy-menu-remove mail-menubar-menu)) |
68465 | 357 (setq fill-column mh-letter-fill-column) |
358 ;; If text-mode-hook turned on auto-fill, tune it for messages | |
359 (when auto-fill-function | |
360 (make-local-variable 'auto-fill-function) | |
361 (setq auto-fill-function 'mh-auto-fill-for-letter))) | |
362 | |
363 | |
364 | |
365 ;;; MH-Letter Commands | |
366 | |
367 ;; Alphabetical. | |
368 ;; See also mh-comp.el and mh-mime.el. | |
369 | |
370 (defun mh-check-whom () | |
371 "Verify recipients, showing expansion of any aliases. | |
372 | |
373 This command expands aliases so you can check the actual address(es) | |
374 in the alias. A new buffer named \"*MH-E Recipients*\" is created with | |
375 the output of \"whom\"." | |
376 (interactive) | |
377 (let ((file-name buffer-file-name)) | |
378 (save-buffer) | |
379 (message "Checking recipients...") | |
380 (mh-in-show-buffer (mh-recipients-buffer) | |
381 (bury-buffer (current-buffer)) | |
382 (erase-buffer) | |
383 (mh-exec-cmd-output "whom" t file-name)) | |
384 (message "Checking recipients...done"))) | |
385 | |
386 (defun mh-insert-letter (folder message verbatim) | |
387 "Insert a message. | |
388 | |
389 This command prompts you for the FOLDER and MESSAGE number, which | |
390 defaults to the current message in that folder. It then inserts | |
391 the message, indented by `mh-ins-buf-prefix' (\"> \") unless | |
392 `mh-yank-behavior' is set to one of the supercite flavors in | |
393 which case supercite is used to format the message. Certain | |
394 undesirable header fields (see | |
395 `mh-invisible-header-fields-compiled') are removed before | |
396 insertion. | |
397 | |
398 If given a prefix argument VERBATIM, the header is left intact, the | |
399 message is not indented, and \"> \" is not inserted before each line. | |
400 This command leaves the mark before the letter and point after it." | |
401 (interactive | |
402 (let* ((folder | |
403 (mh-prompt-for-folder "Message from" | |
404 mh-sent-from-folder nil)) | |
405 (default | |
406 (if (and (equal folder mh-sent-from-folder) | |
407 (numberp mh-sent-from-msg)) | |
408 mh-sent-from-msg | |
409 (nth 0 (mh-translate-range folder "cur")))) | |
410 (message | |
411 (read-string (concat "Message number" | |
412 (or (and default | |
413 (format " (default %d): " default)) | |
414 ": "))))) | |
415 (list folder message current-prefix-arg))) | |
416 (save-restriction | |
417 (narrow-to-region (point) (point)) | |
418 (let ((start (point-min))) | |
419 (if (and (equal message "") (numberp mh-sent-from-msg)) | |
420 (setq message (int-to-string mh-sent-from-msg))) | |
421 (insert-file-contents | |
422 (expand-file-name message (mh-expand-file-name folder))) | |
423 (when (not verbatim) | |
424 (mh-clean-msg-header start mh-invisible-header-fields-compiled nil) | |
425 (goto-char (point-max)) ;Needed for sc-cite-original | |
426 (push-mark) ;Needed for sc-cite-original | |
427 (goto-char (point-min)) ;Needed for sc-cite-original | |
428 (mh-insert-prefix-string mh-ins-buf-prefix))))) | |
429 | |
430 ;;;###mh-autoload | |
431 (defun mh-insert-signature (&optional file) | |
432 "Insert signature in message. | |
433 | |
434 This command inserts your signature at the current cursor location. | |
435 | |
436 By default, the text of your signature is taken from the file | |
437 \"~/.signature\". You can read from other sources by changing the | |
438 option `mh-signature-file-name'. | |
439 | |
440 A signature separator (\"-- \") will be added if the signature block | |
441 does not contain one and `mh-signature-separator-flag' is on. | |
442 | |
443 The hook `mh-insert-signature-hook' is run after the signature is | |
444 inserted. Hook functions may access the actual name of the file or the | |
445 function used to insert the signature with `mh-signature-file-name'. | |
446 | |
447 The signature can also be inserted using Identities (see | |
448 `mh-identity-list'). | |
449 | |
450 In a program, you can pass in a signature FILE." | |
451 (interactive) | |
452 (save-excursion | |
453 (insert "\n") | |
454 (let ((mh-signature-file-name (or file mh-signature-file-name)) | |
455 (mh-mh-p (mh-mh-directive-present-p)) | |
456 (mh-mml-p (mh-mml-tag-present-p))) | |
457 (save-restriction | |
458 (narrow-to-region (point) (point)) | |
459 (cond | |
460 ((mh-file-is-vcard-p mh-signature-file-name) | |
461 (if (equal mh-compose-insertion 'mml) | |
462 (insert "<#part type=\"text/x-vcard\" filename=\"" | |
463 mh-signature-file-name | |
464 "\" disposition=inline description=VCard>\n<#/part>") | |
465 (insert "#text/x-vcard; name=\"" | |
466 (file-name-nondirectory mh-signature-file-name) | |
467 "\" [VCard] " (expand-file-name mh-signature-file-name)))) | |
468 (t | |
469 (cond | |
470 (mh-mh-p | |
471 (insert "#\n" "Content-Description: Signature\n")) | |
472 (mh-mml-p | |
473 (mml-insert-tag 'part 'type "text/plain" 'disposition "inline" | |
474 'description "Signature"))) | |
475 (cond ((null mh-signature-file-name)) | |
476 ((and (stringp mh-signature-file-name) | |
477 (file-readable-p mh-signature-file-name)) | |
478 (insert-file-contents mh-signature-file-name)) | |
479 ((functionp mh-signature-file-name) | |
480 (funcall mh-signature-file-name))))) | |
481 (save-restriction | |
482 (widen) | |
483 (run-hooks 'mh-insert-signature-hook)) | |
484 (goto-char (point-min)) | |
485 (when (and (not (mh-file-is-vcard-p mh-signature-file-name)) | |
486 mh-signature-separator-flag | |
487 (> (point-max) (point-min)) | |
488 (not (mh-signature-separator-p))) | |
489 (cond (mh-mh-p | |
490 (forward-line 2)) | |
491 (mh-mml-p | |
492 (forward-line 1))) | |
493 (insert mh-signature-separator)) | |
494 (if (not (> (point-max) (point-min))) | |
495 (message "No signature found"))))) | |
496 (force-mode-line-update)) | |
497 | |
498 (defun mh-letter-complete (arg) | |
499 "Perform completion on header field or word preceding point. | |
500 | |
501 If the field contains addresses (for example, \"To:\" or \"Cc:\") | |
502 or folders (for example, \"Fcc:\") then this command will provide | |
503 alias completion. In the body of the message, this command runs | |
504 `mh-letter-complete-function' instead, which is set to | |
505 `ispell-complete-word' by default. This command takes a prefix | |
506 argument ARG that is passed to the | |
507 `mh-letter-complete-function'." | |
508 (interactive "P") | |
509 (let ((func nil)) | |
510 (cond ((not (mh-in-header-p)) | |
511 (funcall mh-letter-complete-function arg)) | |
512 ((setq func (cdr (assoc (mh-letter-header-field-at-point) | |
513 mh-letter-complete-function-alist))) | |
514 (funcall func)) | |
515 (t (funcall mh-letter-complete-function arg))))) | |
516 | |
517 (defun mh-letter-complete-or-space (arg) | |
518 "Perform completion or insert space. | |
519 | |
520 Turn on the option `mh-compose-space-does-completion-flag' to use | |
521 this command to perform completion in the header. Otherwise, a | |
522 space is inserted; use a prefix argument ARG to specify more than | |
523 one space." | |
524 (interactive "p") | |
525 (let ((func nil) | |
526 (end-of-prev (save-excursion | |
527 (goto-char (mh-beginning-of-word)) | |
528 (mh-beginning-of-word -1)))) | |
529 (cond ((not mh-compose-space-does-completion-flag) | |
530 (self-insert-command arg)) | |
531 ((not (mh-in-header-p)) (self-insert-command arg)) | |
532 ((> (point) end-of-prev) (self-insert-command arg)) | |
533 ((setq func (cdr (assoc (mh-letter-header-field-at-point) | |
534 mh-letter-complete-function-alist))) | |
535 (funcall func)) | |
536 (t (self-insert-command arg))))) | |
537 | |
538 (defun mh-letter-confirm-address () | |
539 "Flash alias expansion. | |
540 | |
541 Addresses are separated by a comma\; when you press the comma, | |
542 this command flashes the alias expansion in the minibuffer if | |
543 `mh-alias-flash-on-comma' is turned on." | |
544 (interactive) | |
545 (cond ((not (mh-in-header-p)) (self-insert-command 1)) | |
546 ((eq (cdr (assoc (mh-letter-header-field-at-point) | |
547 mh-letter-complete-function-alist)) | |
548 'mh-alias-letter-expand-alias) | |
549 (mh-alias-reload-maybe) | |
550 (mh-alias-minibuffer-confirm-address)) | |
551 (t (self-insert-command 1)))) | |
552 | |
553 (defun mh-letter-next-header-field-or-indent (arg) | |
554 "Cycle to next field. | |
555 | |
556 Within the header of the message, this command moves between | |
557 fields that are highlighted with the face | |
558 `mh-letter-header-field', skipping those fields listed in | |
559 `mh-compose-skipped-header-fields'. After the last field, this | |
560 command then moves point to the message body before cycling back | |
561 to the first field. If point is already past the first line of | |
562 the message body, then this command indents by calling | |
563 `indent-relative' with the given prefix argument ARG." | |
564 (interactive "P") | |
565 (let ((header-end (save-excursion | |
566 (goto-char (mh-mail-header-end)) | |
567 (forward-line) | |
568 (point)))) | |
569 (if (> (point) header-end) | |
570 (indent-relative arg) | |
571 (mh-letter-next-header-field)))) | |
572 | |
573 (defun mh-letter-previous-header-field () | |
574 "Cycle to the previous header field. | |
575 | |
576 This command moves backwards between the fields and cycles to the | |
577 body of the message after the first field. Unlike the command | |
578 \\[mh-letter-next-header-field-or-indent], it will always take | |
579 point to the last field from anywhere in the body." | |
580 (interactive) | |
581 (let ((header-end (mh-mail-header-end))) | |
582 (if (>= (point) header-end) | |
583 (goto-char header-end) | |
584 (mh-header-field-beginning)) | |
585 (cond ((re-search-backward mh-letter-header-field-regexp nil t) | |
586 (if (mh-letter-skipped-header-field-p (match-string 1)) | |
587 (mh-letter-previous-header-field) | |
588 (goto-char (match-end 0)) | |
589 (mh-letter-skip-leading-whitespace-in-header-field))) | |
590 (t (goto-char header-end) | |
591 (forward-line))))) | |
592 | |
593 (defun mh-open-line () | |
594 "Insert a newline and leave point before it. | |
595 | |
596 This command is similar to the command \\[open-line] in that it | |
597 inserts a newline after point. It differs in that it also inserts | |
598 the right number of quoting characters and spaces so that the | |
599 next line begins in the same column as it was. This is useful | |
600 when breaking up paragraphs in replies." | |
601 (interactive) | |
602 (let ((column (current-column)) | |
603 (prefix (mh-current-fill-prefix))) | |
604 (if (> (length prefix) column) | |
605 (message "Sorry, point seems to be within the line prefix") | |
606 (newline 2) | |
607 (insert prefix) | |
608 (while (> column (current-column)) | |
609 (insert " ")) | |
610 (forward-line -1)))) | |
611 | |
612 (defun mh-to-fcc (&optional folder) | |
613 "Move to \"Fcc:\" header field. | |
614 | |
615 This command will prompt you for the FOLDER name in which to file | |
616 a copy of the draft." | |
617 (interactive (list (mh-prompt-for-folder | |
618 "Fcc" | |
619 (or (and mh-default-folder-for-message-function | |
620 (save-excursion | |
621 (goto-char (point-min)) | |
622 (funcall | |
623 mh-default-folder-for-message-function))) | |
624 "") | |
625 t))) | |
626 (let ((last-input-char ?\C-f)) | |
627 (expand-abbrev) | |
628 (save-excursion | |
629 (mh-to-field) | |
630 (insert (if (mh-folder-name-p folder) | |
631 (substring folder 1) | |
632 folder))))) | |
633 | |
634 (defvar mh-to-field-choices '(("a" . "Mail-Reply-To:") | |
635 ("b" . "Bcc:") | |
636 ("c" . "Cc:") | |
637 ("d" . "Dcc:") | |
638 ("f" . "Fcc:") | |
639 ("l" . "Mail-Followup-To:") | |
640 ("m" . "From:") | |
641 ("r" . "Reply-To:") | |
642 ("s" . "Subject:") | |
643 ("t" . "To:")) | |
644 "Alist of (final-character . field-name) choices for `mh-to-field'.") | |
645 | |
646 (defun mh-to-field () | |
647 "Move to specified header field. | |
648 | |
649 The field is indicated by the previous keystroke (the last | |
650 keystroke of the command) according to the list in the variable | |
651 `mh-to-field-choices'. | |
652 Create the field if it does not exist. | |
653 Set the mark to point before moving." | |
654 (interactive) | |
655 (expand-abbrev) | |
656 (let ((target (cdr (or (assoc (char-to-string (logior last-input-char ?`)) | |
657 mh-to-field-choices) | |
658 ;; also look for a char for version 4 compat | |
659 (assoc (logior last-input-char ?`) | |
660 mh-to-field-choices)))) | |
661 (case-fold-search t)) | |
662 (push-mark) | |
663 (cond ((mh-position-on-field target) | |
664 (let ((eol (point))) | |
665 (skip-chars-backward " \t") | |
666 (delete-region (point) eol)) | |
667 (if (and (not (eq (logior last-input-char ?`) ?s)) | |
668 (save-excursion | |
669 (backward-char 1) | |
670 (not (looking-at "[:,]")))) | |
671 (insert ", ") | |
672 (insert " "))) | |
673 (t | |
674 (if (mh-position-on-field "To:") | |
675 (forward-line 1)) | |
676 (insert (format "%s \n" target)) | |
677 (backward-char 1))))) | |
678 | |
679 ;;;###mh-autoload | |
680 (defun mh-yank-cur-msg () | |
681 "Insert the current message into the draft buffer. | |
682 | |
683 It is often useful to insert a snippet of text from a letter that | |
684 someone mailed to provide some context for your reply. This | |
685 command does this by adding an attribution, yanking a portion of | |
686 text from the message to which you're replying, and inserting | |
687 `mh-ins-buf-prefix' (`> ') before each line. | |
688 | |
689 The attribution consists of the sender's name and email address | |
690 followed by the content of the option | |
691 `mh-extract-from-attribution-verb'. | |
692 | |
693 You can also turn on the option | |
694 `mh-delete-yanked-msg-window-flag' to delete the window | |
695 containing the original message after yanking it to make more | |
696 room on your screen for your reply. | |
697 | |
698 You can control how the message to which you are replying is | |
699 yanked into your reply using `mh-yank-behavior'. | |
700 | |
701 If this isn't enough, you can gain full control over the | |
702 appearance of the included text by setting `mail-citation-hook' | |
703 to a function that modifies it. For example, if you set this hook | |
704 to `trivial-cite' (which is NOT part of Emacs), set | |
705 `mh-yank-behavior' to \"Body and Header\" (see URL | |
706 `http://shasta.cs.uiuc.edu/~lrclause/tc.html'). | |
707 | |
708 Note that if `mail-citation-hook' is set, `mh-ins-buf-prefix' is | |
709 not inserted. If the option `mh-yank-behavior' is set to one of | |
710 the supercite flavors, the hook `mail-citation-hook' is ignored | |
711 and `mh-ins-buf-prefix' is not inserted." | |
712 (interactive) | |
713 (if (and mh-sent-from-folder | |
714 (save-excursion (set-buffer mh-sent-from-folder) mh-show-buffer) | |
715 (save-excursion (set-buffer mh-sent-from-folder) | |
716 (get-buffer mh-show-buffer)) | |
717 mh-sent-from-msg) | |
718 (let ((to-point (point)) | |
719 (to-buffer (current-buffer))) | |
720 (set-buffer mh-sent-from-folder) | |
721 (if mh-delete-yanked-msg-window-flag | |
722 (delete-windows-on mh-show-buffer)) | |
723 (set-buffer mh-show-buffer) ; Find displayed message | |
724 (let* ((from-attr (mh-extract-from-attribution)) | |
725 (yank-region (mh-mark-active-p nil)) | |
726 (mh-ins-str | |
727 (cond ((and yank-region | |
728 (or (eq 'supercite mh-yank-behavior) | |
729 (eq 'autosupercite mh-yank-behavior) | |
730 (eq t mh-yank-behavior))) | |
731 ;; supercite needs the full header | |
732 (concat | |
733 (buffer-substring (point-min) (mh-mail-header-end)) | |
734 "\n" | |
735 (buffer-substring (region-beginning) (region-end)))) | |
736 (yank-region | |
737 (buffer-substring (region-beginning) (region-end))) | |
738 ((or (eq 'body mh-yank-behavior) | |
739 (eq 'attribution mh-yank-behavior) | |
740 (eq 'autoattrib mh-yank-behavior)) | |
741 (buffer-substring | |
742 (save-excursion | |
743 (goto-char (point-min)) | |
744 (mh-goto-header-end 1) | |
745 (point)) | |
746 (point-max))) | |
747 ((or (eq 'supercite mh-yank-behavior) | |
748 (eq 'autosupercite mh-yank-behavior) | |
749 (eq t mh-yank-behavior)) | |
750 (buffer-substring (point-min) (point-max))) | |
751 (t | |
752 (buffer-substring (point) (point-max)))))) | |
753 (set-buffer to-buffer) | |
754 (save-restriction | |
755 (narrow-to-region to-point to-point) | |
756 (insert (mh-filter-out-non-text mh-ins-str)) | |
757 (goto-char (point-max)) ;Needed for sc-cite-original | |
758 (push-mark) ;Needed for sc-cite-original | |
759 (goto-char (point-min)) ;Needed for sc-cite-original | |
760 (mh-insert-prefix-string mh-ins-buf-prefix) | |
761 (when (or (eq 'attribution mh-yank-behavior) | |
762 (eq 'autoattrib mh-yank-behavior)) | |
763 (insert from-attr) | |
764 (mh-identity-insert-attribution-verb nil) | |
765 (insert "\n\n")) | |
766 ;; If the user has selected a region, he has already "edited" the | |
767 ;; text, so leave the cursor at the end of the yanked text. In | |
768 ;; either case, leave a mark at the opposite end of the included | |
769 ;; text to make it easy to jump or delete to the other end of the | |
770 ;; text. | |
771 (push-mark) | |
772 (goto-char (point-max)) | |
773 (if (null yank-region) | |
774 (mh-exchange-point-and-mark-preserving-active-mark))))) | |
775 (error "There is no current message"))) | |
776 | |
777 | |
778 | |
779 ;;; Support Routines | |
780 | |
781 (defun mh-auto-fill-for-letter () | |
782 "Perform auto-fill for message. | |
783 Header is treated specially by inserting a tab before continuation | |
784 lines." | |
785 (if (mh-in-header-p) | |
786 (let ((fill-prefix "\t")) | |
787 (do-auto-fill)) | |
788 (do-auto-fill))) | |
789 | |
790 (defun mh-filter-out-non-text (string) | |
791 "Return STRING but without adornments such as MIME buttons and smileys." | |
792 (with-temp-buffer | |
793 ;; Insert the string to filter | |
794 (insert string) | |
795 (goto-char (point-min)) | |
796 | |
797 ;; Remove the MIME buttons | |
798 (let ((can-move-forward t) | |
799 (in-button nil)) | |
800 (while can-move-forward | |
801 (cond ((and (not (get-text-property (point) 'mh-data)) | |
802 in-button) | |
803 (delete-region (1- (point)) (point)) | |
804 (setq in-button nil)) | |
805 ((get-text-property (point) 'mh-data) | |
806 (delete-region (point) | |
807 (save-excursion (forward-line) (point))) | |
808 (setq in-button t)) | |
809 (t (setq can-move-forward (= (forward-line) 0)))))) | |
810 | |
811 ;; Return the contents without properties... This gets rid of emphasis | |
812 ;; and smileys | |
813 (buffer-substring-no-properties (point-min) (point-max)))) | |
814 | |
815 (defun mh-current-fill-prefix () | |
816 "Return the `fill-prefix' on the current line as a string." | |
817 (save-excursion | |
818 (beginning-of-line) | |
819 ;; This assumes that the major-mode sets up adaptive-fill-regexp | |
820 ;; correctly such as mh-letter-mode or sendmail.el's mail-mode. But | |
821 ;; perhaps I should use the variable and simply inserts its value here, | |
822 ;; and set it locally in a let scope. --psg | |
823 (if (re-search-forward adaptive-fill-regexp nil t) | |
824 (match-string 0) | |
825 ""))) | |
826 | |
827 ;;;###mh-autoload | |
828 (defun mh-letter-next-header-field () | |
829 "Cycle to the next header field. | |
830 If we are at the last header field go to the start of the message | |
831 body." | |
832 (let ((header-end (mh-mail-header-end))) | |
833 (cond ((>= (point) header-end) (goto-char (point-min))) | |
834 ((< (point) (progn | |
835 (beginning-of-line) | |
836 (re-search-forward mh-letter-header-field-regexp | |
68529
7daec5f4a289
* mh-alias.el (mh-alias-gecos-name): Use mh-replace-regexp-in-string
Bill Wohler <wohler@newt.com>
parents:
68519
diff
changeset
|
837 (mh-line-end-position) t) |
68465 | 838 (point))) |
839 (beginning-of-line)) | |
840 (t (end-of-line))) | |
841 (cond ((re-search-forward mh-letter-header-field-regexp header-end t) | |
842 (if (mh-letter-skipped-header-field-p (match-string 1)) | |
843 (mh-letter-next-header-field) | |
844 (mh-letter-skip-leading-whitespace-in-header-field))) | |
845 (t (goto-char header-end) | |
846 (forward-line))))) | |
847 | |
848 ;;;###mh-autoload | |
849 (defun mh-position-on-field (field &optional ignored) | |
850 "Move to the end of the FIELD in the header. | |
851 Move to end of entire header if FIELD not found. | |
852 Returns non-nil iff FIELD was found. | |
853 The optional second arg is for pre-version 4 compatibility and is | |
854 IGNORED." | |
855 (cond ((mh-goto-header-field field) | |
856 (mh-header-field-end) | |
857 t) | |
858 ((mh-goto-header-end 0) | |
859 nil))) | |
860 | |
861 (defun mh-letter-header-field-at-point () | |
862 "Return the header field name at point. | |
863 A symbol is returned whose name is the string obtained by | |
864 downcasing the field name." | |
865 (save-excursion | |
866 (end-of-line) | |
867 (and (re-search-backward mh-letter-header-field-regexp nil t) | |
868 (intern (downcase (match-string 1)))))) | |
869 | |
870 (defun mh-folder-expand-at-point () | |
871 "Do folder name completion in Fcc header field." | |
872 (let* ((end (point)) | |
873 (beg (mh-beginning-of-word)) | |
874 (folder (buffer-substring beg end)) | |
875 (leading-plus (and (> (length folder) 0) (equal (aref folder 0) ?+))) | |
876 (last-slash (mh-search-from-end ?/ folder)) | |
877 (prefix (and last-slash (substring folder 0 last-slash))) | |
878 (choices (mapcar #'(lambda (x) | |
879 (list (cond (prefix (format "%s/%s" prefix x)) | |
880 (leading-plus (format "+%s" x)) | |
881 (t x)))) | |
882 (mh-folder-completion-function folder nil t)))) | |
883 (mh-complete-word folder choices beg end))) | |
884 | |
885 ;;;###mh-autoload | |
886 (defun mh-complete-word (word choices begin end) | |
887 "Complete WORD at from CHOICES. | |
888 Any match found replaces the text from BEGIN to END." | |
889 (let ((completion (try-completion word choices)) | |
890 (completions-buffer "*Completions*")) | |
891 (cond ((eq completion t) | |
892 (ignore-errors | |
893 (kill-buffer completions-buffer)) | |
894 (message "Completed: %s" word)) | |
895 ((null completion) | |
896 (ignore-errors | |
897 (kill-buffer completions-buffer)) | |
898 (message "No completion for %s" word)) | |
899 ((stringp completion) | |
900 (if (equal word completion) | |
901 (with-output-to-temp-buffer completions-buffer | |
902 (mh-display-completion-list (all-completions word choices) | |
68519
bf46ace1ce4e
(mh-complete-word): Fix bug in call to mh-display-completion-list.
Bill Wohler <wohler@newt.com>
parents:
68477
diff
changeset
|
903 word)) |
68465 | 904 (ignore-errors |
905 (kill-buffer completions-buffer)) | |
906 (delete-region begin end) | |
907 (insert completion)))))) | |
908 | |
909 (defun mh-file-is-vcard-p (file) | |
910 "Return t if FILE is a .vcf vcard." | |
911 (let ((case-fold-search t)) | |
912 (and (stringp file) | |
913 (file-exists-p file) | |
914 (or (and (not (mh-have-file-command)) | |
915 (not (null (string-match "\.vcf$" file)))) | |
916 (string-equal "text/x-vcard" (mh-file-mime-type file)))))) | |
917 | |
68477
0f44616074ba
* mh-comp.el (mh-letter-hide-all-skipped-fields)
Bill Wohler <wohler@newt.com>
parents:
68473
diff
changeset
|
918 ;;;###mh-autoload |
68465 | 919 (defun mh-letter-toggle-header-field-display-button (event) |
920 "Toggle header field display at location of EVENT. | |
921 This function does the same thing as | |
922 `mh-letter-toggle-header-field-display' except that it is | |
923 callable from a mouse button." | |
924 (interactive "e") | |
925 (mh-do-at-event-location event | |
926 (mh-letter-toggle-header-field-display nil))) | |
927 | |
928 (defun mh-extract-from-attribution () | |
929 "Extract phrase or comment from From header field." | |
930 (save-excursion | |
931 (if (not (mh-goto-header-field "From: ")) | |
932 nil | |
933 (skip-chars-forward " ") | |
934 (cond | |
935 ((looking-at "\"\\([^\"\n]+\\)\" \\(<.+>\\)") | |
936 (format "%s %s " (match-string 1)(match-string 2))) | |
937 ((looking-at "\\([^<\n]+<.+>\\)$") | |
938 (format "%s " (match-string 1))) | |
939 ((looking-at "\\([^ ]+@[^ ]+\\) +(\\(.+\\))$") | |
940 (format "%s <%s> " (match-string 2)(match-string 1))) | |
941 ((looking-at " *\\(.+\\)$") | |
942 (format "%s " (match-string 1))))))) | |
943 | |
944 (defun mh-insert-prefix-string (mh-ins-string) | |
945 "Insert prefix string before each line in buffer. | |
946 The inserted letter is cited using `sc-cite-original' if | |
947 `mh-yank-behavior' is one of 'supercite or 'autosupercite. | |
948 Otherwise, simply insert MH-INS-STRING before each line." | |
949 (goto-char (point-min)) | |
950 (cond ((or (eq mh-yank-behavior 'supercite) | |
951 (eq mh-yank-behavior 'autosupercite)) | |
952 (sc-cite-original)) | |
953 (mail-citation-hook | |
954 (run-hooks 'mail-citation-hook)) | |
955 (mh-yank-hooks ;old hook name | |
956 (run-hooks 'mh-yank-hooks)) | |
957 (t | |
958 (or (bolp) (forward-line 1)) | |
959 (while (< (point) (point-max)) | |
960 (insert mh-ins-string) | |
961 (forward-line 1)) | |
962 (goto-char (point-min))))) ;leave point like sc-cite-original | |
963 | |
964 (provide 'mh-letter) | |
965 | |
966 ;; Local Variables: | |
967 ;; indent-tabs-mode: nil | |
968 ;; sentence-end-double-space: nil | |
969 ;; End: | |
970 | |
68470 | 971 ;; arch-tag: 0548632c-aadb-4e3b-bb80-bbd62ff90bf3 |
68465 | 972 ;;; mh-letter.el ends here |