Mercurial > hg > xemacs-beta
comparison lisp/gnus/message.el @ 136:b980b6286996 r20-2b2
Import from CVS: tag r20-2b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:31:12 +0200 |
parents | 9b50b4588a93 |
children | 585fb297b004 |
comparison
equal
deleted
inserted
replaced
135:4636a6841cd6 | 136:b980b6286996 |
---|---|
589 'message-kill-buffer 'message-send-hook)) | 589 'message-kill-buffer 'message-send-hook)) |
590 | 590 |
591 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender) | 591 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender) |
592 "If non-nil, delete the deletable headers before feeding to mh.") | 592 "If non-nil, delete the deletable headers before feeding to mh.") |
593 | 593 |
594 (defvar message-send-method-alist | |
595 '((news message-news-p message-send-via-news) | |
596 (mail message-mail-p message-send-via-mail)) | |
597 "Alist of ways to send outgoing messages. | |
598 Each element has the form | |
599 | |
600 \(TYPE PREDICATE FUNCTION) | |
601 | |
602 where TYPE is a symbol that names the method; PREDICATE is a function | |
603 called without any parameters to determine whether the message is | |
604 a message of type TYPE; and FUNCTION is a function to be called if | |
605 PREDICATE returns non-nil. FUNCTION is called with one parameter -- | |
606 the prefix.") | |
607 | |
608 (defvar message-mail-alias-type 'abbrev | |
609 "*What alias expansion type to use in Message buffers. | |
610 The default is `abbrev', which uses mailabbrev. nil switches | |
611 mail aliases off.") | |
612 | |
594 ;;; Internal variables. | 613 ;;; Internal variables. |
595 ;;; Well, not really internal. | 614 ;;; Well, not really internal. |
596 | 615 |
597 (defvar message-mode-syntax-table | 616 (defvar message-mode-syntax-table |
598 (let ((table (copy-syntax-table text-mode-syntax-table))) | 617 (let ((table (copy-syntax-table text-mode-syntax-table))) |
718 | 737 |
719 (defvar message-font-lock-keywords | 738 (defvar message-font-lock-keywords |
720 (let* ((cite-prefix "A-Za-z") | 739 (let* ((cite-prefix "A-Za-z") |
721 (cite-suffix (concat cite-prefix "0-9_.@-")) | 740 (cite-suffix (concat cite-prefix "0-9_.@-")) |
722 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)")) | 741 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)")) |
723 `((,(concat "^\\(To:\\)" content) | 742 `((,(concat "^\\([Tt]o:\\)" content) |
724 (1 'message-header-name-face) | 743 (1 'message-header-name-face) |
725 (2 'message-header-to-face nil t)) | 744 (2 'message-header-to-face nil t)) |
726 (,(concat "^\\(^[GBF]?[Cc][Cc]:\\|^Reply-To:\\)" content) | 745 (,(concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content) |
727 (1 'message-header-name-face) | 746 (1 'message-header-name-face) |
728 (2 'message-header-cc-face nil t)) | 747 (2 'message-header-cc-face nil t)) |
729 (,(concat "^\\(Subject:\\)" content) | 748 (,(concat "^\\([Ss]ubject:\\)" content) |
730 (1 'message-header-name-face) | 749 (1 'message-header-name-face) |
731 (2 'message-header-subject-face nil t)) | 750 (2 'message-header-subject-face nil t)) |
732 (,(concat "^\\(Newsgroups:\\|Followup-to:\\)" content) | 751 (,(concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content) |
733 (1 'message-header-name-face) | 752 (1 'message-header-name-face) |
734 (2 'message-header-newsgroups-face nil t)) | 753 (2 'message-header-newsgroups-face nil t)) |
735 (,(concat "^\\([^: \n\t]+:\\)" content) | 754 (,(concat "^\\([^: \n\t]+:\\)" content) |
736 (1 'message-header-name-face) | 755 (1 'message-header-name-face) |
737 (2 'message-header-other-face nil t)) | 756 (2 'message-header-other-face nil t)) |
1240 (when (string-match "XEmacs\\|Lucid" emacs-version) | 1259 (when (string-match "XEmacs\\|Lucid" emacs-version) |
1241 (message-setup-toolbar)) | 1260 (message-setup-toolbar)) |
1242 (easy-menu-add message-mode-menu message-mode-map) | 1261 (easy-menu-add message-mode-menu message-mode-map) |
1243 (easy-menu-add message-mode-field-menu message-mode-map) | 1262 (easy-menu-add message-mode-field-menu message-mode-map) |
1244 ;; Allow mail alias things. | 1263 ;; Allow mail alias things. |
1245 (if (fboundp 'mail-abbrevs-setup) | 1264 (when (eq message-mail-alias-type 'abbrev) |
1246 (mail-abbrevs-setup) | 1265 (if (fboundp 'mail-abbrevs-setup) |
1247 (funcall (intern "mail-aliases-setup"))) | 1266 (mail-abbrevs-setup) |
1267 (funcall (intern "mail-aliases-setup")))) | |
1248 (run-hooks 'text-mode-hook 'message-mode-hook)) | 1268 (run-hooks 'text-mode-hook 'message-mode-hook)) |
1249 | 1269 |
1250 | 1270 |
1251 | 1271 |
1252 ;;; | 1272 ;;; |
1325 (forward-line 1) | 1345 (forward-line 1) |
1326 (goto-char (point-max)))) | 1346 (goto-char (point-max)))) |
1327 | 1347 |
1328 | 1348 |
1329 | 1349 |
1330 (defun message-insert-to () | 1350 (defun message-insert-to (&optional force) |
1331 "Insert a To header that points to the author of the article being replied to." | 1351 "Insert a To header that points to the author of the article being replied to. |
1332 (interactive) | 1352 If the original author requested not to be sent mail, the function signals |
1353 an error. | |
1354 With the prefix argument FORCE, insert the header anyway." | |
1355 (interactive "P") | |
1333 (let ((co (message-fetch-reply-field "mail-copies-to"))) | 1356 (let ((co (message-fetch-reply-field "mail-copies-to"))) |
1334 (when (and co | 1357 (when (and (null force) |
1358 co | |
1335 (equal (downcase co) "never")) | 1359 (equal (downcase co) "never")) |
1336 (error "The user has requested not to have copies sent via mail"))) | 1360 (error "The user has requested not to have copies sent via mail"))) |
1337 (when (and (message-position-on-field "To") | 1361 (when (and (message-position-on-field "To") |
1338 (mail-fetch-field "to") | 1362 (mail-fetch-field "to") |
1339 (not (string-match "\\` *\\'" (mail-fetch-field "to")))) | 1363 (not (string-match "\\` *\\'" (mail-fetch-field "to")))) |
1710 (let ((inhibit-read-only t)) | 1734 (let ((inhibit-read-only t)) |
1711 (put-text-property (point-min) (point-max) 'read-only nil)) | 1735 (put-text-property (point-min) (point-max) 'read-only nil)) |
1712 (message-fix-before-sending) | 1736 (message-fix-before-sending) |
1713 (run-hooks 'message-send-hook) | 1737 (run-hooks 'message-send-hook) |
1714 (message "Sending...") | 1738 (message "Sending...") |
1715 (when (and (or (not (message-news-p)) | 1739 (let ((alist message-send-method-alist) |
1716 (and (or (not (memq 'news message-sent-message-via)) | 1740 elem sent) |
1717 (y-or-n-p | 1741 (while (setq elem (pop alist)) |
1718 "Already sent message via news; resend? ")) | 1742 (when (and (or (not (funcall (cadr elem))) |
1719 (funcall message-send-news-function arg))) | 1743 (and (or (not (memq (car elem) |
1720 (or (not (message-mail-p)) | 1744 message-sent-message-via)) |
1721 (and (or (not (memq 'mail message-sent-message-via)) | 1745 (y-or-n-p |
1722 (y-or-n-p | 1746 (format |
1723 "Already sent message via mail; resend? ")) | 1747 "Already sent message via %s; resend? " |
1724 (message-send-mail arg)))) | 1748 (car elem)))) |
1725 (message-do-fcc) | 1749 (funcall (caddr elem) arg)))) |
1726 ;;(when (fboundp 'mail-hist-put-headers-into-history) | 1750 (setq sent t))) |
1727 ;; (mail-hist-put-headers-into-history)) | 1751 (when sent |
1728 (run-hooks 'message-sent-hook) | 1752 (message-do-fcc) |
1729 (message "Sending...done") | 1753 ;;(when (fboundp 'mail-hist-put-headers-into-history) |
1730 ;; If buffer has no file, mark it as unmodified and delete autosave. | 1754 ;; (mail-hist-put-headers-into-history)) |
1731 (unless buffer-file-name | 1755 (run-hooks 'message-sent-hook) |
1732 (set-buffer-modified-p nil) | 1756 (message "Sending...done") |
1733 (delete-auto-save-file-if-necessary t)) | 1757 ;; If buffer has no file, mark it as unmodified and delete autosave. |
1734 ;; Delete other mail buffers and stuff. | 1758 (unless buffer-file-name |
1735 (message-do-send-housekeeping) | 1759 (set-buffer-modified-p nil) |
1736 (message-do-actions message-send-actions) | 1760 (delete-auto-save-file-if-necessary t)) |
1737 ;; Return success. | 1761 ;; Delete other mail buffers and stuff. |
1738 t))) | 1762 (message-do-send-housekeeping) |
1763 (message-do-actions message-send-actions) | |
1764 ;; Return success. | |
1765 t)))) | |
1766 | |
1767 (defun message-send-via-mail (arg) | |
1768 "Send the current message via mail." | |
1769 (message-send-mail arg)) | |
1770 | |
1771 (defun message-send-via-news (arg) | |
1772 "Send the current message via news." | |
1773 (funcall message-send-news-function arg)) | |
1739 | 1774 |
1740 (defun message-fix-before-sending () | 1775 (defun message-fix-before-sending () |
1741 "Do various things to make the message nice before sending it." | 1776 "Do various things to make the message nice before sending it." |
1742 ;; Make sure there's a newline at the end of the message. | 1777 ;; Make sure there's a newline at the end of the message. |
1743 (goto-char (point-max)) | 1778 (goto-char (point-max)) |
2916 (message-set-auto-save-file-name) | 2951 (message-set-auto-save-file-name) |
2917 (save-restriction | 2952 (save-restriction |
2918 (message-narrow-to-headers) | 2953 (message-narrow-to-headers) |
2919 (run-hooks 'message-header-setup-hook)) | 2954 (run-hooks 'message-header-setup-hook)) |
2920 (set-buffer-modified-p nil) | 2955 (set-buffer-modified-p nil) |
2956 (setq buffer-undo-list nil) | |
2921 (run-hooks 'message-setup-hook) | 2957 (run-hooks 'message-setup-hook) |
2922 (message-position-point) | 2958 (message-position-point) |
2923 (undo-boundary)) | 2959 (undo-boundary)) |
2924 | 2960 |
2925 (defun message-set-auto-save-file-name () | 2961 (defun message-set-auto-save-file-name () |
3223 (concat "Distribution: " distribution "\n") | 3259 (concat "Distribution: " distribution "\n") |
3224 "") | 3260 "") |
3225 mail-header-separator "\n" | 3261 mail-header-separator "\n" |
3226 message-cancel-message) | 3262 message-cancel-message) |
3227 (message "Canceling your article...") | 3263 (message "Canceling your article...") |
3228 (let ((message-syntax-checks 'dont-check-for-anything-just-trust-me)) | 3264 (if (let ((message-syntax-checks |
3229 (funcall message-send-news-function)) | 3265 'dont-check-for-anything-just-trust-me)) |
3230 (message "Canceling your article...done") | 3266 (funcall message-send-news-function)) |
3267 (message "Canceling your article...done")) | |
3231 (kill-buffer buf))))) | 3268 (kill-buffer buf))))) |
3232 | 3269 |
3233 ;;;###autoload | 3270 ;;;###autoload |
3234 (defun message-supersede () | 3271 (defun message-supersede () |
3235 "Start composing a message to supersede the current message. | 3272 "Start composing a message to supersede the current message. |