From 38b6ed1edc9978d3fb7ecd5df2afa81c6064f3c9 Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Thu, 30 Jan 2020 11:27:55 -0500 Subject: [PATCH] prune the overly cavalier "kill all gnus buffers exit" * lisp/gnus/mail-source.el (mail-source-call-script): Require gnus for `gnus-get-buffer-create', following the pattern in the file. * lisp/gnus/message.el: Autoload `gnus-get-buffer-create'. * lisp/gnus/mm-archive.el: Likewise. * lisp/gnus/mml2015.el: Likewise (the file autoloads other gnus functions). * lisp/gnus/nnheader.el: Likewise. * lisp/gnus/mml1991.el (mml1991-mailcrypt-sign, mml1991-mailcrypt-encrypt): Revert the patch, use `get-buffer-create' instead of `gnus-get-buffer-create'. * lisp/gnus/smime.el (smime-new-details-buffer, smime): smime-certificate-info): Likewise. * lisp/gnus/spam-stat.el (spam-stat-store-current-buffer): Likewise. --- lisp/gnus/mail-source.el | 2 ++ lisp/gnus/message.el | 1 + lisp/gnus/mm-archive.el | 1 + lisp/gnus/mml1991.el | 4 ++-- lisp/gnus/mml2015.el | 5 ++++- lisp/gnus/nnheader.el | 2 ++ lisp/gnus/smime.el | 6 +++--- lisp/gnus/spam-stat.el | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index bda321fcc48..f5b68789b85 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el @@ -740,7 +740,9 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile) (when delay (sleep-for delay))) +(declare-function gnus-get-buffer-create "gnus" (name)) (defun mail-source-call-script (script) + (require 'gnus) (let ((background nil) (stderr (gnus-get-buffer-create " *mail-source-stderr*")) result) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index c61fb5ae588..3abeec7e2f2 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1986,6 +1986,7 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'." (autoload 'gnus-delay-article "gnus-delay") (autoload 'gnus-extract-address-components "gnus-util") (autoload 'gnus-find-method-for-group "gnus") +(autoload 'gnus-get-buffer-create "gnus") (autoload 'gnus-group-name-charset "gnus-group") (autoload 'gnus-group-name-decode "gnus-group") (autoload 'gnus-groups-from-server "gnus") diff --git a/lisp/gnus/mm-archive.el b/lisp/gnus/mm-archive.el index 61eec859791..71676c12a46 100644 --- a/lisp/gnus/mm-archive.el +++ b/lisp/gnus/mm-archive.el @@ -24,6 +24,7 @@ (require 'mm-decode) (autoload 'gnus-recursive-directory-files "gnus-util") +(autoload 'gnus-get-buffer-create "gnus") (autoload 'mailcap-extension-to-mime "mailcap") (defvar mm-archive-decoders diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el index c777053dcd5..8be1b84e52f 100644 --- a/lisp/gnus/mml1991.el +++ b/lisp/gnus/mml1991.el @@ -85,7 +85,7 @@ Whether the passphrase is cached at all is controlled by (defun mml1991-mailcrypt-sign (cont) (let ((text (current-buffer)) headers signature - (result-buffer (gnus-get-buffer-create "*GPG Result*"))) + (result-buffer (get-buffer-create "*GPG Result*"))) ;; Save MIME Content[^ ]+: headers from signing (goto-char (point-min)) (while (looking-at "^Content[^ ]+:") (forward-line)) @@ -130,7 +130,7 @@ Whether the passphrase is cached at all is controlled by 'not)))) 'never)) cipher - (result-buffer (gnus-get-buffer-create "*GPG Result*"))) + (result-buffer (get-buffer-create "*GPG Result*"))) ;; Strip MIME Content[^ ]: headers since it will be ASCII ARMORED (goto-char (point-min)) (while (looking-at "^Content[^ ]+:") (forward-line)) diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index 1c4213d888e..d1d150ad2ee 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el @@ -293,6 +293,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (substring alg (match-end 0)) alg)))) +(autoload 'gnus-get-buffer-create "gnus") + (defun mml2015-mailcrypt-verify (handle ctl) (catch 'error (let (part) @@ -725,6 +727,8 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." (autoload 'epg-expand-group "epg-config") (autoload 'epa-select-keys "epa") +(autoload 'gnus-create-image "gnus-util") + (defun mml2015-epg-key-image (key-id) "Return the image of a key, if any." (with-temp-buffer @@ -949,7 +953,6 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." ;;; General wrapper (autoload 'gnus-buffer-live-p "gnus-util") -(autoload 'gnus-get-buffer-create "gnus") (defun mml2015-clean-buffer () (if (gnus-buffer-live-p mml2015-result-buffer) diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index e124bf1f6a9..199d5241973 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -502,6 +502,8 @@ the line could be found." "Coding system used in file backends of Gnus.") (defvar nnheader-callback-function nil) +(autoload 'gnus-get-buffer-create "gnus") + (defun nnheader-init-server-buffer () "Initialize the Gnus-backend communication buffer." (unless (gnus-buffer-live-p nntp-server-buffer) diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index 2ae96782712..fe6daf6b037 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -477,7 +477,7 @@ in the buffer specified by `smime-details-buffer'." ;; Various operations (defun smime-new-details-buffer () - (with-current-buffer (gnus-get-buffer-create smime-details-buffer) + (with-current-buffer (get-buffer-create smime-details-buffer) (erase-buffer))) (defun smime-pkcs7-region (b e) @@ -645,7 +645,7 @@ The following commands are available: (defun smime-certificate-info (certfile) (interactive "fCertificate file: ") - (let ((buffer (gnus-get-buffer-create (format "*certificate %s*" certfile)))) + (let ((buffer (get-buffer-create (format "*certificate %s*" certfile)))) (switch-to-buffer buffer) (erase-buffer) (call-process smime-openssl-program nil buffer 'display @@ -670,7 +670,7 @@ The following commands are available: "Go to the SMIME buffer." (interactive) (unless (get-buffer smime-buffer) - (with-current-buffer (gnus-get-buffer-create smime-buffer) + (with-current-buffer (get-buffer-create smime-buffer) (smime-mode))) (smime-draw-buffer) (switch-to-buffer smime-buffer)) diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el index 2681185000c..8a4161e7acd 100644 --- a/lisp/gnus/spam-stat.el +++ b/lisp/gnus/spam-stat.el @@ -234,7 +234,7 @@ This is set by hooking into Gnus.") (defun spam-stat-store-current-buffer () "Store a copy of the current buffer in `spam-stat-buffer'." (let ((buf (current-buffer))) - (with-current-buffer (gnus-get-buffer-create spam-stat-buffer-name) + (with-current-buffer (get-buffer-create spam-stat-buffer-name) (erase-buffer) (insert-buffer-substring buf) (setq spam-stat-buffer (current-buffer))))) -- 2.39.2