Changeset 3526 for branches/2.2/lisp/gnus/gnus-msg.el
- Timestamp:
- 10/31/04 15:41:47 (4 years ago)
- Files:
-
- branches/2.2/lisp/gnus/gnus-msg.el (modified) (64 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.2/lisp/gnus/gnus-msg.el
r3505 r3526 1 1 ;;; gnus-msg.el --- mail and post interface for Gnus 2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 3 3 ;; Free Software Foundation, Inc. 4 4 … … 34 34 (require 'message) 35 35 (require 'gnus-art) 36 (require 'gnus-util) 36 37 37 38 (defcustom gnus-post-method 'current … … 55 56 (sexp :tag "Methods" ,gnus-select-method))) 56 57 57 (def vargnus-outgoing-message-group nil58 (defcustom gnus-outgoing-message-group nil 58 59 "*All outgoing messages will be put in this group. 59 60 If you want to store all your outgoing mail and articles in the group … … 64 65 message in, you can set this variable to a function that checks the 65 66 current newsgroup name and then returns a suitable group name (or list 66 of names).") 67 68 (defvar gnus-mailing-list-groups nil 69 "*Regexp matching groups that are really mailing lists. 67 of names)." 68 :group 'gnus-message 69 :type '(choice (string :tag "Group") 70 (function))) 71 72 (defcustom gnus-mailing-list-groups nil 73 "*If non-nil a regexp matching groups that are really mailing lists. 70 74 This is useful when you're reading a mailing list that has been 71 75 gatewayed to a newsgroup, and you want to followup to an article in 72 the group.") 73 74 (defvar gnus-add-to-list nil 75 "*If non-nil, add a `to-list' parameter automatically.") 76 77 (defvar gnus-crosspost-complaint 76 the group." 77 :group 'gnus-message 78 :type '(choice (regexp) 79 (const nil))) 80 81 (defcustom gnus-add-to-list nil 82 "*If non-nil, add a `to-list' parameter automatically." 83 :group 'gnus-message 84 :type 'boolean) 85 86 (defcustom gnus-crosspost-complaint 78 87 "Hi, 79 88 … … 91 100 "Format string to be inserted when complaining about crossposts. 92 101 The first %s will be replaced by the Newsgroups header; 93 the second with the current group name.") 94 95 (defvar gnus-message-setup-hook nil 96 "Hook run after setting up a message buffer.") 97 98 (defvar gnus-bug-create-help-buffer t 99 "*Should we create the *Gnus Help Bug* buffer?") 100 101 (defvar gnus-posting-styles nil 102 "*Alist of styles to use when posting.") 103 104 (defcustom gnus-group-posting-charset-alist 102 the second with the current group name." 103 :group 'gnus-message 104 :type 'string) 105 106 (defcustom gnus-message-setup-hook nil 107 "Hook run after setting up a message buffer." 108 :group 'gnus-message 109 :type 'hook) 110 111 (defcustom gnus-bug-create-help-buffer t 112 "*Should we create the *Gnus Help Bug* buffer?" 113 :group 'gnus-message 114 :type 'boolean) 115 116 (defcustom gnus-posting-styles nil 117 "*Alist of styles to use when posting. 118 See Info node `(gnus)Posting Styles'." 119 :group 'gnus-message 120 :link '(custom-manual "(gnus)Posting Styles") 121 :type '(repeat (cons (choice (regexp) 122 (variable) 123 (list (const header) 124 (string :tag "Header") 125 (regexp :tag "Regexp")) 126 (function) 127 (sexp)) 128 (repeat (list 129 (choice (const signature) 130 (const signature-file) 131 (const organization) 132 (const address) 133 (const x-face-file) 134 (const name) 135 (const body) 136 (symbol) 137 (string :tag "Header")) 138 (choice (string) 139 (function) 140 (variable) 141 (sexp))))))) 142 143 (defcustom gnus-gcc-mark-as-read nil 144 "If non-nil, automatically mark Gcc articles as read." 145 :version "21.4" 146 :group 'gnus-message 147 :type 'boolean) 148 149 (make-obsolete-variable 'gnus-inews-mark-gcc-as-read 150 'gnus-gcc-mark-as-read) 151 152 (defcustom gnus-gcc-externalize-attachments nil 153 "Should local-file attachments be included as external parts in Gcc copies? 154 If it is `all', attach files as external parts; 155 if a regexp and matches the Gcc group name, attach files as external parts; 156 if nil, attach files as normal parts." 157 :version "21.4" 158 :group 'gnus-message 159 :type '(choice (const nil :tag "None") 160 (const all :tag "Any") 161 (string :tag "Regexp"))) 162 163 (gnus-define-group-parameter 164 posting-charset-alist 165 :type list 166 :function-document 167 "Return the permitted unencoded charsets for posting of GROUP." 168 :variable gnus-group-posting-charset-alist 169 :variable-default 105 170 '(("^\\(no\\|fr\\)\\.[^,]*\\(,[ \t\n]*\\(no\\|fr\\)\\.[^,]*\\)*$" iso-8859-1 (iso-8859-1)) 106 171 ("^\\(fido7\\|relcom\\)\\.[^,]*\\(,[ \t\n]*\\(fido7\\|relcom\\)\\.[^,]*\\)*$" koi8-r (koi8-r)) 107 172 (message-this-is-mail nil nil) 108 173 (message-this-is-news nil t)) 174 :variable-document 109 175 "Alist of regexps and permitted unencoded charsets for posting. 110 176 Each element of the alist has the form (TEST HEADER BODY-LIST), where … … 119 185 Note that any value other than nil for HEADER infringes some RFCs, so 120 186 use this option with care." 121 :type '(repeat (list :tag "Permitted unencoded charsets" 122 (choice :tag "Where" 123 (regexp :tag "Group") 124 (const :tag "Mail message" :value message-this-is-mail) 125 (const :tag "News article" :value message-this-is-news)) 126 (choice :tag "Header" 127 (const :tag "None" nil) 128 (symbol :tag "Charset")) 129 (choice :tag "Body" 130 (const :tag "Any" :value t) 131 (const :tag "None" :value nil) 132 (repeat :tag "Charsets" 133 (symbol :tag "Charset"))))) 134 :group 'gnus-charset) 187 :variable-group gnus-charset 188 :variable-type 189 '(repeat (list :tag "Permitted unencoded charsets" 190 (choice :tag "Where" 191 (regexp :tag "Group") 192 (const :tag "Mail message" :value message-this-is-mail) 193 (const :tag "News article" :value message-this-is-news)) 194 (choice :tag "Header" 195 (const :tag "None" nil) 196 (symbol :tag "Charset")) 197 (choice :tag "Body" 198 (const :tag "Any" :value t) 199 (const :tag "None" :value nil) 200 (repeat :tag "Charsets" 201 (symbol :tag "Charset"))))) 202 :parameter-type '(choice :tag "Permitted unencoded charsets" 203 :value nil 204 (repeat (symbol))) 205 :parameter-document "\ 206 List of charsets that are permitted to be unencoded.") 207 208 (defcustom gnus-debug-files 209 '("gnus.el" "gnus-sum.el" "gnus-group.el" 210 "gnus-art.el" "gnus-start.el" "gnus-async.el" 211 "gnus-msg.el" "gnus-score.el" "gnus-win.el" "gnus-topic.el" 212 "gnus-agent.el" "gnus-cache.el" "gnus-srvr.el" 213 "mm-util.el" "mm-decode.el" "nnmail.el" "message.el") 214 "Files whose variables will be reported in `gnus-bug'." 215 :version "21.4" 216 :group 'gnus-message 217 :type '(repeat (string :tag "File"))) 218 219 (defcustom gnus-debug-exclude-variables 220 '(mm-mime-mule-charset-alist 221 nnmail-split-fancy message-minibuffer-local-map) 222 "Variables that should not be reported in `gnus-bug'." 223 :version "21.4" 224 :group 'gnus-message 225 :type '(repeat (symbol :tag "Variable"))) 226 227 (defcustom gnus-discouraged-post-methods 228 '(nndraft nnml nnimap nnmaildir nnmh nnfolder nndir) 229 "A list of back ends that are not used in \"real\" newsgroups. 230 This variable is used only when `gnus-post-method' is `current'." 231 :version "21.4" 232 :group 'gnus-group-foreign 233 :type '(repeat (symbol :tag "Back end"))) 234 235 (defcustom gnus-message-replysign 236 nil 237 "Automatically sign replies to signed messages. 238 See also the `mml-default-sign-method' variable." 239 :group 'gnus-message 240 :type 'boolean) 241 242 (defcustom gnus-message-replyencrypt 243 nil 244 "Automatically encrypt replies to encrypted messages. 245 See also the `mml-default-encrypt-method' variable." 246 :group 'gnus-message 247 :type 'boolean) 248 249 (defcustom gnus-message-replysignencrypted 250 t 251 "Setting this causes automatically encrypted messages to also be signed." 252 :group 'gnus-message 253 :type 'boolean) 254 255 (defcustom gnus-confirm-mail-reply-to-news nil 256 "If non-nil, Gnus requests confirmation when replying to news. 257 This is done because new users often reply by mistake when reading 258 news. 259 This can also be a function receiving the group name as the only 260 parameter which should return non-nil iff a confirmation is needed, or 261 a regexp, in which case a confirmation is asked for iff the group name 262 matches the regexp." 263 :version "21.4" 264 :group 'gnus-message 265 :type '(choice (const :tag "No" nil) 266 (const :tag "Yes" t) 267 (regexp :tag "Iff group matches regexp") 268 (function :tag "Iff function evaluates to non-nil"))) 269 270 (defcustom gnus-confirm-treat-mail-like-news 271 nil 272 "If non-nil, Gnus will treat mail like news with regard to confirmation 273 when replying by mail. See the `gnus-confirm-mail-reply-to-news' variable 274 for fine-tuning this. 275 If nil, Gnus will never ask for confirmation if replying to mail." 276 :version "21.4" 277 :group 'gnus-message 278 :type 'boolean) 279 280 (defcustom gnus-summary-resend-default-address t 281 "If non-nil, Gnus tries to suggest a default address to resend to. 282 If nil, the address field will always be empty after invoking 283 `gnus-summary-resend-message'." 284 :group 'gnus-message 285 :type 'boolean) 135 286 136 287 ;;; Internal variables. … … 139 290 "Inhibit the use of posting styles.") 140 291 292 (defvar gnus-article-yanked-articles nil) 141 293 (defvar gnus-message-buffer "*Mail Gnus*") 142 294 (defvar gnus-article-copy nil) 295 (defvar gnus-check-before-posting nil) 143 296 (defvar gnus-last-posting-server nil) 144 297 (defvar gnus-message-group-art nil) 298 299 (defvar gnus-msg-force-broken-reply-to nil) 145 300 146 301 (defconst gnus-bug-message … … 167 322 (eval-and-compile 168 323 (autoload 'gnus-uu-post-news "gnus-uu" nil t) 324 (autoload 'news-setup "rnewspost") 325 (autoload 'news-reply-mode "rnewspost") 169 326 (autoload 'rmail-dont-reply-to "mail-utils") 170 327 (autoload 'rmail-output "rmailout")) … … 177 334 (gnus-define-keys (gnus-summary-send-map "S" gnus-summary-mode-map) 178 335 "p" gnus-summary-post-news 336 "i" gnus-summary-news-other-window 179 337 "f" gnus-summary-followup 180 338 "F" gnus-summary-followup-with-original … … 186 344 "w" gnus-summary-wide-reply 187 345 "W" gnus-summary-wide-reply-with-original 346 "v" gnus-summary-very-wide-reply 347 "V" gnus-summary-very-wide-reply-with-original 188 348 "n" gnus-summary-followup-to-mail 189 349 "N" gnus-summary-followup-to-mail-with-original … … 191 351 "u" gnus-uu-post-news 192 352 "\M-c" gnus-summary-mail-crosspost-complaint 353 "Br" gnus-summary-reply-broken-reply-to 354 "BR" gnus-summary-reply-broken-reply-to-with-original 193 355 "om" gnus-summary-mail-forward 194 356 "op" gnus-summary-post-forward … … 199 361 "b" gnus-summary-resend-bounced-mail 200 362 ;; "c" gnus-summary-send-draft 201 "r" gnus-summary-resend-message) 363 "r" gnus-summary-resend-message 364 "e" gnus-summary-resend-message-edit) 202 365 203 366 ;;; Internal functions. 367 368 (defun gnus-inews-make-draft () 369 `(lambda () 370 (gnus-inews-make-draft-meta-information 371 ,gnus-newsgroup-name ',gnus-article-reply))) 204 372 205 373 (defvar gnus-article-reply nil) … … 208 376 (buffer (make-symbol "gnus-setup-message-buffer")) 209 377 (article (make-symbol "gnus-setup-message-article")) 378 (yanked (make-symbol "gnus-setup-yanked-articles")) 210 379 (group (make-symbol "gnus-setup-message-group"))) 211 380 `(let ((,winconf (current-window-configuration)) 212 381 (,buffer (buffer-name (current-buffer))) 213 (,article (and gnus-article-reply (gnus-summary-article-number))) 382 (,article gnus-article-reply) 383 (,yanked gnus-article-yanked-articles) 214 384 (,group gnus-newsgroup-name) 215 385 (message-header-setup-hook … … 220 390 (add-hook 'message-header-setup-hook 'gnus-inews-insert-gcc) 221 391 (add-hook 'message-header-setup-hook 'gnus-inews-insert-archive-gcc) 222 (add-hook 'message-mode-hook 'gnus-configure-posting-styles) 392 ;; #### FIXME: for a reason that I did not manage to identify yet, 393 ;; the variable `gnus-newsgroup-name' does not honor a dynamically 394 ;; scoped or setq'ed value from a caller like `C-u gnus-summary-mail'. 395 ;; After evaluation of @forms below, it gets the value we actually want 396 ;; to override, and the posting styles are used. For that reason, I've 397 ;; added an optional argument to `gnus-configure-posting-styles' to 398 ;; make sure that the correct value for the group name is used. -- drv 399 (add-hook 'message-mode-hook 400 (if (memq ,config '(reply-yank reply)) 401 (lambda () 402 (gnus-configure-posting-styles ,group)) 403 (lambda () 404 ;; There may be an old " *gnus article copy*" buffer. 405 (let (gnus-article-copy) 406 (gnus-configure-posting-styles ,group))))) 407 (gnus-pull ',(intern gnus-draft-meta-information-header) 408 message-required-headers) 409 (when (and ,group 410 (not (string= ,group ""))) 411 (push (cons 412 (intern gnus-draft-meta-information-header) 413 (gnus-inews-make-draft)) 414 message-required-headers)) 223 415 (unwind-protect 224 416 (progn 225 417 ,@forms) 226 (gnus-inews-add-send-actions ,winconf ,buffer ,article) 418 (gnus-inews-add-send-actions ,winconf ,buffer ,article ,config 419 ,yanked) 227 420 (setq gnus-message-buffer (current-buffer)) 228 421 (set (make-local-variable 'gnus-message-group-art) … … 234 427 (setq mml-buffer-list mbl) ;; Global value 235 428 (set (make-local-variable 'mml-buffer-list) mbl1);; Local value 429 (gnus-make-local-hook 'kill-buffer-hook) 430 (gnus-make-local-hook 'change-major-mode-hook) 236 431 (add-hook 'change-major-mode-hook 'mml-destroy-buffers nil t) 237 432 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t)) 238 433 (mml-destroy-buffers) 239 434 (setq mml-buffer-list mbl))) 435 (message-hide-headers) 240 436 (gnus-add-buffer) 241 437 (gnus-configure-windows ,config t) 438 (run-hooks 'post-command-hook) 242 439 (set-buffer-modified-p nil)))) 243 440 441 (defun gnus-inews-make-draft-meta-information (group article) 442 (concat "(\"" group "\" " 443 (if article (number-to-string 444 (if (listp article) 445 (car article) 446 article)) "\"\"") 447 ")")) 448 244 449 ;;;###autoload 245 (defun gnus-msg-mail (&rest args) 450 (defun gnus-msg-mail (&optional to subject other-headers continue 451 switch-action yank-action send-actions) 246 452 "Start editing a mail message to be sent. 247 453 Like `message-mail', but with Gnus paraphernalia, particularly the 248 454 Gcc: header for archiving purposes." 249 455 (interactive) 250 (gnus-setup-message 'message 251 (apply 'message-mail args)) 456 (let ((buf (current-buffer)) 457 mail-buf) 458 (gnus-setup-message 'message 459 (message-mail to subject other-headers continue 460 nil yank-action send-actions)) 461 (when switch-action 462 (setq mail-buf (current-buffer)) 463 (switch-to-buffer buf) 464 (apply switch-action mail-buf nil))) 252 465 ;; COMPOSEFUNC should return t if succeed. Undocumented ??? 253 466 t) 254 467 468 (defvar save-selected-window-window) 469 470 ;;;###autoload 471 (defun gnus-button-mailto (address) 472 "Mail to ADDRESS." 473 (set-buffer (gnus-copy-article-buffer)) 474 (gnus-setup-message 'message 475 (message-reply address)) 476 (and (boundp 'save-selected-window-window) 477 (not (window-live-p save-selected-window-window)) 478 (setq save-selected-window-window (selected-window)))) 479 480 ;;;###autoload 481 (defun gnus-button-reply (&optional to-address wide) 482 "Like `message-reply'." 483 (interactive) 484 (gnus-setup-message 'message 485 (message-reply to-address wide)) 486 (and (boundp 'save-selected-window-window) 487 (not (window-live-p save-selected-window-window)) 488 (setq save-selected-window-window (selected-window)))) 489 255 490 ;;;###autoload 256 491 (define-mail-user-agent 'gnus-user-agent 257 'gnus-msg-mail 'message-send-and-exit258 'message-kill-buffer 'message-send-hook)492 'gnus-msg-mail 'message-send-and-exit 493 'message-kill-buffer 'message-send-hook) 259 494 260 495 (defun gnus-setup-posting-charset (group) … … 267 502 (when (or (and (stringp (car elem)) 268 503 (string-match (car elem) group)) 269 (and ( gnus-functionp (car elem))504 (and (functionp (car elem)) 270 505 (funcall (car elem) group)) 271 506 (and (symbolp (car elem)) … … 273 508 (throw 'found (cons (cadr elem) (caddr elem))))))))) 274 509 275 (defun gnus-inews-add-send-actions (winconf buffer article) 276 (make-local-hook 'message-sent-hook) 510 (defun gnus-inews-add-send-actions (winconf buffer article 511 &optional config yanked) 512 (gnus-make-local-hook 'message-sent-hook) 277 513 (add-hook 'message-sent-hook (if gnus-agent 'gnus-agent-possibly-do-gcc 278 514 'gnus-inews-do-gcc) nil t) 279 515 (when gnus-agent 280 ( make-local-hook 'message-header-hook)516 (gnus-make-local-hook 'message-header-hook) 281 517 (add-hook 'message-header-hook 'gnus-agent-possibly-save-gcc nil t)) 282 518 (setq message-post-method … … 285 521 (setq message-newsreader (setq message-mailer (gnus-extended-version))) 286 522 (message-add-action 287 `(set-window-configuration ,winconf) 'exit 'postpone 'kill)288 (message-add-action289 523 `(when (gnus-buffer-exists-p ,buffer) 290 (save-excursion 291 (set-buffer ,buffer) 292 ,(when article 293 `(gnus-summary-mark-article-as-replied ,article)))) 294 'send)) 524 (set-window-configuration ,winconf)) 525 'exit 'postpone 'kill) 526 (let ((to-be-marked (cond 527 (yanked 528 (mapcar 529 (lambda (x) (if (listp x) (car x) x)) yanked)) 530 (article (if (listp article) article (list article))) 531 (t nil)))) 532 (message-add-action 533 `(when (gnus-buffer-exists-p ,buffer) 534 (save-excursion 535 (set-buffer ,buffer) 536 ,(when to-be-marked 537 (if (eq config 'forward) 538 `(gnus-summary-mark-article-as-forwarded ',to-be-marked) 539 `(gnus-summary-mark-article-as-replied ',to-be-marked))))) 540 'send))) 295 541 296 542 (put 'gnus-setup-message 'lisp-indent-function 1) … … 307 553 ;; to local variables leaking. 308 554 (let ((group gnus-newsgroup-name) 555 ;; make sure last viewed article doesn't affect posting styles: 556 (gnus-article-copy) 309 557 (buffer (current-buffer))) 310 558 (unwind-protect … … 318 566 (gnus-group-group-name)) 319 567 "")) 568 ;; #### see comment in gnus-setup-message -- drv 320 569 (gnus-setup-message 'message (message-mail))) 321 570 (save-excursion … … 323 572 (setq gnus-newsgroup-name group))))) 324 573 574 (defun gnus-group-news (&optional arg) 575 "Start composing a news. 576 If ARG, post to group under point. 577 If ARG is 1, prompt for group name to post to. 578 579 This function prepares a news even when using mail groups. This is useful 580 for posting messages to mail groups without actually sending them over the 581 network. The corresponding back end must have a 'request-post method." 582 (interactive "P") 583 ;; We can't `let' gnus-newsgroup-name here, since that leads 584 ;; to local variables leaking. 585 (let ((group gnus-newsgroup-name) 586 ;; make sure last viewed article doesn't affect posting styles: 587 (gnus-article-copy) 588 (buffer (current-buffer))) 589 (unwind-protect 590 (progn 591 (setq gnus-newsgroup-name 592 (if arg 593 (if (= 1 (prefix-numeric-value arg)) 594 (completing-read "Use group: " 595 gnus-active-hashtb nil 596 (gnus-read-active-file-p)) 597 (gnus-group-group-name)) 598 "")) 599 ;; #### see comment in gnus-setup-message -- drv 600 (gnus-setup-message 'message 601 (message-news (gnus-group-real-name gnus-newsgroup-name)))) 602 (save-excursion 603 (set-buffer buffer) 604 (setq gnus-newsgroup-name group))))) 605 325 606 (defun gnus-group-post-news (&optional arg) 326 "Start composing a news message. 327 If ARG, post to the group under point. 328 If ARG is 1, prompt for a group name." 607 "Start composing a message (a news by default). 608 If ARG, post to group under point. If ARG is 1, prompt for group name. 609 Depending on the selected group, the message might be either a mail or 610 a news." 329 611 (interactive "P") 330 612 ;; Bind this variable here to make message mode hooks work ok. … … 335 617 (gnus-read-active-file-p)) 336 618 (gnus-group-group-name)) 337 ""))) 619 "")) 620 ;; make sure last viewed article doesn't affect posting styles: 621 (gnus-article-copy)) 622 (gnus-post-news 'post gnus-newsgroup-name nil nil nil nil 623 (string= gnus-newsgroup-name "")))) 624 625 (defun gnus-summary-mail-other-window (&optional arg) 626 "Start composing a mail in another window. 627 Use the posting of the current group by default. 628 If ARG, don't do that. If ARG is 1, prompt for group name to find the 629 posting style." 630 (interactive "P") 631 ;; We can't `let' gnus-newsgroup-name here, since that leads 632 ;; to local variables leaking. 633 (let ((group gnus-newsgroup-name) 634 ;; make sure last viewed article doesn't affect posting styles: 635 (gnus-article-copy) 636 (buffer (current-buffer))) 637 (unwind-protect 638 (progn 639 (setq gnus-newsgroup-name 640 (if arg 641 (if (= 1 (prefix-numeric-value arg)) 642 (completing-read "Use group: " 643 gnus-active-hashtb nil 644 (gnus-read-active-file-p)) 645 "") 646 gnus-newsgroup-name)) 647 ;; #### see comment in gnus-setup-message -- drv 648 (gnus-setup-message 'message (message-mail))) 649 (save-excursion 650 (set-buffer buffer) 651 (setq gnus-newsgroup-name group))))) 652 653 (defun gnus-summary-news-other-window (&optional arg) 654 "Start composing a news in another window. 655 Post to the current group by default. 656 If ARG, don't do that. If ARG is 1, prompt for group name to post to. 657 658 This function prepares a news even when using mail groups. This is useful 659 for posting messages to mail groups without actually sending them over the 660 network. The corresponding back end must have a 'request-post method." 661 (interactive "P") 662 ;; We can't `let' gnus-newsgroup-name here, since that leads 663 ;; to local variables leaking. 664 (let ((group gnus-newsgroup-name) 665 ;; make sure last viewed article doesn't affect posting styles: 666 (gnus-article-copy) 667 (buffer (current-buffer))) 668 (unwind-protect 669 (progn 670 (setq gnus-newsgroup-name 671 (if arg 672 (if (= 1 (prefix-numeric-value arg)) 673 (completing-read "Use group: " 674 gnus-active-hashtb nil 675 (gnus-read-active-file-p)) 676 "") 677 gnus-newsgroup-name)) 678 ;; #### see comment in gnus-setup-message -- drv 679 (gnus-setup-message 'message 680 (progn 681 (message-news (gnus-group-real-name gnus-newsgroup-name)) 682 (set (make-local-variable 'gnus-discouraged-post-methods) 683 (delq 684 (car (gnus-find-method-for-group gnus-newsgroup-name)) 685 (copy-sequence gnus-discouraged-post-methods)))))) 686 (save-excursion 687 (set-buffer buffer) 688 (setq gnus-newsgroup-name group))))) 689 690 (defun gnus-summary-post-news (&optional arg) 691 "Start composing a message. Post to the current group by default. 692 If ARG, don't do that. If ARG is 1, prompt for a group name to post to. 693 Depending on the selected group, the message might be either a mail or 694 a news." 695 (interactive "P") 696 ;; Bind this variable here to make message mode hooks work ok. 697 (let ((gnus-newsgroup-name 698 (if arg 699 (if (= 1 (prefix-numeric-value arg)) 700 (completing-read "Newsgroup: " gnus-active-hashtb nil 701 (gnus-read-active-file-p)) 702 "") 703 gnus-newsgroup-name)) 704 ;; make sure last viewed article doesn't affect posting styles: 705 (gnus-article-copy)) 338 706 (gnus-post-news 'post gnus-newsgroup-name))) 339 707 340 (defun gnus-summary-post-news ()341 "Start composing a news message."342 (interactive)343 (gnus-post-news 'post gnus-newsgroup-name))344 708 345 709 (defun gnus-summary-followup (yank &optional force-news) 346 710 "Compose a followup to an article. 347 If prefix argument YANK is non-nil, original article is yanked automatically." 711 If prefix argument YANK is non-nil, the original article is yanked 712 automatically. 713 YANK is a list of elements, where the car of each element is the 714 article number, and the cdr is the string to be yanked." 348 715 (interactive 349 716 (list (and current-prefix-arg 350 717 (gnus-summary-work-articles 1)))) 351 718 (when yank 352 (gnus-summary-goto-subject (car yank))) 719 (gnus-summary-goto-subject 720 (if (listp (car yank)) 721 (caar yank) 722 (car yank)))) 353 723 (save-window-excursion 354 724 (gnus-summary-select-article)) … … 358 728 (gnus-post-news nil gnus-newsgroup-name 359 729 headers gnus-article-buffer 360 yank nil force-news))) 730 yank nil force-news) 731 (gnus-summary-handle-replysign))) 361 732 362 733 (defun gnus-summary-followup-with-original (n &optional force-news) 363 "Compose a followup to an article and include the original article." 734 "Compose a followup to an article and include the original article. 735 The text in the region will be yanked. If the region isn't 736 active, the entire article will be yanked." 364 737 (interactive "P") 365 738 (gnus-summary-followup (gnus-summary-work-articles n) force-news)) … … 378 751 379 752 (defun gnus-inews-yank-articles (articles) 380 (let (beg article )753 (let (beg article yank-string) 381 754 (message-goto-body) 382 755 (while (setq article (pop articles)) 756 (when (listp article) 757 (setq yank-string (nth 1 article) 758 article (nth 0 article))) 383 759 (save-window-excursion 384 760 (set-buffer gnus-summary-buffer) 385 761 (gnus-summary-select-article nil nil nil article) 386 762 (gnus-summary-remove-process-mark article)) 387 (gnus-copy-article-buffer )763 (gnus-copy-article-buffer nil yank-string) 388 764 (let ((message-reply-buffer gnus-article-copy) 389 (message-reply-headers gnus-current-headers)) 765 (message-reply-headers 766 ;; The headers are decoded. 767 (with-current-buffer gnus-article-copy 768 (save-restriction 769 (nnheader-narrow-to-headers) 770 (nnheader-parse-naked-head))))) 390 771 (message-yank-original) 391 772 (setq beg (or beg (mark t)))) … … 404 785 (message-post-method 405 786 `(lambda (arg) 406 (gnus-post-method ( not (eq symp 'a)) ,gnus-newsgroup-name)))787 (gnus-post-method (eq ',symp 'a) ,gnus-newsgroup-name))) 407 788 article) 408 789 (while (setq article (pop articles)) … … 436 817 437 818 438 (defun gnus-copy-article-buffer (&optional article-buffer )819 (defun gnus-copy-article-buffer (&optional article-buffer yank-string) 439 820 ;; make a copy of the article buffer with all text properties removed 440 821 ;; this copy is in the buffer gnus-article-copy. … … 452 833 (save-excursion 453 834 (set-buffer article-buffer) 454 (save-restriction 455 ;; Copy over the (displayed) article buffer, delete 456 ;; hidden text and remove text properties. 457 (widen) 458 (copy-to-buffer gnus-article-copy (point-min) (point-max)) 459 (set-buffer gnus-article-copy) 460 (gnus-article-delete-text-of-type 'annotation) 461 (gnus-remove-text-with-property 'gnus-prev) 462 (gnus-remove-text-with-property 'gnus-next) 463 (insert 464 (prog1 465 (buffer-substring-no-properties (point-min) (point-max)) 466 (erase-buffer))) 467 ;; Find the original headers. 468 (set-buffer gnus-original-article-buffer) 469 (goto-char (point-min)) 470 (while (looking-at message-unix-mail-delimiter) 471 (forward-line 1)) 472 (setq beg (point)) 473 (setq end (or (search-forward "\n\n" nil t) (point))) 474 ;; Delete the headers from the displayed articles. 475 (set-buffer gnus-article-copy) 476 (delete-region (goto-char (point-min)) 477 (or (search-forward "\n\n" nil t) (point-max))) 478 ;; Insert the original article headers. 479 (insert-buffer-substring gnus-original-article-buffer beg end) 480 (article-decode-encoded-words))) 835 (let ((gnus-newsgroup-charset (or gnus-article-charset 836 gnus-newsgroup-charset)) 837 (gnus-newsgroup-ignored-charsets 838 (or gnus-article-ignored-charsets 839 gnus-newsgroup-ignored-charsets))) 840 (save-restriction 841 ;; Copy over the (displayed) article buffer, delete 842 ;; hidden text and remove text properties. 843 (widen) 844 (copy-to-buffer gnus-article-copy (point-min) (point-max)) 845 (set-buffer gnus-article-copy) 846 (when yank-string 847 (message-goto-body) 848 (delete-region (point) (point-max)) 849 (insert yank-string)) 850 (gnus-article-delete-text-of-type 'annotation) 851 (gnus-remove-text-with-property 'gnus-prev) 852 (gnus-remove-text-with-property 'gnus-next) 853 (gnus-remove-text-with-property 'gnus-decoration) 854 (insert 855 (prog1 856 (buffer-substring-no-properties (point-min) (point-max)) 857 (erase-buffer))) 858 ;; Find the original headers. 859 (set-buffer gnus-original-article-buffer) 860 (goto-char (point-min)) 861 (while (looking-at message-unix-mail-delimiter) 862 (forward-line 1)) 863 (let ((mail-header-separator "")) 864 (setq beg (point) 865 end (or (message-goto-body) 866 ;; There may be just a header. 867 (point-max)))) 868 ;; Delete the headers from the displayed articles. 869 (set-buffer gnus-article-copy) 870 (let ((mail-header-separator "")) 871 (delete-region (goto-char (point-min)) 872 (or (message-goto-body) (point-max)))) 873 ;; Insert the original article headers. 874 (insert-buffer-substring gnus-original-article-buffer beg end) 875 ;; Decode charsets. 876 (let ((gnus-article-decode-hook 877 (delq 'article-decode-charset 878 (copy-sequence gnus-article-decode-hook)))) 879 (run-hooks 'gnus-article-decode-hook))))) 481 880 gnus-article-copy))) 482 881 … … 485 884 (when article-buffer 486 885 (gnus-copy-article-buffer)) 487 (let ((gnus-article-reply article-buffer) 886 (let ((gnus-article-reply (and article-buffer (gnus-summary-article-number))) 887 (gnus-article-yanked-articles yank) 488 888 (add-to-list gnus-add-to-list)) 489 889 (gnus-setup-message (cond (yank 'reply-yank) … … 496 896 newsgroup-p) 497 897 (when group 498 (setq to-address (gnus- group-find-parameter group 'to-address)898 (setq to-address (gnus-parameter-to-address group) 499 899 to-group (gnus-group-find-parameter group 'to-group) 500 to-list (gnus- group-find-parameter group 'to-list)900 to-list (gnus-parameter-to-list group) 501 901 newsgroup-p (gnus-group-find-parameter group 'newsgroup) 502 902 mailing-list (when gnus-mailing-list-groups … … 510 910 (and (gnus-news-group-p 511 911 (or pgroup gnus-newsgroup-name) 512 (if header (mail-header-number header) 513 gnus-current-article)) 912 (or header gnus-current-article)) 514 913 (not mailing-list) 515 914 (not to-list) … … 517 916  
