Mercurial > emacs
comparison lisp/mh-e/mh-comp.el @ 68107:abeb226bd3f8
Use ";; Shush compiler." comment consistently per Mark's suggestion.
(mh-letter-mode): Derive from mail-mode and delete code copied from
mail-mode (closes SF #1385571). Mention mail-mode-hook in docstring.
(mh-fill-paragraph-function): Delete. Handled by mail-mode.
(mh-to-field-choices): For consistency with mail-mode, add "a" for
"Mail-Reply-To:", "l" for "Mail-Followup-To:", and "r" for
"Reply-To:". Change "r" to "m" for "From:" (closes SF #1400139).
(mh-to-fcc): Move setting of folder argument to interactive argument
as is the norm.
(mh-letter-complete-function-alist): Add mail-reply-to.
(mh-letter-mode-map): Add keys for mh-to-field (Mail-Reply-To,
Mail-Followup-To, Reply-To, From).
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Mon, 09 Jan 2006 21:21:06 +0000 |
parents | 57c4e7929f99 |
children | dfa5a760e24f |
comparison
equal
deleted
inserted
replaced
68106:da4512a603de | 68107:abeb226bd3f8 |
---|---|
156 (defvar mh-new-draft-cleaned-headers | 156 (defvar mh-new-draft-cleaned-headers |
157 "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:" | 157 "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:" |
158 "Regexp of header lines to remove before offering a message as a new draft\\<mh-folder-mode-map>. | 158 "Regexp of header lines to remove before offering a message as a new draft\\<mh-folder-mode-map>. |
159 Used by the \\[mh-edit-again] and \\[mh-extract-rejected-mail] commands.") | 159 Used by the \\[mh-edit-again] and \\[mh-extract-rejected-mail] commands.") |
160 | 160 |
161 (defvar mh-to-field-choices '(("t" . "To:") ("s" . "Subject:") ("c" . "Cc:") | 161 (defvar mh-to-field-choices '(("a" . "Mail-Reply-To:") |
162 ("b" . "Bcc:") ("f" . "Fcc:") ("r" . "From:") | 162 ("b" . "Bcc:") |
163 ("d" . "Dcc:")) | 163 ("c" . "Cc:") |
164 ("d" . "Dcc:") | |
165 ("f" . "Fcc:") | |
166 ("l" . "Mail-Followup-To:") | |
167 ("m" . "From:") | |
168 ("r" . "Reply-To:") | |
169 ("s" . "Subject:") | |
170 ("t" . "To:")) | |
164 "Alist of (final-character . field-name) choices for `mh-to-field'.") | 171 "Alist of (final-character . field-name) choices for `mh-to-field'.") |
165 | 172 |
166 (defvar mh-letter-mode-map (copy-keymap text-mode-map) | 173 (defvar mh-letter-mode-map (copy-keymap text-mode-map) |
167 "Keymap for composing mail.") | 174 "Keymap for composing mail.") |
168 | 175 |
937 special key nil is used to display the non-prefixed commands. | 944 special key nil is used to display the non-prefixed commands. |
938 | 945 |
939 The substitutions described in `substitute-command-keys' are | 946 The substitutions described in `substitute-command-keys' are |
940 performed as well.") | 947 performed as well.") |
941 | 948 |
942 ;;;###mh-autoload | |
943 (defun mh-fill-paragraph-function (arg) | |
944 "Fill paragraph at or after point. | |
945 Prefix ARG means justify as well. This function enables | |
946 `fill-paragraph' to work better in MH-Letter mode (see | |
947 `mh-letter-mode')." | |
948 (interactive "P") | |
949 (let ((fill-paragraph-function) (fill-prefix)) | |
950 (if (mh-in-header-p) | |
951 (mail-mode-fill-paragraph arg) | |
952 (fill-paragraph arg)))) | |
953 | |
954 ;; Shush compiler. | 949 ;; Shush compiler. |
955 (eval-when-compile | 950 (eval-when-compile |
956 (defvar adaptive-fill-first-line-regexp) | 951 (defvar adaptive-fill-first-line-regexp) |
957 (defvar tool-bar-map) | 952 (defvar tool-bar-map)) |
958 (defvar font-lock-defaults) | |
959 ) | |
960 | 953 |
961 (defvar mh-letter-buttons-init-flag nil) | 954 (defvar mh-letter-buttons-init-flag nil) |
962 | 955 |
963 ;;;###autoload | 956 ;;;###autoload |
964 (define-derived-mode mh-letter-mode text-mode "MH-Letter" | 957 (define-derived-mode mh-letter-mode mail-mode "MH-Letter" |
965 "Mode for composing letters in MH-E\\<mh-letter-mode-map>. | 958 "Mode for composing letters in MH-E\\<mh-letter-mode-map>. |
966 | 959 |
967 When you have finished composing, type \\[mh-send-letter] to send | 960 When you have finished composing, type \\[mh-send-letter] to send |
968 the message using the MH mail handling system. | 961 the message using the MH mail handling system. |
969 | 962 |
974 MH-style directives or \\[mh-mml-to-mime] for MML tags. | 967 MH-style directives or \\[mh-mml-to-mime] for MML tags. |
975 | 968 |
976 Options that control this mode can be changed with | 969 Options that control this mode can be changed with |
977 \\[customize-group]; specify the \"mh-compose\" group. | 970 \\[customize-group]; specify the \"mh-compose\" group. |
978 | 971 |
979 When a message is composed, the hooks `text-mode-hook' and | 972 When a message is composed, the hooks `text-mode-hook', |
980 `mh-letter-mode-hook' are run. | 973 `mail-mode-hook', and `mh-letter-mode-hook' are run (in that |
974 order). | |
981 | 975 |
982 \\{mh-letter-mode-map}" | 976 \\{mh-letter-mode-map}" |
983 (mh-find-path) | 977 (mh-find-path) |
984 (make-local-variable 'mh-send-args) | 978 (make-local-variable 'mh-send-args) |
985 (make-local-variable 'mh-annotate-char) | 979 (make-local-variable 'mh-annotate-char) |
1001 (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el | 995 (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el |
1002 (make-local-variable 'mh-help-messages) | 996 (make-local-variable 'mh-help-messages) |
1003 (setq mh-help-messages mh-letter-mode-help-messages) | 997 (setq mh-help-messages mh-letter-mode-help-messages) |
1004 (setq buffer-invisibility-spec '((vanish . t) t)) | 998 (setq buffer-invisibility-spec '((vanish . t) t)) |
1005 (set (make-local-variable 'line-move-ignore-invisible) t) | 999 (set (make-local-variable 'line-move-ignore-invisible) t) |
1006 | |
1007 ;; From sendmail.el for proper paragraph fill | |
1008 ;; sendmail.el also sets a normal-auto-fill-function (not done here) | |
1009 (make-local-variable 'paragraph-separate) | |
1010 (make-local-variable 'paragraph-start) | |
1011 (make-local-variable 'fill-paragraph-function) | |
1012 (setq fill-paragraph-function 'mh-fill-paragraph-function) | |
1013 (make-local-variable 'adaptive-fill-regexp) | |
1014 (setq adaptive-fill-regexp | |
1015 (concat adaptive-fill-regexp | |
1016 "\\|[ \t]*[-[:alnum:]]*>+[ \t]*")) | |
1017 (make-local-variable 'adaptive-fill-first-line-regexp) | |
1018 (setq adaptive-fill-first-line-regexp | |
1019 (concat adaptive-fill-first-line-regexp | |
1020 "\\|[ \t]*[-[:alnum:]]*>+[ \t]*")) | |
1021 ;; `-- ' precedes the signature. `-----' appears at the start of the | |
1022 ;; lines that delimit forwarded messages. | |
1023 ;; Lines containing just >= 3 dashes, perhaps after whitespace, | |
1024 ;; are also sometimes used and should be separators. | |
1025 (setq paragraph-start (concat (regexp-quote mail-header-separator) | |
1026 "\\|\t*\\([-|#;>* ]\\|(?[0-9]+[.)]\\)+$" | |
1027 "\\|[ \t]*[[:alnum:]]*>+[ \t]*$\\|[ \t]*$\\|" | |
1028 "-- $\\|---+$\\|" | |
1029 page-delimiter)) | |
1030 (setq paragraph-separate paragraph-start) | |
1031 ;; --- End of code from sendmail.el --- | |
1032 | 1000 |
1033 ;; Enable undo since a show-mode buffer might have been reused. | 1001 ;; Enable undo since a show-mode buffer might have been reused. |
1034 (buffer-enable-undo) | 1002 (buffer-enable-undo) |
1035 (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map) | 1003 (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map) |
1036 (mh-funcall-if-exists mh-tool-bar-init :letter) | 1004 (mh-funcall-if-exists mh-tool-bar-init :letter) |
1144 (defun mh-to-fcc (&optional folder) | 1112 (defun mh-to-fcc (&optional folder) |
1145 "Move to \"Fcc:\" header field. | 1113 "Move to \"Fcc:\" header field. |
1146 | 1114 |
1147 This command will prompt you for the FOLDER name in which to file | 1115 This command will prompt you for the FOLDER name in which to file |
1148 a copy of the draft." | 1116 a copy of the draft." |
1149 (interactive) | 1117 (interactive (list (mh-prompt-for-folder |
1150 (or folder | 1118 "Fcc" |
1151 (setq folder (mh-prompt-for-folder | 1119 (or (and mh-default-folder-for-message-function |
1152 "Fcc" | 1120 (save-excursion |
1153 (or (and mh-default-folder-for-message-function | 1121 (goto-char (point-min)) |
1154 (save-excursion | 1122 (funcall |
1155 (goto-char (point-min)) | 1123 mh-default-folder-for-message-function))) |
1156 (funcall | 1124 "") |
1157 mh-default-folder-for-message-function))) | 1125 t))) |
1158 "") | |
1159 t))) | |
1160 (let ((last-input-char ?\C-f)) | 1126 (let ((last-input-char ?\C-f)) |
1161 (expand-abbrev) | 1127 (expand-abbrev) |
1162 (save-excursion | 1128 (save-excursion |
1163 (mh-to-field) | 1129 (mh-to-field) |
1164 (insert (if (mh-folder-name-p folder) | 1130 (insert (if (mh-folder-name-p folder) |
1461 (loop for charset in (mh-funcall-if-exists | 1427 (loop for charset in (mh-funcall-if-exists |
1462 find-charset-region (point-min) (point-max)) | 1428 find-charset-region (point-min) (point-max)) |
1463 unless (eq charset 'ascii) return nil | 1429 unless (eq charset 'ascii) return nil |
1464 finally return t)) | 1430 finally return t)) |
1465 | 1431 |
1466 (eval-when-compile (defvar sendmail-coding-system)) ;shush compiler | 1432 ;; Shush compiler. |
1433 (eval-when-compile (defvar sendmail-coding-system)) | |
1467 | 1434 |
1468 ;;;###mh-autoload | 1435 ;;;###mh-autoload |
1469 (defun mh-send-letter (&optional arg) | 1436 (defun mh-send-letter (&optional arg) |
1470 "Save draft and send message. | 1437 "Save draft and send message. |
1471 | 1438 |
1851 (t x)))) | 1818 (t x)))) |
1852 (mh-folder-completion-function folder nil t)))) | 1819 (mh-folder-completion-function folder nil t)))) |
1853 (mh-complete-word folder choices beg end))) | 1820 (mh-complete-word folder choices beg end))) |
1854 | 1821 |
1855 (defvar mh-letter-complete-function-alist | 1822 (defvar mh-letter-complete-function-alist |
1856 '((cc . mh-alias-letter-expand-alias) | 1823 '((bcc . mh-alias-letter-expand-alias) |
1857 (bcc . mh-alias-letter-expand-alias) | 1824 (cc . mh-alias-letter-expand-alias) |
1858 (dcc . mh-alias-letter-expand-alias) | 1825 (dcc . mh-alias-letter-expand-alias) |
1859 (fcc . mh-folder-expand-at-point) | 1826 (fcc . mh-folder-expand-at-point) |
1860 (from . mh-alias-letter-expand-alias) | 1827 (from . mh-alias-letter-expand-alias) |
1861 (mail-followup-to . mh-alias-letter-expand-alias) | 1828 (mail-followup-to . mh-alias-letter-expand-alias) |
1829 (mail-reply-to . mh-alias-letter-expand-alias) | |
1862 (reply-to . mh-alias-letter-expand-alias) | 1830 (reply-to . mh-alias-letter-expand-alias) |
1863 (to . mh-alias-letter-expand-alias)) | 1831 (to . mh-alias-letter-expand-alias)) |
1864 "Alist of header fields and completion functions to use.") | 1832 "Alist of header fields and completion functions to use.") |
1865 | 1833 |
1866 (defun mh-letter-complete (arg) | 1834 (defun mh-letter-complete (arg) |
2122 "\C-c\C-\\" mh-fully-kill-draft ;if no C-q | 2090 "\C-c\C-\\" mh-fully-kill-draft ;if no C-q |
2123 "\C-c\C-^" mh-insert-signature ;if no C-s | 2091 "\C-c\C-^" mh-insert-signature ;if no C-s |
2124 "\C-c\C-c" mh-send-letter | 2092 "\C-c\C-c" mh-send-letter |
2125 "\C-c\C-d" mh-insert-identity | 2093 "\C-c\C-d" mh-insert-identity |
2126 "\C-c\C-e" mh-mh-to-mime | 2094 "\C-c\C-e" mh-mh-to-mime |
2095 "\C-c\C-f\C-a" mh-to-field | |
2127 "\C-c\C-f\C-b" mh-to-field | 2096 "\C-c\C-f\C-b" mh-to-field |
2128 "\C-c\C-f\C-c" mh-to-field | 2097 "\C-c\C-f\C-c" mh-to-field |
2129 "\C-c\C-f\C-d" mh-to-field | 2098 "\C-c\C-f\C-d" mh-to-field |
2130 "\C-c\C-f\C-f" mh-to-fcc | 2099 "\C-c\C-f\C-f" mh-to-fcc |
2100 "\C-c\C-f\C-l" mh-to-field | |
2101 "\C-c\C-f\C-m" mh-to-field | |
2131 "\C-c\C-f\C-r" mh-to-field | 2102 "\C-c\C-f\C-r" mh-to-field |
2132 "\C-c\C-f\C-s" mh-to-field | 2103 "\C-c\C-f\C-s" mh-to-field |
2133 "\C-c\C-f\C-t" mh-to-field | 2104 "\C-c\C-f\C-t" mh-to-field |
2105 "\C-c\C-fa" mh-to-field | |
2134 "\C-c\C-fb" mh-to-field | 2106 "\C-c\C-fb" mh-to-field |
2135 "\C-c\C-fc" mh-to-field | 2107 "\C-c\C-fc" mh-to-field |
2136 "\C-c\C-fd" mh-to-field | 2108 "\C-c\C-fd" mh-to-field |
2137 "\C-c\C-ff" mh-to-fcc | 2109 "\C-c\C-ff" mh-to-fcc |
2110 "\C-c\C-fl" mh-to-field | |
2111 "\C-c\C-fm" mh-to-field | |
2138 "\C-c\C-fr" mh-to-field | 2112 "\C-c\C-fr" mh-to-field |
2139 "\C-c\C-fs" mh-to-field | 2113 "\C-c\C-fs" mh-to-field |
2140 "\C-c\C-ft" mh-to-field | 2114 "\C-c\C-ft" mh-to-field |
2141 "\C-c\C-i" mh-insert-letter | 2115 "\C-c\C-i" mh-insert-letter |
2142 "\C-c\C-m\C-e" mh-mml-secure-message-encrypt | 2116 "\C-c\C-m\C-e" mh-mml-secure-message-encrypt |