33 |
|
|
34 |
;;; Code: |
;;; Code: |
35 |
|
|
36 |
|
(eval-when-compile (require 'mh-acros)) |
37 |
|
(mh-require-cl) |
38 |
(require 'mh-e) |
(require 'mh-e) |
39 |
(require 'gnus-util) |
(require 'gnus-util) |
40 |
(require 'easymenu) |
(require 'easymenu) |
41 |
(require 'mh-utils) |
(require 'mh-gnus) |
|
(mh-require-cl) |
|
42 |
(eval-when (compile load eval) |
(eval-when (compile load eval) |
43 |
(ignore-errors (require 'mailabbrev))) |
(ignore-errors (require 'mailabbrev))) |
44 |
|
|
49 |
(defvar sendmail-coding-system) |
(defvar sendmail-coding-system) |
50 |
(defvar mh-identity-list) |
(defvar mh-identity-list) |
51 |
(defvar mh-identity-default) |
(defvar mh-identity-default) |
52 |
|
(defvar mh-mml-mode-default) |
53 |
(defvar mh-identity-menu) |
(defvar mh-identity-menu) |
54 |
|
|
55 |
;;; Autoloads |
;;; Autoloads |
60 |
(autoload 'sc-cite-original "sc" |
(autoload 'sc-cite-original "sc" |
61 |
"Workhorse citing function which performs the initial citation. |
"Workhorse citing function which performs the initial citation. |
62 |
This is callable from the various mail and news readers' reply |
This is callable from the various mail and news readers' reply |
63 |
function according to the agreed upon standard. See `\\[sc-describe]' |
function according to the agreed upon standard. See `sc-describe' |
64 |
for more details. `sc-cite-original' does not do any yanking of the |
for more details. `sc-cite-original' does not do any yanking of the |
65 |
original message but it does require a few things: |
original message but it does require a few things: |
66 |
|
|
97 |
This allows transaction log to be visible if -watch, -verbose or -snoop are |
This allows transaction log to be visible if -watch, -verbose or -snoop are |
98 |
used.") |
used.") |
99 |
|
|
100 |
(defvar mh-note-repl "-" |
;;; Scan Line Formats |
101 |
"String whose first character is used to notate replied to messages.") |
|
102 |
|
(defvar mh-note-repl ?- |
103 |
|
"Messages that have been replied to are marked by this character.") |
104 |
|
|
105 |
(defvar mh-note-forw "F" |
(defvar mh-note-forw ?F |
106 |
"String whose first character is used to notate forwarded messages.") |
"Messages that have been forwarded are marked by this character.") |
107 |
|
|
108 |
(defvar mh-note-dist "R" |
(defvar mh-note-dist ?R |
109 |
"String whose first character is used to notate redistributed messages.") |
"Messages that have been redistributed are marked by this character.") |
110 |
|
|
111 |
(defvar mh-yank-hooks nil |
(defvar mh-yank-hooks nil |
112 |
"Obsolete hook for modifying a citation just inserted in the mail buffer. |
"Obsolete hook for modifying a citation just inserted in the mail buffer. |
117 |
This is a normal hook, misnamed for historical reasons. |
This is a normal hook, misnamed for historical reasons. |
118 |
It is semi-obsolete and is only used if `mail-citation-hook' is nil.") |
It is semi-obsolete and is only used if `mail-citation-hook' is nil.") |
119 |
|
|
|
(defvar mail-citation-hook nil |
|
|
"*Hook for modifying a citation just inserted in the mail buffer. |
|
|
Each hook function can find the citation between point and mark. |
|
|
And each hook function should leave point and mark around the citation |
|
|
text as modified. |
|
|
|
|
|
If this hook is entirely empty (nil), the text of the message is inserted |
|
|
with `mh-ins-buf-prefix' prefixed to each line. |
|
|
|
|
|
See also the variable `mh-yank-from-start-of-msg', which controls how |
|
|
much of the message passed to the hook. |
|
|
|
|
|
This hook was historically provided to set up supercite. You may now leave |
|
|
this nil and set up supercite by setting the variable |
|
|
`mh-yank-from-start-of-msg' to 'supercite or, for more automatic insertion, |
|
|
to 'autosupercite.") |
|
|
|
|
120 |
(defvar mh-comp-formfile "components" |
(defvar mh-comp-formfile "components" |
121 |
"Name of file to be used as a skeleton for composing messages. |
"Name of file to be used as a skeleton for composing messages. |
122 |
Default is \"components\". If not an absolute file name, the file |
Default is \"components\". If not an absolute file name, the file |
132 |
(defvar mh-repl-group-formfile "replgroupcomps" |
(defvar mh-repl-group-formfile "replgroupcomps" |
133 |
"Name of file to be used as a skeleton for replying to messages. |
"Name of file to be used as a skeleton for replying to messages. |
134 |
This file is used to form replies to the sender and all recipients of a |
This file is used to form replies to the sender and all recipients of a |
135 |
message. Only used if `mh-nmh-flag' is non-nil. Default is \"replgroupcomps\". |
message. Only used if `(mh-variant-p 'nmh)' is non-nil. |
136 |
|
Default is \"replgroupcomps\". |
137 |
If not an absolute file name, the file is searched for first in the user's MH |
If not an absolute file name, the file is searched for first in the user's MH |
138 |
directory, then in the system MH lib directory.") |
directory, then in the system MH lib directory.") |
139 |
|
|
141 |
(format "^%s$" |
(format "^%s$" |
142 |
(regexp-opt |
(regexp-opt |
143 |
'("Content-Type: message/rfc822" ;MIME MDN |
'("Content-Type: message/rfc822" ;MIME MDN |
144 |
|
"------ This is a copy of the message, including all the headers. ------";from exim |
145 |
|
"--- Below this line is a copy of the message."; from qmail |
146 |
" ----- Unsent message follows -----" ;from sendmail V5 |
" ----- Unsent message follows -----" ;from sendmail V5 |
147 |
" --------Unsent Message below:" ; from sendmail at BU |
" --------Unsent Message below:" ; from sendmail at BU |
148 |
" ----- Original message follows -----" ;from sendmail V8 |
" ----- Original message follows -----" ;from sendmail V8 |
191 |
"Field name for message annotation.") |
"Field name for message annotation.") |
192 |
|
|
193 |
(defvar mh-insert-auto-fields-done-local nil |
(defvar mh-insert-auto-fields-done-local nil |
194 |
"Buffer-local variable set when `mh-insert-auto-fields' successfully called.") |
"Buffer-local variable set when `mh-insert-auto-fields' called successfully.") |
195 |
(make-variable-buffer-local 'mh-insert-auto-fields-done-local) |
(make-variable-buffer-local 'mh-insert-auto-fields-done-local) |
196 |
|
|
197 |
;;;###autoload |
;;;###autoload |
198 |
(defun mh-smail () |
(defun mh-smail () |
199 |
"Compose and send mail with the MH mail system. |
"Compose and send mail with the MH mail system. |
200 |
This function is an entry point to MH-E, the Emacs front end |
This function is an entry point to MH-E, the Emacs interface to the MH mail |
201 |
to the MH mail system. |
system. |
202 |
|
|
203 |
See documentation of `\\[mh-send]' for more details on composing mail." |
See `mh-send' for more details on composing mail." |
204 |
(interactive) |
(interactive) |
205 |
(mh-find-path) |
(mh-find-path) |
206 |
(call-interactively 'mh-send)) |
(call-interactively 'mh-send)) |
210 |
;;;###autoload |
;;;###autoload |
211 |
(defun mh-smail-batch (&optional to subject other-headers &rest ignored) |
(defun mh-smail-batch (&optional to subject other-headers &rest ignored) |
212 |
"Set up a mail composition draft with the MH mail system. |
"Set up a mail composition draft with the MH mail system. |
213 |
This function is an entry point to MH-E, the Emacs front end |
This function is an entry point to MH-E, the Emacs interface to the MH mail |
214 |
to the MH mail system. This function does not prompt the user |
system. This function does not prompt the user for any header fields, and thus |
215 |
for any header fields, and thus is suitable for use by programs |
is suitable for use by programs that want to create a mail buffer. Users |
216 |
that want to create a mail buffer. |
should use `mh-smail' to compose mail. |
217 |
Users should use `\\[mh-smail]' to compose mail. |
|
218 |
Optional arguments for setting certain fields include TO, SUBJECT, and |
Optional arguments for setting certain fields include TO, SUBJECT, and |
219 |
OTHER-HEADERS. Additional arguments are IGNORED." |
OTHER-HEADERS. Additional arguments are IGNORED." |
220 |
(mh-find-path) |
(mh-find-path) |
250 |
"Clean up a draft or a message MSG previously sent and make it resendable. |
"Clean up a draft or a message MSG previously sent and make it resendable. |
251 |
Default is the current message. |
Default is the current message. |
252 |
The variable `mh-new-draft-cleaned-headers' specifies the headers to remove. |
The variable `mh-new-draft-cleaned-headers' specifies the headers to remove. |
253 |
See also documentation for `\\[mh-send]' function." |
|
254 |
|
See also `mh-send'." |
255 |
(interactive (list (mh-get-msg-num t))) |
(interactive (list (mh-get-msg-num t))) |
256 |
(let* ((from-folder mh-current-folder) |
(let* ((from-folder mh-current-folder) |
257 |
(config (current-window-configuration)) |
(config (current-window-configuration)) |
283 |
"Extract message MSG returned by the mail system and make it resendable. |
"Extract message MSG returned by the mail system and make it resendable. |
284 |
Default is the current message. The variable `mh-new-draft-cleaned-headers' |
Default is the current message. The variable `mh-new-draft-cleaned-headers' |
285 |
gives the headers to clean out of the original message. |
gives the headers to clean out of the original message. |
286 |
See also documentation for `\\[mh-send]' function." |
|
287 |
|
See also `mh-send'." |
288 |
(interactive (list (mh-get-msg-num t))) |
(interactive (list (mh-get-msg-num t))) |
289 |
(let ((from-folder mh-current-folder) |
(let ((from-folder mh-current-folder) |
290 |
(config (current-window-configuration)) |
(config (current-window-configuration)) |
295 |
(delete-region (point-min) (point)) |
(delete-region (point-min) (point)) |
296 |
(mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)) |
(mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)) |
297 |
(t |
(t |
298 |
(message "Does not appear to be a rejected letter."))) |
(message "Does not appear to be a rejected letter"))) |
299 |
(mh-insert-header-separator) |
(mh-insert-header-separator) |
300 |
(goto-char (point-min)) |
(goto-char (point-min)) |
301 |
(save-buffer) |
(save-buffer) |
315 |
Check the documentation of `mh-interactive-range' to see how RANGE is read in |
Check the documentation of `mh-interactive-range' to see how RANGE is read in |
316 |
interactive use. |
interactive use. |
317 |
|
|
318 |
See also documentation for `\\[mh-send]' function." |
See also `mh-send'." |
319 |
(interactive (list (mh-interactive-read-address "To: ") |
(interactive (list (mh-interactive-read-address "To: ") |
320 |
(mh-interactive-read-address "Cc: ") |
(mh-interactive-read-address "Cc: ") |
321 |
(mh-interactive-range "Forward"))) |
(mh-interactive-range "Forward"))) |
327 |
(draft-name (expand-file-name "draft" mh-user-path)) |
(draft-name (expand-file-name "draft" mh-user-path)) |
328 |
(draft (cond ((or (not (file-exists-p draft-name)) |
(draft (cond ((or (not (file-exists-p draft-name)) |
329 |
(y-or-n-p "The file 'draft' exists. Discard it? ")) |
(y-or-n-p "The file 'draft' exists. Discard it? ")) |
330 |
(mh-exec-cmd "forw" "-build" (if mh-nmh-flag "-mime") |
(mh-exec-cmd "forw" "-build" |
331 |
|
(if (and (mh-variant-p 'nmh) |
332 |
|
mh-compose-forward-as-mime-flag) |
333 |
|
"-mime") |
334 |
mh-current-folder |
mh-current-folder |
335 |
(mh-coalesce-msg-list msgs)) |
(mh-coalesce-msg-list msgs)) |
336 |
(prog1 |
(prog1 |
383 |
mh-note-forw "Forwarded:" |
mh-note-forw "Forwarded:" |
384 |
config) |
config) |
385 |
(mh-letter-mode-message) |
(mh-letter-mode-message) |
386 |
(mh-letter-adjust-point))))) |
(mh-letter-adjust-point) |
387 |
|
(run-hooks 'mh-forward-hook))))) |
388 |
|
|
389 |
(defun mh-forwarded-letter-subject (from subject) |
(defun mh-forwarded-letter-subject (from subject) |
390 |
"Return a Subject suitable for a forwarded message. |
"Return a Subject suitable for a forwarded message. |
402 |
;;;###autoload |
;;;###autoload |
403 |
(defun mh-smail-other-window () |
(defun mh-smail-other-window () |
404 |
"Compose and send mail in other window with the MH mail system. |
"Compose and send mail in other window with the MH mail system. |
405 |
This function is an entry point to MH-E, the Emacs front end |
This function is an entry point to MH-E, the Emacs interface to the MH mail |
406 |
to the MH mail system. |
system. |
407 |
|
|
408 |
See documentation of `\\[mh-send]' for more details on composing mail." |
See `mh-send' for more details on composing mail." |
409 |
(interactive) |
(interactive) |
410 |
(mh-find-path) |
(mh-find-path) |
411 |
(call-interactively 'mh-send-other-window)) |
(call-interactively 'mh-send-other-window)) |
492 |
If optional prefix argument INCLUDEP provided, then include the message |
If optional prefix argument INCLUDEP provided, then include the message |
493 |
in the reply using filter `mhl.reply' in your MH directory. |
in the reply using filter `mhl.reply' in your MH directory. |
494 |
If the file named by `mh-repl-formfile' exists, it is used as a skeleton |
If the file named by `mh-repl-formfile' exists, it is used as a skeleton |
495 |
for the reply. See also documentation for `\\[mh-send]' function." |
for the reply. |
496 |
|
|
497 |
|
See also `mh-send'." |
498 |
(interactive (list |
(interactive (list |
499 |
(mh-get-msg-num t) |
(mh-get-msg-num t) |
500 |
(let ((minibuffer-help-form |
(let ((minibuffer-help-form |
501 |
"from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients")) |
"from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients")) |
502 |
(or mh-reply-default-reply-to |
(or mh-reply-default-reply-to |
503 |
(completing-read "Reply to whom? (from, to, all) [from]: " |
(completing-read "Reply to whom: [from] " |
504 |
'(("from") ("to") ("cc") ("all")) |
'(("from") ("to") ("cc") ("all")) |
505 |
nil |
nil |
506 |
t))) |
t))) |
509 |
(show-buffer mh-show-buffer) |
(show-buffer mh-show-buffer) |
510 |
(config (current-window-configuration)) |
(config (current-window-configuration)) |
511 |
(group-reply (or (equal reply-to "cc") (equal reply-to "all"))) |
(group-reply (or (equal reply-to "cc") (equal reply-to "all"))) |
512 |
(form-file (cond ((and mh-nmh-flag group-reply |
(form-file (cond ((and (mh-variant-p 'nmh 'mu-mh) group-reply |
513 |
(stringp mh-repl-group-formfile)) |
(stringp mh-repl-group-formfile)) |
514 |
mh-repl-group-formfile) |
mh-repl-group-formfile) |
515 |
((stringp mh-repl-formfile) mh-repl-formfile) |
((stringp mh-repl-formfile) mh-repl-formfile) |
523 |
'("-nocc" "all")) |
'("-nocc" "all")) |
524 |
((equal reply-to "to") |
((equal reply-to "to") |
525 |
'("-cc" "to")) |
'("-cc" "to")) |
526 |
(group-reply (if mh-nmh-flag |
(group-reply (if (mh-variant-p 'nmh 'mu-mh) |
527 |
'("-group" "-nocc" "me") |
'("-group" "-nocc" "me") |
528 |
'("-cc" "all" "-nocc" "me")))) |
'("-cc" "all" "-nocc" "me")))) |
529 |
(cond ((or (eq mh-yank-from-start-of-msg 'autosupercite) |
(cond ((or (eq mh-yank-from-start-of-msg 'autosupercite) |
560 |
;;;###mh-autoload |
;;;###mh-autoload |
561 |
(defun mh-send (to cc subject) |
(defun mh-send (to cc subject) |
562 |
"Compose and send a letter. |
"Compose and send a letter. |
|
|
|
563 |
Do not call this function from outside MH-E; use \\[mh-smail] instead. |
Do not call this function from outside MH-E; use \\[mh-smail] instead. |
564 |
|
|
565 |
The file named by `mh-comp-formfile' will be used as the form. |
The file named by `mh-comp-formfile' will be used as the form. |
578 |
;;;###mh-autoload |
;;;###mh-autoload |
579 |
(defun mh-send-other-window (to cc subject) |
(defun mh-send-other-window (to cc subject) |
580 |
"Compose and send a letter in another window. |
"Compose and send a letter in another window. |
|
|
|
581 |
Do not call this function from outside MH-E; use \\[mh-smail-other-window] |
Do not call this function from outside MH-E; use \\[mh-smail-other-window] |
582 |
instead. |
instead. |
583 |
|
|
707 |
(while name-values |
(while name-values |
708 |
(let ((field-name (car name-values)) |
(let ((field-name (car name-values)) |
709 |
(value (car (cdr name-values)))) |
(value (car (cdr name-values)))) |
710 |
|
(if (not (string-match "^.*:$" field-name)) |
711 |
|
(setq field-name (concat field-name ":"))) |
712 |
(cond ((equal value "") |
(cond ((equal value "") |
713 |
nil) |
nil) |
714 |
((mh-position-on-field field-name) |
((mh-position-on-field field-name) |
728 |
((mh-goto-header-end 0) |
((mh-goto-header-end 0) |
729 |
nil))) |
nil))) |
730 |
|
|
731 |
|
;;;###mh-autoload |
732 |
(defun mh-get-header-field (field) |
(defun mh-get-header-field (field) |
733 |
"Find and return the body of FIELD in the mail header. |
"Find and return the body of FIELD in the mail header. |
734 |
Returns the empty string if the field is not in the header of the |
Returns the empty string if the field is not in the header of the |
776 |
|
|
777 |
;;; Menu extracted from mh-menubar.el V1.1 (31 July 2001) |
;;; Menu extracted from mh-menubar.el V1.1 (31 July 2001) |
778 |
(eval-when-compile (defvar mh-letter-menu nil)) |
(eval-when-compile (defvar mh-letter-menu nil)) |
779 |
(cond |
(easy-menu-define |
780 |
((fboundp 'easy-menu-define) |
mh-letter-menu mh-letter-mode-map "Menu for MH-E letter mode." |
781 |
(easy-menu-define |
'("Letter" |
782 |
mh-letter-menu mh-letter-mode-map "Menu for MH-E letter mode." |
["Send This Draft" mh-send-letter t] |
783 |
'("Letter" |
["Split Current Line" mh-open-line t] |
784 |
["Send This Draft" mh-send-letter t] |
["Check Recipient" mh-check-whom t] |
785 |
["Split Current Line" mh-open-line t] |
["Yank Current Message" mh-yank-cur-msg t] |
786 |
["Check Recipient" mh-check-whom t] |
["Insert a Message..." mh-insert-letter t] |
787 |
["Yank Current Message" mh-yank-cur-msg t] |
["Insert Signature" mh-insert-signature t] |
788 |
["Insert a Message..." mh-insert-letter t] |
("Encrypt/Sign Message" |
789 |
["Insert Signature" mh-insert-signature t] |
["Sign Message" |
790 |
["GPG Sign message" |
mh-mml-secure-message-sign mh-gnus-pgp-support-flag] |
791 |
mh-mml-secure-message-sign-pgpmime mh-gnus-pgp-support-flag] |
["Encrypt Message" |
792 |
["GPG Encrypt message" |
mh-mml-secure-message-encrypt mh-gnus-pgp-support-flag] |
793 |
mh-mml-secure-message-encrypt-pgpmime mh-gnus-pgp-support-flag] |
["Sign+Encrypt Message" |
794 |
["Compose Insertion (MIME)..." mh-compose-insertion t] |
mh-mml-secure-message-signencrypt mh-gnus-pgp-support-flag] |
795 |
;; ["Compose Compressed tar (MIME)..." |
["Disable Security" |
796 |
;;mh-mhn-compose-external-compressed-tar t] |
mh-mml-unsecure-message mh-gnus-pgp-support-flag] |
797 |
;; ["Compose Anon FTP (MIME)..." mh-mhn-compose-anon-ftp t] |
"--" |
798 |
["Compose Forward (MIME)..." mh-compose-forward t] |
"Security Method" |
799 |
;; The next two will have to be merged. But I also need to make sure the |
["PGP (MIME)" (setq mh-mml-method-default "pgpmime") |
800 |
;; user can't mix directives of both types. |
:style radio |
801 |
["Pull in All Compositions (mhn)" |
:selected (equal mh-mml-method-default "pgpmime")] |
802 |
mh-edit-mhn (mh-mhn-directive-present-p)] |
["PGP" (setq mh-mml-method-default "pgp") |
803 |
["Pull in All Compositions (gnus)" |
:style radio |
804 |
mh-mml-to-mime (mh-mml-directive-present-p)] |
:selected (equal mh-mml-method-default "pgp")] |
805 |
["Revert to Non-MIME Edit (mhn)" |
["S/MIME" (setq mh-mml-method-default "smime") |
806 |
mh-revert-mhn-edit (equal mh-compose-insertion 'mhn)] |
:style radio |
807 |
["Kill This Draft" mh-fully-kill-draft t])))) |
:selected (equal mh-mml-method-default "smime")] |
808 |
|
"--" |
809 |
|
["Save Method as Default" |
810 |
|
(customize-save-variable 'mh-mml-method-default mh-mml-method-default) t] |
811 |
|
) |
812 |
|
["Compose Insertion (MIME)..." mh-compose-insertion t] |
813 |
|
["Compose Compressed tar (MIME)..." |
814 |
|
mh-mhn-compose-external-compressed-tar t] |
815 |
|
["Compose Get File (MIME)..." mh-mhn-compose-anon-ftp t] |
816 |
|
["Compose Forward (MIME)..." mh-compose-forward t] |
817 |
|
;; The next two will have to be merged. But I also need to make sure the |
818 |
|
;; user can't mix directives of both types. |
819 |
|
["Pull in All Compositions (mhn)" |
820 |
|
mh-edit-mhn (mh-mhn-directive-present-p)] |
821 |
|
["Pull in All Compositions (gnus)" |
822 |
|
mh-mml-to-mime (mh-mml-directive-present-p)] |
823 |
|
["Revert to Non-MIME Edit (mhn)" |
824 |
|
mh-revert-mhn-edit (equal mh-compose-insertion 'mhn)] |
825 |
|
["Kill This Draft" mh-fully-kill-draft t])) |
826 |
|
|
827 |
;;; Help Messages |
;;; Help Messages |
828 |
;;; Group messages logically, more or less. |
;;; Group messages logically, more or less. |
834 |
"\t\tInsert:\n" |
"\t\tInsert:\n" |
835 |
"Check recipients: \\[mh-check-whom]" |
"Check recipients: \\[mh-check-whom]" |
836 |
"\t\t Current message: \\[mh-yank-cur-msg]\n" |
"\t\t Current message: \\[mh-yank-cur-msg]\n" |
837 |
"Encrypt message: \\[mh-mml-secure-message-encrypt-pgpmime]" |
"\t\t Attachment: \\[mh-compose-insertion]\n" |
838 |
"\t\t Attachment: \\[mh-compose-insertion]\n" |
"\t\t Message to forward: \\[mh-compose-forward]\n" |
839 |
"Sign message: \\[mh-mml-secure-message-sign-pgpmime]" |
" " |
840 |
"\t\t Message to forward: \\[mh-compose-forward]\n" |
"Security:" |
841 |
|
"\t\t Encrypt message: \\[mh-mml-secure-message-encrypt]" |
842 |
|
"\t\t Sign+Encrypt message: \\[mh-mml-secure-message-signencrypt]" |
843 |
|
"\t\t Sign message: \\[mh-mml-secure-message-sign]\n" |
844 |
" " |
" " |
845 |
"\t\t Signature: \\[mh-insert-signature]")) |
"\t\t Signature: \\[mh-insert-signature]")) |
846 |
"Key binding cheat sheet. |
"Key binding cheat sheet. |
847 |
|
|
848 |
This is an associative array which is used to show the most common commands. |
This is an associative array which is used to show the most common commands. |
892 |
`mh-letter-mode-hook' are run. |
`mh-letter-mode-hook' are run. |
893 |
|
|
894 |
\\{mh-letter-mode-map}" |
\\{mh-letter-mode-map}" |
895 |
(or mh-user-path (mh-find-path)) |
(mh-find-path) |
896 |
(make-local-variable 'mh-send-args) |
(make-local-variable 'mh-send-args) |
897 |
(make-local-variable 'mh-annotate-char) |
(make-local-variable 'mh-annotate-char) |
898 |
(make-local-variable 'mh-annotate-field) |
(make-local-variable 'mh-annotate-field) |
899 |
(make-local-variable 'mh-previous-window-config) |
(make-local-variable 'mh-previous-window-config) |
900 |
(make-local-variable 'mh-sent-from-folder) |
(make-local-variable 'mh-sent-from-folder) |
901 |
(make-local-variable 'mh-sent-from-msg) |
(make-local-variable 'mh-sent-from-msg) |
902 |
|
;; Set the local value of mh-mail-header-separator according to what is |
903 |
|
;; present in the buffer... |
904 |
|
(set (make-local-variable 'mh-mail-header-separator) |
905 |
|
(save-excursion |
906 |
|
(goto-char (mh-mail-header-end)) |
907 |
|
(buffer-substring-no-properties (point) (line-end-position)))) |
908 |
(make-local-variable 'mail-header-separator) |
(make-local-variable 'mail-header-separator) |
909 |
(setq mail-header-separator mh-mail-header-separator) ;override sendmail.el |
(setq mail-header-separator mh-mail-header-separator) ;override sendmail.el |
910 |
(make-local-variable 'mh-help-messages) |
(make-local-variable 'mh-help-messages) |
912 |
(setq buffer-invisibility-spec '((vanish . t) t)) |
(setq buffer-invisibility-spec '((vanish . t) t)) |
913 |
(set (make-local-variable 'line-move-ignore-invisible) t) |
(set (make-local-variable 'line-move-ignore-invisible) t) |
914 |
|
|
|
;; Set mh-mail-header-end-marker to remember end of message header. |
|
|
(set (make-local-variable 'mh-letter-mail-header-end-marker) |
|
|
(set-marker (make-marker) (save-excursion |
|
|
(goto-char (mh-mail-header-end)) |
|
|
(line-beginning-position 2)))) |
|
|
|
|
915 |
;; From sendmail.el for proper paragraph fill |
;; From sendmail.el for proper paragraph fill |
916 |
;; sendmail.el also sets a normal-auto-fill-function (not done here) |
;; sendmail.el also sets a normal-auto-fill-function (not done here) |
917 |
(make-local-variable 'paragraph-separate) |
(make-local-variable 'paragraph-separate) |
985 |
t))) |
t))) |
986 |
|
|
987 |
(defun mh-letter-header-end () |
(defun mh-letter-header-end () |
988 |
"Find the end of header from `mh-letter-mail-header-end-marker'." |
"Find the end of the message header. |
989 |
|
This function is to be used only for font locking. It works by searching for |
990 |
|
`mh-mail-header-separator' in the buffer." |
991 |
(save-excursion |
(save-excursion |
992 |
(goto-char (marker-position mh-letter-mail-header-end-marker)) |
(goto-char (point-min)) |
993 |
(forward-line -1) |
(cond ((equal mh-mail-header-separator "") (point-min)) |
994 |
(point))) |
((search-forward (format "\n%s\n" mh-mail-header-separator) nil t) |
995 |
|
(line-beginning-position 0)) |
996 |
|
(t (point-min))))) |
997 |
|
|
998 |
(defun mh-auto-fill-for-letter () |
(defun mh-auto-fill-for-letter () |
999 |
"Perform auto-fill for message. |
"Perform auto-fill for message. |
1065 |
(substring folder 1) |
(substring folder 1) |
1066 |
folder))))) |
folder))))) |
1067 |
|
|
1068 |
|
(defun mh-file-is-vcard-p (file) |
1069 |
|
"Return t if FILE is a .vcf vcard." |
1070 |
|
(let ((case-fold-search t)) |
1071 |
|
(and (stringp file) |
1072 |
|
(file-exists-p file) |
1073 |
|
(or (and (not (mh-have-file-command)) |
1074 |
|
(not (null (string-match "\.vcf$" file)))) |
1075 |
|
(and (mh-have-file-command) |
1076 |
|
(string-equal "text/x-vcard" (mh-file-mime-type file))))))) |
1077 |
|
|
1078 |
;;;###mh-autoload |
;;;###mh-autoload |
1079 |
(defun mh-insert-signature () |
(defun mh-insert-signature (&optional file) |
1080 |
"Insert the file named by `mh-signature-file-name' at point. |
"Insert the signature specified by `mh-signature-file-name' or FILE at point. |
1081 |
|
A signature separator (`-- ') will be added if the signature block does not |
1082 |
|
contain one and `mh-signature-separator-flag' is on. |
1083 |
The value of `mh-letter-insert-signature-hook' is a list of functions to be |
The value of `mh-letter-insert-signature-hook' is a list of functions to be |
1084 |
called, with no arguments, before the signature is actually inserted." |
called, with no arguments, after the signature is inserted. |
1085 |
(interactive) |
The signature can also be inserted with `mh-identity-list'." |
1086 |
(let ((mh-signature-file-name mh-signature-file-name)) |
(interactive) |
1087 |
(run-hooks 'mh-letter-insert-signature-hook) |
(save-excursion |
1088 |
(if mh-signature-file-name |
(insert "\n") |
1089 |
(insert-file-contents mh-signature-file-name))) |
(let ((mh-signature-file-name (or file mh-signature-file-name)) |
1090 |
|
(mh-mhn-p (mh-mhn-directive-present-p)) |
1091 |
|
(mh-mml-p (mh-mml-directive-present-p))) |
1092 |
|
(save-restriction |
1093 |
|
(narrow-to-region (point) (point)) |
1094 |
|
(cond |
1095 |
|
((mh-file-is-vcard-p mh-signature-file-name) |
1096 |
|
(if (equal mh-compose-insertion 'gnus) |
1097 |
|
(insert "<#part type=\"text/x-vcard\" filename=\"" |
1098 |
|
mh-signature-file-name |
1099 |
|
"\" disposition=inline description=VCard>\n<#/part>") |
1100 |
|
(insert "#text/x-vcard; name=\"" |
1101 |
|
(file-name-nondirectory mh-signature-file-name) |
1102 |
|
"\" [VCard] " (expand-file-name mh-signature-file-name)))) |
1103 |
|
(t |
1104 |
|
(cond |
1105 |
|
(mh-mhn-p |
1106 |
|
(insert "#\n" "Content-Description: Signature\n")) |
1107 |
|
(mh-mml-p |
1108 |
|
(mml-insert-tag 'part 'type "text/plain" 'disposition "inline" |
1109 |
|
'description "Signature"))) |
1110 |
|
(cond ((null mh-signature-file-name)) |
1111 |
|
((and (stringp mh-signature-file-name) |
1112 |
|
(file-readable-p mh-signature-file-name)) |
1113 |
|
(insert-file-contents mh-signature-file-name)) |
1114 |
|
((functionp mh-signature-file-name) |
1115 |
|
(funcall mh-signature-file-name))))) |
1116 |
|
(save-restriction |
1117 |
|
(widen) |
1118 |
|
(run-hooks 'mh-letter-insert-signature-hook)) |
1119 |
|
(goto-char (point-min)) |
1120 |
|
(when (and (not (mh-file-is-vcard-p mh-signature-file-name)) |
1121 |
|
mh-signature-separator-flag |
1122 |
|
(> (point-max) (point-min)) |
1123 |
|
(not (mh-signature-separator-p))) |
1124 |
|
(cond (mh-mhn-p |
1125 |
|
(forward-line 2)) |
1126 |
|
(mh-mml-p |
1127 |
|
(forward-line 1))) |
1128 |
|
(insert mh-signature-separator)) |
1129 |
|
(if (not (> (point-max) (point-min))) |
1130 |
|
(message "No signature found"))))) |
1131 |
(force-mode-line-update)) |
(force-mode-line-update)) |
1132 |
|
|
1133 |
;;;###mh-autoload |
;;;###mh-autoload |
1177 |
(defun mh-insert-x-mailer () |
(defun mh-insert-x-mailer () |
1178 |
"Append an X-Mailer field to the header. |
"Append an X-Mailer field to the header. |
1179 |
The versions of MH-E, Emacs, and MH are shown." |
The versions of MH-E, Emacs, and MH are shown." |
|
|
|
1180 |
;; Lazily initialize mh-x-mailer-string. |
;; Lazily initialize mh-x-mailer-string. |
1181 |
(when (and mh-insert-x-mailer-flag (null mh-x-mailer-string)) |
(when (and mh-insert-x-mailer-flag (null mh-x-mailer-string)) |
1182 |
(save-window-excursion |
(setq mh-x-mailer-string |
1183 |
;; User would be confused if version info buffer disappeared magically, |
(format "MH-E %s; %s; %sEmacs %s" |
1184 |
;; so don't delete buffer if it already existed. |
mh-version mh-variant-in-use |
1185 |
(let ((info-buffer-exists-p (get-buffer mh-info-buffer))) |
(if mh-xemacs-flag "X" "GNU ") |
1186 |
(mh-version) |
(cond ((not mh-xemacs-flag) emacs-version) |
1187 |
(set-buffer mh-info-buffer) |
((string-match "[0-9.]*\\( +\([ a-z]+[0-9]+\)\\)?" |
1188 |
(if mh-nmh-flag |
emacs-version) |
1189 |
(search-forward-regexp "^nmh-\\(\\S +\\)") |
(match-string 0 emacs-version)) |
1190 |
(search-forward-regexp "^MH \\(\\S +\\)" nil t)) |
(t (format "%s.%s" emacs-major-version |
1191 |
(let ((x-mailer-mh (buffer-substring (match-beginning 1) |
emacs-minor-version)))))) |
|
(match-end 1)))) |
|
|
(setq mh-x-mailer-string |
|
|
(format "MH-E %s; %s %s; %sEmacs %s" |
|
|
mh-version (if mh-nmh-flag "nmh" "MH") x-mailer-mh |
|
|
(if mh-xemacs-flag "X" "GNU ") |
|
|
(cond ((not mh-xemacs-flag) emacs-version) |
|
|
((string-match "[0-9.]*\\( +\([ a-z]+[0-9]+\)\\)?" |
|
|
emacs-version) |
|
|
(match-string 0 emacs-version)) |
|
|
(t (format "%s.%s" |
|
|
emacs-major-version |
|
|
emacs-minor-version)))))) |
|
|
(if (not info-buffer-exists-p) |
|
|
(kill-buffer mh-info-buffer))))) |
|
1192 |
;; Insert X-Mailer, but only if it doesn't already exist. |
;; Insert X-Mailer, but only if it doesn't already exist. |
1193 |
(save-excursion |
(save-excursion |
1194 |
(when (and mh-insert-x-mailer-flag |
(when (and mh-insert-x-mailer-flag |
1217 |
something. If NON-INTERACTIVE is non-nil, do not be verbose and only |
something. If NON-INTERACTIVE is non-nil, do not be verbose and only |
1218 |
attempt matches if `mh-insert-auto-fields-done-local' is nil. |
attempt matches if `mh-insert-auto-fields-done-local' is nil. |
1219 |
|
|
1220 |
An `identity' entry is skipped if one was already entered manually." |
An `identity' entry is skipped if one was already entered manually. |
1221 |
|
|
1222 |
|
Return t if fields added; otherwise return nil." |
1223 |
(interactive) |
(interactive) |
1224 |
(when (or (not non-interactive) (not mh-insert-auto-fields-done-local)) |
(when (or (not non-interactive) |
1225 |
|
(not mh-insert-auto-fields-done-local)) |
1226 |
(save-excursion |
(save-excursion |
1227 |
(when (and (or (mh-goto-header-field "To:")(mh-goto-header-field "cc:"))) |
(when (and (or (mh-goto-header-field "To:") |
1228 |
(let ((list mh-auto-fields-list)) |
(mh-goto-header-field "cc:"))) |
1229 |
|
(let ((list mh-auto-fields-list) |
1230 |
|
(fields-inserted nil)) |
1231 |
(while list |
(while list |
1232 |
(let ((regexp (nth 0 (car list))) |
(let ((regexp (nth 0 (car list))) |
1233 |
(entries (nth 1 (car list)))) |
(entries (nth 1 (car list)))) |
1234 |
(when (mh-regexp-in-field-p regexp "To:" "cc:") |
(when (mh-regexp-in-field-p regexp "To:" "cc:") |
1235 |
(setq mh-insert-auto-fields-done-local t) |
(setq mh-insert-auto-fields-done-local t) |
1236 |
|
(setq fields-inserted t) |
1237 |
(if (not non-interactive) |
(if (not non-interactive) |
1238 |
(message "Matched for regexp %s" regexp)) |
(message "Fields for %s added" regexp)) |
1239 |
(let ((entry-list entries)) |
(let ((entry-list entries)) |
1240 |
(while entry-list |
(while entry-list |
1241 |
(let ((field (caar entry-list)) |
(let ((field (caar entry-list)) |
1242 |
(value (cdar entry-list))) |
(value (cdar entry-list))) |
1243 |
(cond |
(cond |
1244 |
((equal "identity" field) |
((equal ":identity" field) |
1245 |
(when (and (not mh-identity-local) |
(when (and (not mh-identity-local) |
1246 |
(assoc value mh-identity-list)) |
(assoc value mh-identity-list)) |
1247 |
(mh-insert-identity value))) |
(mh-insert-identity value))) |
1249 |
(mh-modify-header-field field value |
(mh-modify-header-field field value |
1250 |
(equal field "From"))))) |
(equal field "From"))))) |
1251 |
(setq entry-list (cdr entry-list)))))) |
(setq entry-list (cdr entry-list)))))) |
1252 |
(setq list (cdr list)))))))) |
(setq list (cdr list))) |
1253 |
|
fields-inserted))))) |
1254 |
|
|
1255 |
(defun mh-modify-header-field (field value &optional overwrite-flag) |
(defun mh-modify-header-field (field value &optional overwrite-flag) |
1256 |
"To header FIELD add VALUE. |
"To header FIELD add VALUE. |
1270 |
(mh-goto-header-end 0) |
(mh-goto-header-end 0) |
1271 |
(insert field ": " value "\n")))) |
(insert field ": " value "\n")))) |
1272 |
|
|
|
(defvar mh-letter-mail-header-end-marker nil) |
|
|
|
|
1273 |
(defun mh-compose-and-send-mail (draft send-args |
(defun mh-compose-and-send-mail (draft send-args |
1274 |
sent-from-folder sent-from-msg |
sent-from-folder sent-from-msg |
1275 |
to subject cc |
to subject cc |
1288 |
CONFIG is the window configuration to restore after sending the letter." |
CONFIG is the window configuration to restore after sending the letter." |
1289 |
(pop-to-buffer draft) |
(pop-to-buffer draft) |
1290 |
(mh-letter-mode) |
(mh-letter-mode) |
|
(mh-insert-auto-fields t) |
|
1291 |
|
|
1292 |
;; mh-identity support |
;; Insert identity. |
1293 |
(if (and (boundp 'mh-identity-default) |
(if (and (boundp 'mh-identity-default) |
1294 |
mh-identity-default |
mh-identity-default |
1295 |
(not mh-identity-local)) |
(not mh-identity-local)) |
1296 |
(mh-insert-identity mh-identity-default)) |
(mh-insert-identity mh-identity-default)) |
1297 |
(when (and (boundp 'mh-identity-list) |
(mh-identity-make-menu) |
1298 |
mh-identity-list) |
(easy-menu-add mh-identity-menu) |
|
(mh-identity-make-menu) |
|
|
(easy-menu-add mh-identity-menu)) |
|
1299 |
|
|
1300 |
;; Extra fields |
;; Insert extra fields. |
1301 |
(mh-insert-x-mailer) |
(mh-insert-x-mailer) |
1302 |
(mh-insert-x-face) |
(mh-insert-x-face) |
1303 |
;; Hide skipped fields |
|
1304 |
(mh-letter-hide-all-skipped-fields) |
(mh-letter-hide-all-skipped-fields) |
1305 |
|
|
1306 |
(setq mh-sent-from-folder sent-from-folder) |
(setq mh-sent-from-folder sent-from-folder) |
1328 |
This should be the last function called when composing the draft." |
This should be the last function called when composing the draft." |
1329 |
(message "%s" (substitute-command-keys |
(message "%s" (substitute-command-keys |
1330 |
(concat "Type \\[mh-send-letter] to send message, " |
(concat "Type \\[mh-send-letter] to send message, " |
1331 |
"\\[mh-help] for help.")))) |
"\\[mh-help] for help")))) |
1332 |
|
|
1333 |
|
(defun mh-ascii-buffer-p () |
1334 |
|
"Check if current buffer is entirely composed of ASCII. |
1335 |
|
The function doesn't work for XEmacs since `find-charset-region' doesn't exist |
1336 |
|
there." |
1337 |
|
(loop for charset in (mh-funcall-if-exists |
1338 |
|
find-charset-region (point-min) (point-max)) |
1339 |
|
unless (eq charset 'ascii) return nil |
1340 |
|
finally return t)) |
1341 |
|
|
1342 |
;;;###mh-autoload |
;;;###mh-autoload |
1343 |
(defun mh-send-letter (&optional arg) |
(defun mh-send-letter (&optional arg) |
1346 |
The value of `mh-before-send-letter-hook' is a list of functions to be called, |
The value of `mh-before-send-letter-hook' is a list of functions to be called, |
1347 |
with no arguments, before doing anything. |
with no arguments, before doing anything. |
1348 |
Run `\\[mh-edit-mhn]' if mhn directives are present; otherwise |
Run `\\[mh-edit-mhn]' if mhn directives are present; otherwise |
1349 |
run `\\[mh-mml-to-mime]' if mml directives are present. |
run `\\[mh-mml-to-mime]' if mml directives are present." |
|
Insert X-Mailer field if variable `mh-insert-x-mailer-flag' is set. |
|
|
Insert X-Face field if the file specified by `mh-x-face-file' exists." |
|
1350 |
(interactive "P") |
(interactive "P") |
1351 |
(run-hooks 'mh-before-send-letter-hook) |
(run-hooks 'mh-before-send-letter-hook) |
1352 |
(mh-insert-auto-fields t) |
(if (and (mh-insert-auto-fields t) |
1353 |
|
mh-auto-fields-prompt-flag |
1354 |
|
(goto-char (point-min))) |
1355 |
|
(if (not (y-or-n-p "Auto fields inserted, send? ")) |
1356 |
|
(error "Send aborted"))) |
1357 |
(cond ((mh-mhn-directive-present-p) |
(cond ((mh-mhn-directive-present-p) |
1358 |
(mh-edit-mhn)) |
(mh-edit-mhn)) |
1359 |
((mh-mml-directive-present-p) |
((or (mh-mml-directive-present-p) (not (mh-ascii-buffer-p))) |
1360 |
(mh-mml-to-mime))) |
(mh-mml-to-mime))) |
1361 |
(save-buffer) |
(save-buffer) |
1362 |
(message "Sending...") |
(message "Sending...") |
1377 |
'iso-latin-1)))) |
'iso-latin-1)))) |
1378 |
;; The default BCC encapsulation will make a MIME message unreadable. |
;; The default BCC encapsulation will make a MIME message unreadable. |
1379 |
;; With nmh use the -mime arg to prevent this. |
;; With nmh use the -mime arg to prevent this. |
1380 |
(if (and mh-nmh-flag |
(if (and (mh-variant-p 'nmh) |
1381 |
(mh-goto-header-field "Bcc:") |
(mh-goto-header-field "Bcc:") |
1382 |
(mh-goto-header-field "Content-Type:")) |
(mh-goto-header-field "Content-Type:")) |
1383 |
(setq mh-send-args (format "-mime %s" mh-send-args))) |
(setq mh-send-args (format "-mime %s" mh-send-args))) |
1413 |
;;;###mh-autoload |
;;;###mh-autoload |
1414 |
(defun mh-insert-letter (folder message verbatim) |
(defun mh-insert-letter (folder message verbatim) |
1415 |
"Insert a message into the current letter. |
"Insert a message into the current letter. |
1416 |
Removes the header fields according to the variable `mh-invisible-headers'. |
Removes the header fields according to the variable |
1417 |
|
`mh-invisible-header-fields-compiled'. |
1418 |
Prefixes each non-blank line with `mh-ins-buf-prefix', unless |
Prefixes each non-blank line with `mh-ins-buf-prefix', unless |
1419 |
`mh-yank-from-start-of-msg' is set for supercite in which case supercite is |
`mh-yank-from-start-of-msg' is set for supercite in which case supercite is |
1420 |
used to format the message. |
used to format the message. |
1431 |
(save-restriction |
(save-restriction |
1432 |
(narrow-to-region (point) (point)) |
(narrow-to-region (point) (point)) |
1433 |
(let ((start (point-min))) |
(let ((start (point-min))) |
1434 |
(if (equal message "") (setq message (int-to-string mh-sent-from-msg))) |
(if (and (equal message "") (numberp mh-sent-from-msg)) |
1435 |
|
(setq message (int-to-string mh-sent-from-msg))) |
1436 |
(insert-file-contents |
(insert-file-contents |
1437 |
(expand-file-name message (mh-expand-file-name folder))) |
(expand-file-name message (mh-expand-file-name folder))) |
1438 |
(when (not verbatim) |
(when (not verbatim) |
1439 |
(mh-clean-msg-header start mh-invisible-headers mh-visible-headers) |
(mh-clean-msg-header start mh-invisible-header-fields-compiled nil) |
1440 |
(goto-char (point-max)) ;Needed for sc-cite-original |
(goto-char (point-max)) ;Needed for sc-cite-original |
1441 |
(push-mark) ;Needed for sc-cite-original |
(push-mark) ;Needed for sc-cite-original |
1442 |
(goto-char (point-min)) ;Needed for sc-cite-original |
(goto-char (point-min)) ;Needed for sc-cite-original |
1450 |
(skip-chars-forward " ") |
(skip-chars-forward " ") |
1451 |
(cond |
(cond |
1452 |
((looking-at "\"\\([^\"\n]+\\)\" \\(<.+>\\)") |
((looking-at "\"\\([^\"\n]+\\)\" \\(<.+>\\)") |
1453 |
(format "%s %s %s" (match-string 1)(match-string 2) |
(format "%s %s " (match-string 1)(match-string 2))) |
|
mh-extract-from-attribution-verb)) |
|
1454 |
((looking-at "\\([^<\n]+<.+>\\)$") |
((looking-at "\\([^<\n]+<.+>\\)$") |
1455 |
(format "%s %s" (match-string 1) mh-extract-from-attribution-verb)) |
(format "%s " (match-string 1))) |
1456 |
((looking-at "\\([^ ]+@[^ ]+\\) +(\\(.+\\))$") |
((looking-at "\\([^ ]+@[^ ]+\\) +(\\(.+\\))$") |
1457 |
(format "%s <%s> %s" (match-string 2)(match-string 1) |
(format "%s <%s> " (match-string 2)(match-string 1))) |
|
mh-extract-from-attribution-verb)) |
|
1458 |
((looking-at " *\\(.+\\)$") |
((looking-at " *\\(.+\\)$") |
1459 |
(format "%s %s" (match-string 1) mh-extract-from-attribution-verb)))))) |
(format "%s " (match-string 1))))))) |
1460 |
|
|
1461 |
;;;###mh-autoload |
;;;###mh-autoload |
1462 |
(defun mh-yank-cur-msg () |
(defun mh-yank-cur-msg () |
1519 |
(push-mark) ;Needed for sc-cite-original |
(push-mark) ;Needed for sc-cite-original |
1520 |
(goto-char (point-min)) ;Needed for sc-cite-original |
(goto-char (point-min)) ;Needed for sc-cite-original |
1521 |
(mh-insert-prefix-string mh-ins-buf-prefix) |
(mh-insert-prefix-string mh-ins-buf-prefix) |
1522 |
(if (or (eq 'attribution mh-yank-from-start-of-msg) |
(when (or (eq 'attribution mh-yank-from-start-of-msg) |
1523 |
(eq 'autoattrib mh-yank-from-start-of-msg)) |
(eq 'autoattrib mh-yank-from-start-of-msg)) |
1524 |
(insert from-attr "\n\n")) |
(insert from-attr) |
1525 |
|
(mh-identity-insert-attribution-verb nil) |
1526 |
|
(insert "\n\n")) |
1527 |
;; If the user has selected a region, he has already "edited" the |
;; If the user has selected a region, he has already "edited" the |
1528 |
;; text, so leave the cursor at the end of the yanked text. In |
;; text, so leave the cursor at the end of the yanked text. In |
1529 |
;; either case, leave a mark at the opposite end of the included |
;; either case, leave a mark at the opposite end of the included |
1649 |
(let ((syntax-table (syntax-table))) |
(let ((syntax-table (syntax-table))) |
1650 |
(unwind-protect |
(unwind-protect |
1651 |
(save-excursion |
(save-excursion |
1652 |
(mh-funcall-if-exists mail-abbrev-make-syntax-table) |
(mh-mail-abbrev-make-syntax-table) |
1653 |
(set-syntax-table mail-abbrev-syntax-table) |
(set-syntax-table mail-abbrev-syntax-table) |
1654 |
(backward-word n) |
(backward-word n) |
1655 |
(point)) |
(point)) |
1670 |
(mh-folder-completion-function folder nil t)))) |
(mh-folder-completion-function folder nil t)))) |
1671 |
(mh-complete-word folder choices beg end))) |
(mh-complete-word folder choices beg end))) |
1672 |
|
|
|
;; XXX: This should probably be customizable |
|
1673 |
(defvar mh-letter-complete-function-alist |
(defvar mh-letter-complete-function-alist |
1674 |
'((cc . mh-alias-letter-expand-alias) |
'((cc . mh-alias-letter-expand-alias) |
1675 |
(bcc . mh-alias-letter-expand-alias) |
(bcc . mh-alias-letter-expand-alias) |
1683 |
|
|
1684 |
(defun mh-letter-complete (arg) |
(defun mh-letter-complete (arg) |
1685 |
"Perform completion on header field or word preceding point. |
"Perform completion on header field or word preceding point. |
1686 |
Alias completion is done within the mail header on selected fields based on |
If the field contains addresses (for example, `To:' or `Cc:') or folders (for |
1687 |
the matches in `mh-letter-complete-function-alist'. Elsewhere the function |
example, `Fcc:') then this function will provide alias completion. Elsewhere, |
1688 |
designated by `mh-letter-complete-function' is used and given the prefix ARG, |
this function runs `mh-letter-complete-function' instead and passes the prefix |
1689 |
if present." |
ARG, if present." |
1690 |
(interactive "P") |
(interactive "P") |
1691 |
(let ((func nil)) |
(let ((func nil)) |
1692 |
(cond ((not (mh-in-header-p)) |
(cond ((not (mh-in-header-p)) |
1908 |
;;; Build the letter-mode keymap: |
;;; Build the letter-mode keymap: |
1909 |
;;; If this changes, modify mh-letter-mode-help-messages accordingly, above. |
;;; If this changes, modify mh-letter-mode-help-messages accordingly, above. |
1910 |
(gnus-define-keys mh-letter-mode-map |
(gnus-define-keys mh-letter-mode-map |
1911 |
|
" " mh-letter-complete-or-space |
1912 |
|
"," mh-letter-confirm-address |
1913 |
"\C-c?" mh-help |
"\C-c?" mh-help |
1914 |
|
"\C-c\C-\\" mh-fully-kill-draft ;if no C-q |
1915 |
|
"\C-c\C-^" mh-insert-signature ;if no C-s |
1916 |
"\C-c\C-c" mh-send-letter |
"\C-c\C-c" mh-send-letter |
1917 |
"\C-c\C-d" mh-insert-identity |
"\C-c\C-d" mh-insert-identity |
|
"\C-c\M-d" mh-insert-auto-fields |
|
1918 |
"\C-c\C-e" mh-edit-mhn |
"\C-c\C-e" mh-edit-mhn |
1919 |
"\C-c\C-f\C-b" mh-to-field |
"\C-c\C-f\C-b" mh-to-field |
1920 |
"\C-c\C-f\C-c" mh-to-field |
"\C-c\C-f\C-c" mh-to-field |
1931 |
"\C-c\C-fs" mh-to-field |
"\C-c\C-fs" mh-to-field |
1932 |
"\C-c\C-ft" mh-to-field |
"\C-c\C-ft" mh-to-field |
1933 |
"\C-c\C-i" mh-insert-letter |
"\C-c\C-i" mh-insert-letter |
1934 |
"\C-c\C-m\C-e" mh-mml-secure-message-encrypt-pgpmime |
"\C-c\C-m\C-e" mh-mml-secure-message-encrypt |
1935 |
"\C-c\C-m\C-f" mh-compose-forward |
"\C-c\C-m\C-f" mh-compose-forward |
1936 |
|
"\C-c\C-m\C-g" mh-mhn-compose-anon-ftp |
1937 |
"\C-c\C-m\C-i" mh-compose-insertion |
"\C-c\C-m\C-i" mh-compose-insertion |
1938 |
"\C-c\C-m\C-m" mh-mml-to-mime |
"\C-c\C-m\C-m" mh-mml-to-mime |
1939 |
"\C-c\C-m\C-s" mh-mml-secure-message-sign-pgpmime |
"\C-c\C-m\C-n" mh-mml-unsecure-message |
1940 |
|
"\C-c\C-m\C-s" mh-mml-secure-message-sign |
1941 |
|
"\C-c\C-m\C-t" mh-mhn-compose-external-compressed-tar |
1942 |
"\C-c\C-m\C-u" mh-revert-mhn-edit |
"\C-c\C-m\C-u" mh-revert-mhn-edit |
1943 |
"\C-c\C-me" mh-mml-secure-message-encrypt-pgpmime |
"\C-c\C-m\C-x" mh-mhn-compose-external-type |
1944 |
|
"\C-c\C-mee" mh-mml-secure-message-encrypt |
1945 |
|
"\C-c\C-mes" mh-mml-secure-message-signencrypt |
1946 |
"\C-c\C-mf" mh-compose-forward |
"\C-c\C-mf" mh-compose-forward |
1947 |
|
"\C-c\C-mg" mh-mhn-compose-anon-ftp |
1948 |
"\C-c\C-mi" mh-compose-insertion |
"\C-c\C-mi" mh-compose-insertion |
1949 |
"\C-c\C-mm" mh-mml-to-mime |
"\C-c\C-mm" mh-mml-to-mime |
1950 |
"\C-c\C-ms" mh-mml-secure-message-sign-pgpmime |
"\C-c\C-mn" mh-mml-unsecure-message |
1951 |
|
"\C-c\C-mse" mh-mml-secure-message-signencrypt |
1952 |
|
"\C-c\C-mss" mh-mml-secure-message-sign |
1953 |
|
"\C-c\C-mt" mh-mhn-compose-external-compressed-tar |
1954 |
"\C-c\C-mu" mh-revert-mhn-edit |
"\C-c\C-mu" mh-revert-mhn-edit |
1955 |
|
"\C-c\C-mx" mh-mhn-compose-external-type |
1956 |
"\C-c\C-o" mh-open-line |
"\C-c\C-o" mh-open-line |
1957 |
"\C-c\C-q" mh-fully-kill-draft |
"\C-c\C-q" mh-fully-kill-draft |
|
"\C-c\C-\\" mh-fully-kill-draft ;if no C-q |
|
1958 |
"\C-c\C-s" mh-insert-signature |
"\C-c\C-s" mh-insert-signature |
1959 |
"\C-c\C-^" mh-insert-signature ;if no C-s |
"\C-c\C-t" mh-letter-toggle-header-field-display |
1960 |
"\C-c\C-w" mh-check-whom |
"\C-c\C-w" mh-check-whom |
1961 |
"\C-c\C-y" mh-yank-cur-msg |
"\C-c\C-y" mh-yank-cur-msg |
1962 |
"\C-c\C-t" mh-letter-toggle-header-field-display |
"\C-c\M-d" mh-insert-auto-fields |
|
" " mh-letter-complete-or-space |
|
1963 |
"\M-\t" mh-letter-complete |
"\M-\t" mh-letter-complete |
1964 |
"\t" mh-letter-next-header-field-or-indent |
"\t" mh-letter-next-header-field-or-indent |
1965 |
[backtab] mh-letter-previous-header-field |
[backtab] mh-letter-previous-header-field) |
|
"," mh-letter-confirm-address) |
|
1966 |
|
|
1967 |
;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el. |
;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el. |
1968 |
|
|