diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 9ce35cece4..012aec0067 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4477,16 +4477,24 @@ message-send-mail-partially (declare-function hashcash-wait-async "hashcash" (&optional buffer)) -(defun message--check-continuation-headers () - (message-check 'continuation-headers +(defun message--check-continuation-headers (&optional errorp) + "Check for continuation headers and possibly fix. +Return t if no fixes are necessary. Prompt the user about fixing +continuation lines and/or sending without fixing. If user opts +not to send, raise an error if ERRORP is non-nil, otherwise +return nil." + (catch 'check (goto-char (point-min)) (while (re-search-forward "^[^ \t\n][^ \t\n:]*[ \t\n]" nil t) (goto-char (match-beginning 0)) (if (y-or-n-p "Fix continuation lines? ") (insert " ") - (forward-line 1) - (unless (y-or-n-p "Send anyway? ") - (error "Failed to send the message")))))) + (forward-line 1) + (unless (y-or-n-p "Send anyway? ") + (if errorp + (error "Failed to send the message") + (throw 'check nil))))) + t)) (defun message--send-mail-maybe-partially () (if (or (not message-send-mail-partially-limit) @@ -4571,7 +4579,8 @@ message-send-mail (if news nil message-deletable-headers))) (message-generate-headers headers)) ;; Check continuation headers. - (message--check-continuation-headers) + (message-check 'continuation-headers + (message--check-continuation-headers 'error)) (message--fold-long-headers) ;; Let the user do all of the above. (run-hooks 'message-header-hook)) @@ -5166,7 +5175,8 @@ message-check-news-header-syntax (if (= (length errors) 1) "this" "these") (if (= (length errors) 1) "" "s") (mapconcat 'identity errors ", "))))))) - (message--check-continuation-headers) + (message-check 'continuation-headers + (message--check-continuation-headers)) ;; Check the Newsgroups & Followup-To headers for syntax errors. (message-check 'valid-newsgroups (let ((case-fold-search t)