X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/0b43140039de6594305469f9e90e822fee122dbf..1c4594866335a3f7fae1d65e41f2564839b5cb02:/lisp/gnuspost.el diff --git a/lisp/gnuspost.el b/lisp/gnuspost.el index ea2a0c97ee..441feb245d 100644 --- a/lisp/gnuspost.el +++ b/lisp/gnuspost.el @@ -116,10 +116,10 @@ If prefix argument YANK is non-nil, original article is yanked automatically." ;;; Post a News using NNTP ;;;###autoload -(fset 'sendnews 'gnus-post-news) +(defalias 'sendnews 'gnus-post-news) ;;;###autoload -(fset 'postnews 'gnus-post-news) +(defalias 'postnews 'gnus-post-news) ;;;###autoload (defun gnus-post-news () @@ -353,24 +353,43 @@ original message into it." (widen) (goto-char (point-min)) (run-hooks 'news-inews-hook) - ;; Mail the message too if To: or Cc: exists. - (if (save-restriction - (narrow-to-region - (point-min) - (progn + (save-restriction + (narrow-to-region + (point-min) + (progn + (goto-char (point-min)) + (search-forward (concat "\n" mail-header-separator "\n")) + (point))) + + ;; Correct newsgroups field: change sequence of spaces to comma and + ;; eliminate spaces around commas. Eliminate imbedded line breaks. + (goto-char (point-min)) + (if (search-forward-regexp "^Newsgroups: +" nil t) + (save-restriction + (narrow-to-region + (point) + (if (re-search-forward "^[^ \t]" nil 'end) + (match-beginning 0) + (point-max))) (goto-char (point-min)) - (search-forward (concat "\n" mail-header-separator "\n")) - (point))) - (or (mail-fetch-field "to" nil t) - (mail-fetch-field "cc" nil t))) - (if gnus-mail-send-method - (progn - (message "Sending via mail...") - (funcall gnus-mail-send-method) - (message "Sending via mail... done")) - (ding) - (message "No mailer defined. To: and/or Cc: fields ignored.") - (sit-for 1))) + (replace-regexp "\n[ \t]+" " ") ;No line breaks (too confusing) + (goto-char (point-min)) + (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",") + )) + + ;; Mail the message too if To: or Cc: exists. + (if (or (mail-fetch-field "to" nil t) + (mail-fetch-field "cc" nil t)) + (if gnus-mail-send-method + (progn + (message "Sending via mail...") + (widen) + (funcall gnus-mail-send-method) + (message "Sending via mail... done")) + (ding) + (message "No mailer defined. To: and/or Cc: fields ignored.") + (sit-for 1)))) + ;; Send to NNTP server. (message "Posting to USENET...") (if (gnus-inews-article) @@ -417,7 +436,7 @@ original message into it." (ding) (message "This article is not yours.")) ;; Make control article. (set-buffer (get-buffer-create " *GNUS-canceling*")) - (buffer-flush-undo (current-buffer)) + (buffer-disable-undo (current-buffer)) (erase-buffer) (insert "Newsgroups: " newsgroups "\n" "Subject: cancel " message-id "\n" @@ -448,7 +467,7 @@ original message into it." (tmpbuf (get-buffer-create " *GNUS-posting*"))) (save-excursion (set-buffer tmpbuf) - (buffer-flush-undo (current-buffer)) + (buffer-disable-undo (current-buffer)) (erase-buffer) (insert-buffer-substring artbuf) ;; Remove the header separator. @@ -558,7 +577,7 @@ Signature file is specified by the variable gnus-signature-file." (if (file-exists-p signature) (progn (goto-char (point-max)) - (insert "--\n") + (insert "-- \n") (insert-file-contents signature))) )))))) @@ -609,7 +628,8 @@ a program specified by the rest of the value." (if (and gnus-author-copy-saver (not (eq gnus-author-copy-saver 'rmail-output))) (funcall gnus-author-copy-saver fcc-file) - (if (and (file-readable-p fcc-file) (rmail-file-p fcc-file)) + (if (and (file-readable-p fcc-file) + (mail-file-babyl-p fcc-file)) (gnus-output-to-rmail fcc-file) (rmail-output fcc-file 1 t t))) ))