Subject: Re: bug#5642: Reporting a bug loads many Gnus libraries

From: Glenn Morris <[email-masked]>
Date: Thu, 25 Feb 2010 16:12:37 -0500

Glenn Morris wrote:

> AFAICS, this is all due to the call to gnus-setup-posting-charset in
> message-send-mail.

Here are two alternative solutions to this.

(Fun-fact: requiring gnus-msg loads 59 libraries.)

Solution 1: (note, gnus-s-p-c is only used in message and mml)

*** lisp/gnus/mml.el	2010-01-13 08:35:10 +0000
--- lisp/gnus/mml.el	2010-02-25 20:59:43 +0000
***************
*** 35,41 ****
  (eval-when-compile (require 'cl))
  
  (autoload 'message-make-message-id "message")
! (autoload 'gnus-setup-posting-charset "gnus-msg")
  (autoload 'gnus-make-local-hook "gnus-util")
  (autoload 'message-fetch-field "message")
  (autoload 'message-mark-active-p "message")
--- 35,41 ----
  (eval-when-compile (require 'cl))
  
  (autoload 'message-make-message-id "message")
! (declare-function gnus-setup-posting-charset "gnus-msg" (group))
  (autoload 'gnus-make-local-hook "gnus-util")
  (autoload 'message-fetch-field "message")
  (autoload 'message-mark-active-p "message")
***************
*** 1445,1450 ****
--- 1445,1451 ----
    (setq mml-preview-buffer (generate-new-buffer
  			    (concat (if raw "*Raw MIME preview of "
  				      "*MIME preview of ") (buffer-name))))
+   (require 'gnus-msg)		      ; for gnus-setup-posting-charset
    (save-excursion
      (let* ((buf (current-buffer))
  	   (message-options message-options)

Solution 2:

*** lisp/gnus/message.el	2010-02-24 03:12:54 +0000
--- lisp/gnus/message.el	2010-02-25 20:55:53 +0000
***************
*** 4417,4423 ****
  	 (mailbuf (current-buffer))
  	 (message-this-is-mail t)
  	 (message-posting-charset
! 	  (if (fboundp 'gnus-setup-posting-charset)
  	      (gnus-setup-posting-charset nil)
  	    message-posting-charset))
  	 (headers message-required-mail-headers))
--- 4422,4429 ----
  	 (mailbuf (current-buffer))
  	 (message-this-is-mail t)
  	 (message-posting-charset
! 	  (if (and (fboundp 'gnus-setup-posting-charset)
! 		   (boundp 'gnus-group-posting-charset-alist))
  	      (gnus-setup-posting-charset nil)
  	    message-posting-charset))
  	 (headers message-required-mail-headers))