• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:mail +defs:citation +defs:hook

1 ;;; message.el --- composing mail and news messages
7 ;; Keywords: mail, news
28 ;; This mode provides mail-sending facilities from within Emacs. It
43 ;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better
46 (require 'mail-abbrevs)
48 (require 'mail-parse)
56 (defgroup message '((user-mail-address custom-variable)
60 :group 'mail
63 (put 'user-mail-address 'custom-type 'string)
105 (defgroup message-mail nil
115 "*Directory from which all other mail file variables are derived."
155 "*Regexp that matches headers to be removed in resent bounced mail."
207 `message-required-mail-headers'."
236 (defcustom message-required-mail-headers
242 :group 'message-mail
266 (defcustom message-ignored-mail-headers
269 :group 'message-mail
429 nil means let mailer mail back a message to report errors."
431 :group 'message-mail
440 Generate the buffer name in the Message way (e.g., *mail*, *news*,
441 *mail to whom*, *news on group*, etc.) and continue editing in the
452 Similar to nil but the buffer name is simpler like *mail message*.
595 "*Regexp matching the longest possible citation prefix on a line."
609 (defcustom message-send-mail-function 'message-send-mail-with-sendmail
610 "Function to call to send the current buffer as mail.
612 variable `mail-header-separator'.
614 Valid values include `message-send-mail-with-sendmail' (the default),
615 `message-send-mail-with-mh', `message-send-mail-with-qmail',
618 See also `send-mail-function'."
619 :type '(radio (function-item message-send-mail-with-sendmail)
620 (function-item message-send-mail-with-mh)
621 (function-item message-send-mail-with-qmail)
628 :group 'message-mail)
633 variable `mail-header-separator'."
676 (defcustom message-use-mail-followup-to 'use
749 "*Envelope-from when sending mail with sendmail.
750 If this is nil, use `user-mail-address'. If it is the symbol
755 (const :tag "Use `user-mail-address'" nil))
812 `message-required-mail-headers' specify which headers to generate.
824 (defcustom message-setup-hook nil
825 "Normal hook, run each time a new outgoing message is initialized.
826 The function `message-setup' runs this hook."
829 :type 'hook)
831 (defcustom message-cancel-hook nil
835 :type 'hook)
837 (defcustom message-signature-setup-hook nil
838 "Normal hook, run each time a new outgoing message is initialized.
843 :type 'hook)
845 (defcustom message-mode-hook nil
848 :type 'hook)
850 (defcustom message-header-hook nil
853 :type 'hook)
855 (defcustom message-header-setup-hook nil
859 :type 'hook)
870 (defcustom message-citation-line-function 'message-insert-citation-line
911 Note that `message-cite-original' uses `mail-citation-hook' if that is non-nil."
920 (defcustom message-indent-citation-function 'message-indent-citation
921 "*Function for modifying a citation just inserted in the mail buffer.
923 citation between (point) and (mark t). And each function should leave
924 point and mark around the citation text as modified."
1012 (defcustom message-default-mail-headers ""
1015 :group 'message-mail
1026 ;; Note: could use /usr/ucb/mail instead of sendmail;
1055 (define-mail-user-agent 'message-user-agent
1056 'message-mail 'message-send-and-exit
1057 'message-kill-buffer 'message-send-hook)
1064 (mail message-mail-p message-send-via-mail))
1076 (defcustom message-mail-alias-type 'abbrev
1079 mail aliases off."
1296 (concat "^" (regexp-quote mail-header-separator) "$")
1332 ,@(if (and mail-header-separator
1333 (not (equal mail-header-separator "")))
1334 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
1358 "Alist of mail and news faces for facemenu.
1361 (defcustom message-send-hook nil
1363 This hook is run quite early when sending."
1367 :type 'hook)
1369 (defcustom message-send-mail-hook nil
1370 "Hook run before sending mail messages.
1371 This hook is run very late -- just before the message is sent as
1372 mail."
1375 :type 'hook)
1377 (defcustom message-send-news-hook nil
1379 This hook is run very late -- just before the message is sent as
1383 :type 'hook)
1385 (defcustom message-sent-hook nil
1388 :type 'hook)
1391 "Coding system to encode outgoing mail.")
1395 "*Coding system to compose mail.
1400 (defcustom message-send-mail-partially-limit 1000000
1417 off `message-setup-hook'."
1424 "A list of hierarchical mail address definitions.
1428 mail sent to the first address will automatically be delivered to the
1431 the mail is sent. All addresses in this structure should be
1437 (defcustom message-mail-user-agent nil
1438 "Like `mail-user-agent'.
1440 `mail-user-agent'."
1445 (const :tag "`mail-user-agent'"
1448 (function-item :tag "Default Emacs mail"
1501 (defvar message-this-is-mail nil)
1512 ;;; Regexp matching the delimiter of messages in UNIX mail format
1514 ;;; of rmail.el's rmail-unix-mail-delimiter.
1515 (defvar message-unix-mail-delimiter
1565 "Regexp matching the delimiter of messages in UNIX mail format.")
1599 (defvar message-send-mail-real-function nil
1600 "Internal send mail function.")
1632 (autoload 'gnus-output-to-mail "gnus-util")
1644 (autoload 'gnus-make-local-hook "gnus-util")
1712 (defun message-mail-file-mbox-p (file)
1720 (looking-at message-unix-mail-delimiter))))
1723 "The same as `mail-fetch-field', only remove all newlines.
1728 (value (mail-fetch-field header nil (not not-all))))
1787 (mail-narrow-to-head)
2064 (concat "^" mail-header-separator)
2204 (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
2230 (regexp-quote mail-header-separator)
2239 (and (not message-this-is-mail)
2247 (defun message-mail-p ()
2248 "Say whether the current buffer contains a mail message."
2250 (or message-this-is-mail
2344 (define-key message-mode-map "\C-c\C-f\C-m" 'message-goto-mail-followup-to)
2350 'message-generate-unsubscribed-mail-followup-to)
2494 ["Mail-Followup-To" message-goto-mail-followup-to t]
2495 ["Unsubscribed list post" message-generate-unsubscribed-mail-followup-to
2576 "Major mode for editing mail and news to be sent.
2651 (gnus-make-local-hook 'after-change-functions)
2653 (add-hook 'after-change-functions 'message-strip-forbidden-properties
2655 ;; Allow mail alias things.
2656 (when (eq message-mail-alias-type 'abbrev)
2657 (if (fboundp 'mail-abbrevs-setup)
2658 (mail-abbrevs-setup)
2659 (if (fboundp 'mail-aliases-setup) ; warning avoidance
2660 (mail-aliases-setup))))
2686 (regexp-quote mail-header-separator) "$\\|"
2706 ;; KLUDGE: auto fill might already be turned on in `text-mode-hook'.
2709 ;; `text-mode-hook' ourself at the end of the mode.
2773 (defun message-goto-mail-followup-to ()
2795 (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
2820 (defun message-generate-unsubscribed-mail-followup-to (&optional include-cc)
2826 in the current mail buffer, and appends the current `user-mail-address'.
2840 (message-goto-mail-followup-to)
2841 (insert (concat tos ", " user-mail-address))))
2848 If the original author requested not to be sent mail, don't insert unless the
2851 (let* ((mct (message-fetch-reply-field "mail-copies-to"))
2854 (to (or (message-fetch-reply-field "mail-reply-to")
2860 "Ignoring the user request not to have copies sent via mail"
2861 "Complying with the user request not to have copies sent via mail")))
2863 (error "No mail address in the article"))
2893 ;; (mail-strip-quoted-names "Foo Bar <foo@bar>, bla@fasel (Bla Fasel)")
2901 for old-header = (mail-fetch-field (symbol-name synonym))
2907 (setq old-header (mail-fetch-field header-name))
2934 (mail-fetch-field "newsgroups")
2935 (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups"))))
2950 ;; snarf citation prefix, if appropriate
3076 ;; Is it better to use `mail-header-end'?
3083 (concat "^" (regexp-quote mail-header-separator) "\n")
3262 (search-forward mail-header-separator nil 'end))
3263 (let* ((mail-to (or
3267 (mail-trimmed-to
3268 (if (string-match "," mail-to)
3269 (concat (substring mail-to 0 (match-beginning 0)) ", ...")
3270 mail-to))
3271 (name-default (concat "*message* " mail-trimmed-to))
3283 (search-forward (concat "\n" mail-header-separator "\n") nil t)
3287 (defun message-indent-citation ()
3388 (when message-indent-citation-function
3389 (if (listp message-indent-citation-function)
3390 message-indent-citation-function
3391 (list message-indent-citation-function))))
3423 (when message-citation-line-function
3426 (funcall message-citation-line-function))))
3428 (eval-when-compile (defvar mail-citation-hook)) ;Compiler directive
3431 (if (and (boundp 'mail-citation-hook)
3432 mail-citation-hook)
3433 (run-hooks 'mail-citation-hook)
3437 (when message-indent-citation-function
3438 (if (listp message-indent-citation-function)
3439 message-indent-citation-function
3440 (list message-indent-citation-function))))
3459 (when message-citation-line-function
3462 (funcall message-citation-line-function)))))
3464 (defun message-insert-citation-line ()
3465 "Insert a simple citation line."
3467 (insert (mail-header-from message-reply-headers) " writes:")
3478 (concat "^" (regexp-quote mail-header-separator) "$"))
3507 (message-indent-citation)
3515 (message-indent-citation)
3529 "Send message like `message-send', then, if no errors, exit from mail buffer."
3585 "Bury this mail BUFFER."
3607 (run-hooks 'message-send-hook)
3647 (run-hooks 'message-sent-hook))
3653 ;; Delete other mail buffers and stuff.
3659 (defun message-send-via-mail (arg)
3660 "Send the current message via mail."
3661 (message-send-mail arg))
3702 ;; is clobbered by an after-change hook anyhow.
3793 (defun message-send-mail-partially ()
3794 "Send mail as message/partial."
3798 (concat "^" (regexp-quote mail-header-separator) "\n"))
3800 (run-hooks 'message-send-mail-hook)
3805 plist total header required-mail-headers)
3807 (if (< (point-max) (+ p message-send-mail-partially-limit))
3809 (goto-char (+ p message-send-mail-partially-limit))
3847 (let ((mail-header-separator ""))
3848 (when (memq 'Message-ID message-required-mail-headers)
3850 (when (memq 'Lines message-required-mail-headers)
3857 (funcall (or message-send-mail-real-function
3858 message-send-mail-function))))
3864 (defun message-send-mail (&optional arg)
3865 (require 'mail-utils)
3870 (message-this-is-mail t)
3875 (headers message-required-mail-headers))
3880 (not (mail-fetch-field "mail-followup-to")))
3883 (cons "Mail-Followup-To" (message-make-mail-followup-to))
3884 message-required-mail-headers))
3886 (when (equal "" (mail-fetch-field "mail-followup-to"))
3903 (run-hooks 'message-header-hook))
3917 (when (memq 'Lines message-required-mail-headers)
3920 (message-remove-header message-ignored-mail-headers t)
3921 (let ((mail-parse-charset message-default-charset))
3922 (mail-encode-encoded-word-buffer)))
3945 (mail-header-parse-content-type
3952 (if (or (not message-send-mail-partially-limit)
3953 (< (buffer-size) message-send-mail-partially-limit)
3961 Some mail gateways (MTA's) bounce large messages. To avoid the
3964 (/ message-send-mail-partially-limit 1000)
3968 However, some mail readers (MUA's) can't read split messages, i.e.,
3972 The size limit is controlled by `message-send-mail-partially-limit'.
3974 `message-send-mail-partially-limit' to nil.
3977 (message "Sending via mail...")
3978 (funcall (or message-send-mail-real-function
3979 message-send-mail-function)))
3980 (message-send-mail-partially)))
3983 (push 'mail message-sent-message-via)))
3985 (defun message-send-mail-with-sendmail ()
4001 (concat "^" (regexp-quote mail-header-separator) "\n"))
4005 (run-hooks 'message-send-mail-hook)
4037 ;; These mean "report errors by mail"
4062 (defun message-send-mail-with-qmail ()
4064 Refer to the documentation for the variable `message-send-mail-function'
4069 (concat "^" (regexp-quote mail-header-separator) "\n"))
4071 (run-hooks 'message-send-mail-hook)
4088 ;; compare this with message-send-mail-with-sendmail and weep
4106 (defun message-send-mail-with-mh ()
4120 (run-hooks 'message-send-mail-hook)
4127 `message-send-mail-hook' just before sending a message. It is useful
4130 (run-hooks 'message-send-mail-hook)
4202 (run-hooks 'message-header-hook))
4229 (when (memq 'Lines message-required-mail-headers)
4233 (let ((mail-parse-charset message-default-charset))
4234 (mail-encode-encoded-word-buffer)))
4243 (concat "^" (regexp-quote mail-header-separator) "\n"))
4246 (run-hooks 'message-send-news-hook)
4249 (setq result (let ((mail-header-separator ""))
4376 "Message-ID.*.i-did-not-set--mail-host-address--so-tickle-me" nil t)
4479 (when (setq header (mail-fetch-field (car headers)))
4504 (when (setq header (mail-fetch-field (pop headers)))
4525 (setq ad (nth 1 (mail-extract-address-components
4558 (setq ad (nth 1 (mail-extract-address-components
4577 (concat "^" (regexp-quote mail-header-separator) "$"))
4594 (concat "^" (regexp-quote mail-header-separator) "$"))
4652 (concat "^" (regexp-quote mail-header-separator) "$"))
4664 (concat "^" (regexp-quote mail-header-separator) "$"))
4692 (let ((mail-parse-charset message-default-charset)
4696 (mail-encode-encoded-word-buffer)))
4699 (concat "^" (regexp-quote mail-header-separator) "$")
4717 (if (and (file-readable-p file) (mail-file-babyl-p file))
4719 (let ((mail-use-rfc822 t))
4724 "Append this article to Unix/babyl mail file FILENAME."
4726 (mail-file-babyl-p filename))
4728 (gnus-output-to-mail filename t)))
4794 (mail-header-references message-reply-headers)
4795 (mail-header-subject message-reply-headers)
4799 (mail-header-subject message-reply-headers))
4880 (let ((message-id (mail-header-message-id message-reply-headers))
4881 (references (mail-header-references message-reply-headers))
4891 (let ((from (mail-header-from message-reply-headers))
4892 (date (mail-header-date message-reply-headers))
4893 (msg-id (mail-header-message-id message-reply-headers)))
4895 (let ((name (mail-extract-address-components from)))
5016 (or (message-user-mail-address)
5019 (defun message-user-mail-address ()
5020 "Return the pertinent part of `user-mail-address'."
5021 (when (and user-mail-address
5022 (string-match "@.*\\." user-mail-address))
5023 (if (string-match " " user-mail-address)
5024 (nth 1 (mail-extract-address-components user-mail-address))
5025 user-mail-address)))
5030 (nth 1 (mail-extract-address-components
5040 (user-mail (message-user-mail-address))
5042 (if (and user-mail
5043 (string-match "@\\(.*\\)\\'" user-mail))
5044 (match-string 1 user-mail)))
5057 ;; Try `mail-host-address'.
5058 ((and (boundp 'mail-host-address)
5059 (stringp mail-host-address)
5060 (string-match message-valid-fqdn-regexp mail-host-address)
5061 (not (string-match message-bogus-system-names mail-host-address)))
5062 mail-host-address)
5063 ;; We try `user-mail-address' as a backup.
5072 ".i-did-not-set--mail-host-address--so-tickle-me")))))
5082 (or mail-host-address
5089 (let ((listaddr (message-make-mail-followup-to t)))
5097 (defun message-make-mail-followup-to (&optional only-show-subscribed)
5106 (mapcar 'mail-strip-quoted-names
5151 'car (mail-header-parse-addresses field))))))
5315 (cadr (mail-extract-address-components from)))
5321 (cadr (mail-extract-address-components sender)))
5336 "Insert a courtesy message in mail copies of combined messages."
5538 (or (car (mail-extract-address-components to))
5552 (or (car (mail-extract-address-components to))
5625 ;; Note: mail-abbrevs of XEmacs renames buffer name behind Gnus.
5627 "\\`\\*\\(sent \\|unsent \\)?\\(.+\\)\\*[^\\*]*\\|\\`mail to "
5632 (string-equal name "mail")
5641 (to (concat "*sent mail to "
5642 (or (car (mail-extract-address-components to))
5646 (t "*sent mail*"))))
5654 (defun message-mail-user-agent ()
5656 ((not message-mail-user-agent) nil)
5657 ((eq message-mail-user-agent t) mail-user-agent)
5658 (t message-mail-user-agent))))
5665 (let ((mua (message-mail-user-agent))
5667 (if (not (and message-this-is-mail mua))
5680 (let ((mail-user-agent mua))
5681 (compose-mail to subject
5722 (mail-header-format
5738 (insert mail-header-separator "\n")
5753 (when (message-mail-p)
5754 (when message-default-mail-headers
5755 (insert message-default-mail-headers)
5760 (append message-required-mail-headers
5764 (run-hooks 'message-signature-setup-hook)
5768 (run-hooks 'message-header-setup-hook))
5771 (run-hooks 'message-setup-hook)
5773 (when (message-mail-p)
5819 (when (message-mail-p)
5823 (copy-sequence message-required-mail-headers))))))))
5833 (defun message-mail (&optional to subject
5836 "Start editing a mail message to be sent.
5839 is a function used to switch to and display the mail buffer."
5841 (let ((message-this-is-mail t) replybuffer)
5842 (unless (message-mail-user-agent)
5850 (message-buffer-name "mail" to))
5852 ;; FIXME: message-mail should do something if YANK-ACTION is not
5886 mct (message-fetch-field "mail-copies-to")
5887 author (or (message-fetch-field "mail-reply-to")
5891 mft (and message-use-mail-followup-to
5892 (message-fetch-field "mail-followup-to"))))
5916 (or (not (eq message-use-mail-followup-to 'ask))
5939 You may customize the variable `message-use-mail-followup-to', if you
5967 (cons (downcase (mail-strip-quoted-names addr)) addr))
6046 (message-this-is-mail t)
6077 (unless (message-mail-user-agent)
6127 mrt (message-fetch-field "mail-reply-to")
6129 mct (message-fetch-field "mail-copies-to"))
6161 `Followup-To: poster' sends your response via e-mail instead of news.
6243 (downcase (cadr (mail-extract-address-components from)))
6244 (downcase (cadr (mail-extract-address-components
6252 (cadr (mail-extract-address-components from))))))))))
6286 mail-header-separator "\n"
6288 (run-hooks 'message-cancel-hook)
6320 (insert mail-header-separator)
6384 The form is: [Source] Subject, where if the original message was mail,
6397 (mail-decode-encoded-word-string prefix))
6402 The form is: [Source] Subject, where if the original message was mail,
6414 (mail-decode-encoded-word-string prefix))
6436 (mail-decode-encoded-word-string subject))
6458 "Forward the current message via mail.
6459 Optional NEWS will use news to forward instead of mail.
6470 (message-mail nil subject))
6626 ;; We first set up a normal mail buffer.
6627 (unless (message-mail-user-agent)
6630 (let ((message-this-is-mail t)
6631 message-setup-hook)
6637 (message-remove-header message-ignored-mail-headers t)
6656 (insert mail-header-separator)
6667 message-required-mail-headers
6669 (message-send-mail))
6675 "Re-mail the current message.
6677 contains some mail you have written which has been bounced back to
6693 ;; We remove everything before the bounced mail.
6712 (insert mail-header-separator))
6720 (defun message-mail-other-window (&optional to subject)
6721 "Like `message-mail' command, but display mail buffer in another window."
6723 (unless (message-mail-user-agent)
6729 (message-pop-to-buffer (message-buffer-name "mail" to))))
6730 (let ((message-this-is-mail t))
6735 (defun message-mail-other-frame (&optional to subject)
6736 "Like `message-mail' command, but display mail buffer in another frame."
6738 (unless (message-mail-user-agent)
6744 (message-pop-to-buffer (message-buffer-name "mail" to))))
6745 (let ((message-this-is-mail t))
6871 (message-send-and-exit "mail/send")
6872 (message-dont-send "mail/save-draft")
6875 (mml-preview "mail/preview" mml-mode-map)
6936 "mail/save-draft.xpm"
6982 (let ((mail-abbrev-mode-regexp (caar alist)))
6983 (not (mail-abbrev-in-expansion-header-p))))
7094 (regexp "^gnus\\|^nn\\|^message\\|^sendmail\\|^smtp\\|^user-mail-address"))
7115 (let ((mail-parse-charset (or mail-parse-charset
7150 ;; instance, Solaris' /usr/bin/mail.
7160 (if (fboundp 'mail-abbrevs-setup)
7161 (let ((mail-abbrev-mode-regexp "")
7162 (minibuffer-setup-hook 'mail-abbrevs-setup)
7165 (let ((minibuffer-setup-hook 'mail-abbrev-minibuffer-setup-hook)
7173 (require 'mail-utils)
7177 (mail-strip-quoted-names
7186 (unless (or (not email) (equal email user-mail-address))
7208 (mail-strip-quoted-names
7211 (mail-strip-quoted-names
7261 (run-hooks 'message-load-hook)