(defvar message-fcc-handler-function 'rmail-output
"*A function called to save outgoing articles.
-This function will be called with the same of the file to store the
+This function will be called with the name of the file to store the
article in. The default function is `rmail-output' which saves in Unix
mailbox format.")
included. Organization, Lines and X-Mailer are optional.")
(defvar message-deletable-headers '(Message-ID Date)
- "*Headers to be deleted if they already exists and were generated by message previously.")
+ "*Headers to be deleted if they already exist and were generated by message previously.")
(defvar message-ignored-news-headers
"^NNTP-Posting-Host:\\|^Xref:\\|^Bcc:\\|^Gcc:"
"*Regexp of headers to be removed unconditionally before posting.")
+(defvar message-ignored-mail-headers "^Gcc:"
+ "*Regexp of headers to be removed unconditionally before mailing.")
+
(defvar message-ignored-supersedes-headers
"^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|Return-Path:"
"*Header lines matching this regexp will be deleted before posting.
"Normal hook, run each time a new outgoing message is initialized.
The function `message-setup' runs this hook.")
+(defvar message-cite-hook nil
+ "Hook run when yanking articles.")
+
(defvar message-header-setup-hook nil
"Hook called narrowed to the headers when setting up a message buffer.")
(let ((table (copy-syntax-table text-mode-syntax-table)))
(modify-syntax-entry ?% ". " table)
table)
- "Syntax table used while in message mode.")
+ "Syntax table used while in Message mode.")
(defvar message-font-lock-keywords
(let* ((cite-prefix "A-Za-z") (cite-suffix (concat cite-prefix "0-9_.@-")))
'font-lock-reference-face)
'("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\):.*"
. font-lock-string-face)))
- "Additional expressions to highlight in Mail mode.")
+ "Additional expressions to highlight in Message mode.")
(defvar message-send-hook nil
"Hook run before sending messages.")
(defvar message-mode-map nil)
(unless message-mode-map
- (setq message-mode-map (nconc (make-sparse-keymap) text-mode-map))
+ (setq message-mode-map (copy-keymap text-mode-map))
(define-key message-mode-map "\C-c?" 'describe-mode)
(define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to)
(define-key message-mode-map "\C-c\C-c" 'message-send-and-exit)
(define-key message-mode-map "\C-c\C-s" 'message-send))
-(easy-menu-define
- message-menu message-mode-map ""
- '("Mail"
- ["Fill Citation" message-fill-yanked-message t]))
+(defun message-make-menu-bar ()
+ (unless (boundp 'message-menu)
+ (easy-menu-define
+ message-menu message-mode-map ""
+ '("Message"
+ ["Fill Citation" message-fill-yanked-message t]))))
;;;###autoload
(defun message-mode ()
- "Major mode for editing mail to be sent.
+ "Major mode for editing mail and news to be sent.
Like Text Mode but with these additional commands:
C-c C-s message-send (send the message) C-c C-c message-send-and-exit
C-c C-f move to a header field (and create it if there isn't):
C-c C-f C-t move to To: C-c C-f C-s move to Subject:
C-c C-f C-c move to CC: C-c C-f C-b move to BCC:
- C-c C-f C-f move to FCC:
-C-c C-t message-text (move to beginning of message text).
-C-c C-w message-signature (insert `message-signature-file' file).
-C-c C-y message-yank-original (insert current message, in Rmail).
+ C-c C-f C-f move to FCC: C-c C-f C-r move to Reply-To:
+ C-c C-f C-u move to Summary: C-c C-f C-n move to Newsgroups:
+ C-c C-f C-k move to Kewords: C-c C-f C-d move to Distribution:
+ C-c C-f C-o move to Followup-To:
+C-c C-t message-insert-to (add a To: header to a news followup)
+C-c C-n message-insert-newsgroups (add a Newsgroup: header to a news reply)
+C-c C-b message-goto-text (move to beginning of message text).
+C-c C-s message-goto-signature (move to the beginning of the signature).
+C-c C-w message-insert-signature (insert `message-signature-file' file).
+C-c C-y message-yank-original (insert current message, if any).
C-c C-q message-fill-yanked-message (fill what was yanked).
-C-c C-v message-sent-via (add a Sent-via field for each To or CC)."
+C-c C-v message-sent-via (add a Sent-via field for each To or CC).
+C-c C-r message-ceasar-buffer-body (rot13 the message body)."
(interactive)
(kill-all-local-variables)
(make-local-variable 'message-reply-buffer)
(goto-char (point-min))
(search-forward (concat "\n" message-header-separator "\n") nil t))
+(defun message-goto-signature ()
+ "Move point to the beginning of the message signature,
+or the line sollowing `message-signature-separator'."
+ (interactive)
+ (goto-char (point-min))
+ (search-forward (concat "\n" message-signature-separator "\n") nil t))
+
\f
(defun message-insert-to ()
- "Insert a To header that points to the author of the message being replied to."
+ "Insert a To header that points to the author of the article being replied to."
(interactive)
(message-position-on-field "To")
(insert (or (message-fetch-reply-field "reply-to")
;;; Various commands
(defun message-insert-signature ()
- "Insert a signature."
+ "Insert a signature. See documentation for the `message-signature' variable."
(interactive)
(let* ((signature
(cond ((message-functionp message-signature)
(goto-char start))))
(defun message-yank-original (&optional arg)
- "Insert the message being replied to, if any (in rmail).
+ "Insert the message being replied to, if any.
Puts point before the text and mark after.
Normally indents each nonblank line ARG spaces (default 3). However,
if `message-yank-prefix' is non-nil, insert that prefix on each line.
(unless (bolp)
(insert ?\n))
(unless modified
- (setq message-checksum (message-checksum))))))
+ (setq message-checksum (message-checksum)))
+ (run-hooks 'message-cite-hook))))
(defun message-insert-citation-line ()
"Function that inserts a simple citation line."
(when (if buffer-file-name
(y-or-n-p (format "Send buffer contents as %s message? "
(if (message-mail-p)
- (if (message-news-p) "main and news" "news")
+ (if (message-news-p) "mail and news" "mail")
"news")))
(or (buffer-modified-p)
(y-or-n-p "No changes in the buffer; really send? ")))
(mailbuf (current-buffer)))
(save-restriction
(message-narrow-to-headers)
- ;; Remove some headers.
- (message-remove-header message-ignored-news-headers t)
;; Insert some headers.
(message-generate-headers message-required-mail-headers)
;; Let the user do all of the above.
(set-buffer tembuf)
(erase-buffer)
(insert-buffer-substring mailbuf)
+ ;; Remove some headers.
+ (save-restriction
+ (message-narrow-to-headers)
+ ;; Remove some headers.
+ (message-remove-header message-ignored-news-headers t))
(goto-char (point-max))
;; require one newline at the end.
(or (= (preceding-char) ?\n)
(kill-buffer tembuf)
(when (bufferp errbuf)
(kill-buffer errbuf)))
+ (set-buffer mailbuf)
(push 'mail message-sent-message-via)))
(defun message-send-news (&optional arg)
(messbuf (current-buffer)))
(save-restriction
(message-narrow-to-headers)
- ;; Remove some headers.
- (message-remove-header message-ignored-news-headers t)
;; Insert some headers.
(message-generate-headers message-required-news-headers)
;; Let the user do all of the above.
(save-excursion
(set-buffer tembuf)
(buffer-disable-undo (current-buffer))
- (erase-buffer)
+ (erase-buffer)
(insert-buffer-substring messbuf)
+ ;; Remove some headers.
+ (save-restriction
+ (message-narrow-to-headers)
+ ;; Remove some headers.
+ (message-remove-header message-ignored-news-headers t))
(goto-char (point-max))
;; require one newline at the end.
(or (= (preceding-char) ?\n)
(funcall (intern (format "%s-request-post"
(car method)))))
(kill-buffer tembuf))
+ (set-buffer messbuf)
(push 'news message-sent-message-via))))
;;;
list file)
(save-excursion
(save-restriction
- (nnheader-narrow-to-headers)
+ (message-narrow-to-headers)
(while (setq file (mail-fetch-field "fcc"))
(push file list)
(message-remove-header "fcc" nil t))
;; Correct Newsgroups and Followup-To headers: change sequence of
;; spaces to comma and eliminate spaces around commas. Eliminate
- ;; imbedded line breaks.
+ ;; embedded line breaks.
(goto-char (point-min))
(while (re-search-forward "^\\(Newsgroups\\|Followup-To\\): +" nil t)
(save-restriction
(save-restriction
(message-narrow-to-headers)
(let ((newsgroups (mail-fetch-field "newsgroups")))
- (goto-char (point-max))
- (insert "Posted-To: " newsgroups "\n")))
+ (when newsgroups
+ (goto-char (point-max))
+ (insert "Posted-To: " newsgroups "\n"))))
(forward-line 1)
(insert message-courtesy-message)))
(pop h))
alist)
headers)
+ (forward-line -1)
(when message-default-headers
(insert message-default-headers))
(when (and (message-news-p)
(when message-generate-headers-first
(message-generate-headers message-required-mail-headers))
(insert message-default-mail-headers))
- (forward-line -1)
(insert message-header-separator "\n")
(message-insert-signature)
(message-set-auto-save-file-name)
(if (message-functionp message-reply-to-function)
(setq follow-to (funcall message-reply-to-function)))
;; This is a followup.
- (if (gnus-functionp message-wide-reply-to-function)
+ (if (message-functionp message-wide-reply-to-function)
(save-excursion
(setq follow-to
(funcall message-wide-reply-to-function)))))
;;;###autoload
(defun message-forward (&optional news)
+ "Forward the current message via mail.
+Optional NEWS will use news to forward instead of mail."
(interactive "P")
(let ((cur (current-buffer))
(subject (message-make-forward-subject)))