diff options
| author | Alan Mackenzie | 2017-02-12 10:59:03 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2017-02-12 10:59:03 +0000 |
| commit | f4d5b687150810129b7a1d5b006e31ccf82b691b (patch) | |
| tree | 4229b13800349032697daae3904dc3773e6b7a80 /lisp/gnus/message.el | |
| parent | d5514332d4a6092673ce1f78fadcae0c57f7be64 (diff) | |
| parent | 148100d98319499f0ac6f57b8be08cbd14884a5c (diff) | |
| download | emacs-comment-cache.tar.gz emacs-comment-cache.zip | |
Merge branch 'master' into comment-cachecomment-cache
Diffstat (limited to 'lisp/gnus/message.el')
| -rw-r--r-- | lisp/gnus/message.el | 132 |
1 files changed, 77 insertions, 55 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 4d4ba089434..ce0dad9cb05 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -2286,13 +2286,15 @@ body, set `message-archive-note' to nil." | |||
| 2286 | "Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP. | 2286 | "Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP. |
| 2287 | With prefix-argument just set Follow-Up, don't cross-post." | 2287 | With prefix-argument just set Follow-Up, don't cross-post." |
| 2288 | (interactive | 2288 | (interactive |
| 2289 | (list ; Completion based on Gnus | 2289 | (list ; Completion based on Gnus |
| 2290 | (completing-read "Followup To: " | 2290 | (replace-regexp-in-string |
| 2291 | (if (boundp 'gnus-newsrc-alist) | 2291 | "\\`.*:" "" |
| 2292 | gnus-newsrc-alist) | 2292 | (completing-read "Followup To: " |
| 2293 | nil nil '("poster" . 0) | 2293 | (if (boundp 'gnus-newsrc-alist) |
| 2294 | (if (boundp 'gnus-group-history) | 2294 | gnus-newsrc-alist) |
| 2295 | 'gnus-group-history)))) | 2295 | nil nil '("poster" . 0) |
| 2296 | (if (boundp 'gnus-group-history) | ||
| 2297 | 'gnus-group-history))))) | ||
| 2296 | (message-remove-header "Follow[Uu]p-[Tt]o" t) | 2298 | (message-remove-header "Follow[Uu]p-[Tt]o" t) |
| 2297 | (message-goto-newsgroups) | 2299 | (message-goto-newsgroups) |
| 2298 | (beginning-of-line) | 2300 | (beginning-of-line) |
| @@ -2361,13 +2363,15 @@ been made to before the user asked for a Crosspost." | |||
| 2361 | "Crossposts message and set Followup-To to TARGET-GROUP. | 2363 | "Crossposts message and set Followup-To to TARGET-GROUP. |
| 2362 | With prefix-argument just set Follow-Up, don't cross-post." | 2364 | With prefix-argument just set Follow-Up, don't cross-post." |
| 2363 | (interactive | 2365 | (interactive |
| 2364 | (list ; Completion based on Gnus | 2366 | (list ; Completion based on Gnus |
| 2365 | (completing-read "Followup To: " | 2367 | (replace-regexp-in-string |
| 2366 | (if (boundp 'gnus-newsrc-alist) | 2368 | "\\`.*:" "" |
| 2367 | gnus-newsrc-alist) | 2369 | (completing-read "Followup To: " |
| 2368 | nil nil '("poster" . 0) | 2370 | (if (boundp 'gnus-newsrc-alist) |
| 2369 | (if (boundp 'gnus-group-history) | 2371 | gnus-newsrc-alist) |
| 2370 | 'gnus-group-history)))) | 2372 | nil nil '("poster" . 0) |
| 2373 | (if (boundp 'gnus-group-history) | ||
| 2374 | 'gnus-group-history))))) | ||
| 2371 | (when (fboundp 'gnus-group-real-name) | 2375 | (when (fboundp 'gnus-group-real-name) |
| 2372 | (setq target-group (gnus-group-real-name target-group))) | 2376 | (setq target-group (gnus-group-real-name target-group))) |
| 2373 | (cond ((not (or (null target-group) ; new subject not empty | 2377 | (cond ((not (or (null target-group) ; new subject not empty |
| @@ -3108,18 +3112,29 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." | |||
| 3108 | (looking-at "[ \t]*\n")) | 3112 | (looking-at "[ \t]*\n")) |
| 3109 | (expand-abbrev)) | 3113 | (expand-abbrev)) |
| 3110 | (push-mark) | 3114 | (push-mark) |
| 3115 | (message-goto-body-1)) | ||
| 3116 | |||
| 3117 | (defun message-goto-body-1 () | ||
| 3118 | "Go to the body and return point." | ||
| 3111 | (goto-char (point-min)) | 3119 | (goto-char (point-min)) |
| 3112 | (or (search-forward (concat "\n" mail-header-separator "\n") nil t) | 3120 | (or (search-forward (concat "\n" mail-header-separator "\n") nil t) |
| 3113 | (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))) | 3121 | ;; If the message is mangled, find the end of the headers the |
| 3122 | ;; hard way. | ||
| 3123 | (progn | ||
| 3124 | ;; Skip past all headers and continuation lines. | ||
| 3125 | (while (looking-at "[^:]+:\\|[\t ]+[^\t ]") | ||
| 3126 | (forward-line 1)) | ||
| 3127 | ;; We're now at the first empty line, so perhaps move past it. | ||
| 3128 | (when (and (eolp) | ||
| 3129 | (not (eobp))) | ||
| 3130 | (forward-line 1)) | ||
| 3131 | (point)))) | ||
| 3114 | 3132 | ||
| 3115 | (defun message-in-body-p () | 3133 | (defun message-in-body-p () |
| 3116 | "Return t if point is in the message body." | 3134 | "Return t if point is in the message body." |
| 3117 | (>= (point) | 3135 | (>= (point) |
| 3118 | (save-excursion | 3136 | (save-excursion |
| 3119 | (goto-char (point-min)) | 3137 | (message-goto-body-1)))) |
| 3120 | (or (search-forward (concat "\n" mail-header-separator "\n") nil t) | ||
| 3121 | (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)) | ||
| 3122 | (point)))) | ||
| 3123 | 3138 | ||
| 3124 | (defun message-goto-eoh () | 3139 | (defun message-goto-eoh () |
| 3125 | "Move point to the end of the headers." | 3140 | "Move point to the end of the headers." |
| @@ -3330,6 +3345,8 @@ of lines before the signature intact." | |||
| 3330 | "Insert four newlines, and then reformat if inside quoted text. | 3345 | "Insert four newlines, and then reformat if inside quoted text. |
| 3331 | Prefix arg means justify as well." | 3346 | Prefix arg means justify as well." |
| 3332 | (interactive (list (if current-prefix-arg 'full))) | 3347 | (interactive (list (if current-prefix-arg 'full))) |
| 3348 | (unless (message-in-body-p) | ||
| 3349 | (error "This command only works in the body of the message")) | ||
| 3333 | (let (quoted point beg end leading-space bolp fill-paragraph-function) | 3350 | (let (quoted point beg end leading-space bolp fill-paragraph-function) |
| 3334 | (setq point (point)) | 3351 | (setq point (point)) |
| 3335 | (beginning-of-line) | 3352 | (beginning-of-line) |
| @@ -4102,8 +4119,8 @@ It should typically alter the sending method in some way or other." | |||
| 4102 | (let ((inhibit-read-only t)) | 4119 | (let ((inhibit-read-only t)) |
| 4103 | (put-text-property (point-min) (point-max) 'read-only nil)) | 4120 | (put-text-property (point-min) (point-max) 'read-only nil)) |
| 4104 | (message-fix-before-sending) | 4121 | (message-fix-before-sending) |
| 4105 | (mml-secure-bcc-is-safe) | ||
| 4106 | (run-hooks 'message-send-hook) | 4122 | (run-hooks 'message-send-hook) |
| 4123 | (mml-secure-bcc-is-safe) | ||
| 4107 | (when message-confirm-send | 4124 | (when message-confirm-send |
| 4108 | (or (y-or-n-p "Send message? ") | 4125 | (or (y-or-n-p "Send message? ") |
| 4109 | (keyboard-quit))) | 4126 | (keyboard-quit))) |
| @@ -4539,6 +4556,9 @@ This function could be useful in `message-setup-hook'." | |||
| 4539 | (forward-line 1) | 4556 | (forward-line 1) |
| 4540 | (unless (y-or-n-p "Send anyway? ") | 4557 | (unless (y-or-n-p "Send anyway? ") |
| 4541 | (error "Failed to send the message"))))) | 4558 | (error "Failed to send the message"))))) |
| 4559 | ;; Fold too-long header lines. They should be no longer than | ||
| 4560 | ;; 998 octets long. | ||
| 4561 | (message--fold-long-headers) | ||
| 4542 | ;; Let the user do all of the above. | 4562 | ;; Let the user do all of the above. |
| 4543 | (run-hooks 'message-header-hook)) | 4563 | (run-hooks 'message-header-hook)) |
| 4544 | (setq options message-options) | 4564 | (setq options message-options) |
| @@ -4635,6 +4655,14 @@ If you always want Gnus to send messages in one piece, set | |||
| 4635 | (setq message-options options) | 4655 | (setq message-options options) |
| 4636 | (push 'mail message-sent-message-via))) | 4656 | (push 'mail message-sent-message-via))) |
| 4637 | 4657 | ||
| 4658 | (defun message--fold-long-headers () | ||
| 4659 | (goto-char (point-min)) | ||
| 4660 | (while (not (eobp)) | ||
| 4661 | (when (and (looking-at "[^:]+:") | ||
| 4662 | (> (- (line-end-position) (point)) 998)) | ||
| 4663 | (mail-header-fold-field)) | ||
| 4664 | (forward-line 1))) | ||
| 4665 | |||
| 4638 | (defvar sendmail-program) | 4666 | (defvar sendmail-program) |
| 4639 | (defvar smtpmail-smtp-server) | 4667 | (defvar smtpmail-smtp-server) |
| 4640 | (defvar smtpmail-smtp-service) | 4668 | (defvar smtpmail-smtp-service) |
| @@ -5380,16 +5408,13 @@ Otherwise, generate and save a value for `canlock-password' first." | |||
| 5380 | "Process Fcc headers in the current buffer." | 5408 | "Process Fcc headers in the current buffer." |
| 5381 | (let ((case-fold-search t) | 5409 | (let ((case-fold-search t) |
| 5382 | (buf (current-buffer)) | 5410 | (buf (current-buffer)) |
| 5383 | list file | 5411 | (mml-externalize-attachments message-fcc-externalize-attachments) |
| 5384 | (mml-externalize-attachments message-fcc-externalize-attachments)) | 5412 | (file (message-field-value "fcc" t)) |
| 5385 | (save-excursion | 5413 | list) |
| 5386 | (save-restriction | 5414 | (when file |
| 5387 | (message-narrow-to-headers) | 5415 | (with-temp-buffer |
| 5388 | (setq file (message-fetch-field "fcc" t))) | ||
| 5389 | (when file | ||
| 5390 | (set-buffer (get-buffer-create " *message temp*")) | ||
| 5391 | (erase-buffer) | ||
| 5392 | (insert-buffer-substring buf) | 5416 | (insert-buffer-substring buf) |
| 5417 | (message-clone-locals buf) | ||
| 5393 | (message-encode-message-body) | 5418 | (message-encode-message-body) |
| 5394 | (save-restriction | 5419 | (save-restriction |
| 5395 | (message-narrow-to-headers) | 5420 | (message-narrow-to-headers) |
| @@ -5429,8 +5454,7 @@ Otherwise, generate and save a value for `canlock-password' first." | |||
| 5429 | (if (and (file-readable-p file) (mail-file-babyl-p file)) | 5454 | (if (and (file-readable-p file) (mail-file-babyl-p file)) |
| 5430 | (rmail-output file 1 nil t) | 5455 | (rmail-output file 1 nil t) |
| 5431 | (let ((mail-use-rfc822 t)) | 5456 | (let ((mail-use-rfc822 t)) |
| 5432 | (rmail-output file 1 t t)))))) | 5457 | (rmail-output file 1 t t)))))))))) |
| 5433 | (kill-buffer (current-buffer)))))) | ||
| 5434 | 5458 | ||
| 5435 | (defun message-output (filename) | 5459 | (defun message-output (filename) |
| 5436 | "Append this article to Unix/babyl mail file FILENAME." | 5460 | "Append this article to Unix/babyl mail file FILENAME." |
| @@ -5761,7 +5785,7 @@ give as trustworthy answer as possible." | |||
| 5761 | (not (string-match message-bogus-system-names message-user-fqdn))) | 5785 | (not (string-match message-bogus-system-names message-user-fqdn))) |
| 5762 | ;; `message-user-fqdn' seems to be valid | 5786 | ;; `message-user-fqdn' seems to be valid |
| 5763 | message-user-fqdn) | 5787 | message-user-fqdn) |
| 5764 | ((and (string-match message-bogus-system-names sysname)) | 5788 | ((not (string-match message-bogus-system-names sysname)) |
| 5765 | ;; `system-name' returned the right result. | 5789 | ;; `system-name' returned the right result. |
| 5766 | sysname) | 5790 | sysname) |
| 5767 | ;; Try `mail-host-address'. | 5791 | ;; Try `mail-host-address'. |
| @@ -6644,29 +6668,27 @@ OTHER-HEADERS is an alist of header/value pairs. CONTINUE says whether | |||
| 6644 | to continue editing a message already being composed. SWITCH-FUNCTION | 6668 | to continue editing a message already being composed. SWITCH-FUNCTION |
| 6645 | is a function used to switch to and display the mail buffer." | 6669 | is a function used to switch to and display the mail buffer." |
| 6646 | (interactive) | 6670 | (interactive) |
| 6647 | (let ((message-this-is-mail t)) | 6671 | (let ((message-this-is-mail t) |
| 6648 | (unless (message-mail-user-agent) | 6672 | message-buffers) |
| 6649 | (message-pop-to-buffer | 6673 | ;; Search for the existing message buffer if `continue' is non-nil. |
| 6650 | ;; Search for the existing message buffer if `continue' is non-nil. | 6674 | (if (and continue |
| 6651 | (let ((message-generate-new-buffers | 6675 | (setq message-buffers (message-buffers))) |
| 6652 | (when (or (not continue) | 6676 | (pop-to-buffer (car message-buffers)) |
| 6653 | (eq message-generate-new-buffers 'standard) | 6677 | ;; Start a new buffer. |
| 6654 | (functionp message-generate-new-buffers)) | 6678 | (unless (message-mail-user-agent) |
| 6655 | message-generate-new-buffers))) | 6679 | (message-pop-to-buffer (message-buffer-name "mail" to) switch-function)) |
| 6656 | (message-buffer-name "mail" to)) | 6680 | (message-setup |
| 6657 | switch-function)) | 6681 | (nconc |
| 6658 | (message-setup | 6682 | `((To . ,(or to "")) (Subject . ,(or subject ""))) |
| 6659 | (nconc | 6683 | ;; C-h f compose-mail says that headers should be specified as |
| 6660 | `((To . ,(or to "")) (Subject . ,(or subject ""))) | 6684 | ;; (string . value); however all the rest of message expects |
| 6661 | ;; C-h f compose-mail says that headers should be specified as | 6685 | ;; headers to be symbols, not strings (eg message-header-format-alist). |
| 6662 | ;; (string . value); however all the rest of message expects | 6686 | ;; http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html |
| 6663 | ;; headers to be symbols, not strings (eg message-header-format-alist). | 6687 | ;; We need to convert any string input, eg from rmail-start-mail. |
| 6664 | ;; http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html | 6688 | (dolist (h other-headers other-headers) |
| 6665 | ;; We need to convert any string input, eg from rmail-start-mail. | 6689 | (if (stringp (car h)) (setcar h (intern (capitalize (car h))))))) |
| 6666 | (dolist (h other-headers other-headers) | 6690 | yank-action send-actions continue switch-function |
| 6667 | (if (stringp (car h)) (setcar h (intern (capitalize (car h))))))) | 6691 | return-action)))) |
| 6668 | yank-action send-actions continue switch-function | ||
| 6669 | return-action))) | ||
| 6670 | 6692 | ||
| 6671 | ;;;###autoload | 6693 | ;;;###autoload |
| 6672 | (defun message-news (&optional newsgroups subject) | 6694 | (defun message-news (&optional newsgroups subject) |