1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* lisp/gnus: Misc simplifications found during conversion to lexical

* lisp/gnus/nnoo.el (noo-import-1, nnoo-define-skeleton-1): Use `dolist`.
(noo-map-functions, nnoo-define-basics): Directly emit the code rather than
going through an intermediate function; this also avoids the use of `eval`.
(noo-map-functions-1, nnoo-define-basics-1): Delete functions,
folded into their corresponding macro.

* lisp/gnus/gmm-utils.el (gmm-tool-bar-from-list): Demote `eval` to
`symbol-value`.

* lisp/gnus/gnus-art.el (gnus-button-handle-describe-key): Avoid `eval`
since `kbd` is a function nowadays.
(gnus-treat-part-number): Rename from `part-number`.
(gnus-treat-total-parts): Rename from `total-parts`.
(gnus-treat-article, gnus-treat-predicate): Adjust accordingly.

* lisp/gnus/gnus-cache.el (gnus-agent-load-alist): Use `declare-function`.

* lisp/gnus/gnus-group.el (gnus-cache-active-hashtb): Use `defvar`.
(gnus-group-iterate): Make it a normal function since lexical scoping
avoids the risk of name capture anyway.
(gnus-group-delete-articles): Actually use the `oldp` arg.

* lisp/gnus/gnus-html.el (gnus-html-wash-images): Fix debug message so
it's emitted after the `url` var it prints is actually initialized.
And avoid `setq` while we're at it.

* lisp/gnus/gnus-msg.el (gnus-group-mail, gnus-group-news)
(gnus-summary-mail-other-window, gnus-summary-news-other-window):
Merge `let`s using `let*`.

* lisp/gnus/gnus-spec.el (gnus-update-format-specifications):
Tighten the scope of `buffer`, and tighten a regexp.
(gnus-parse-simple-format): Reduce code duplication.

* lisp/gnus/gnus-start.el (gnus-child-mode): Don't `defvar` it since we
never use that variable and accordingly don't define it as a minor mode.

* lisp/gnus/gnus-util.el (gnus-byte-compile): Simplify so it obeys
`gnus-use-byte-compile` not just on the first call.
(iswitchb-minibuffer-setup): Declare.

* lisp/gnus/mail-source.el (mail-source-bind-1)
(mail-source-bind-common-1): Use `mapcar`.
(mail-source-set-common-1): Use `dolist`.
(display-time-event-handler): Declare.

* lisp/gnus/mml-smime.el (mml-smime-epg-verify): Reduce code duplication.

* lisp/gnus/mml.el (mml-parse-1): Reduce code duplication.

* lisp/gnus/mml2015.el (mml2015-epg-verify): Reduce code duplication.

* lisp/gnus/nnmail.el (nnmail-get-split-group): Tighten regexp.
(nnmail-split-it): Reduce code duplication.

* lisp/gnus/nnweb.el (nnweb-request-article): Avoid `setq`.

* lisp/gnus/spam.el (BBDB): Use the `noerror` arg of `require`, and
define all the functions for BBDB regardless if the require succeeded.
(spam-exists-in-BBDB-p): Don't inline, not worth it.
This commit is contained in:
Stefan Monnier 2021-01-30 16:45:25 -05:00
parent acf4ec23d9
commit 9be4f41b42
23 changed files with 367 additions and 391 deletions

View file

@ -610,19 +610,19 @@ If ARG is 1, prompt for a group name to find the posting style."
(interactive "P")
;; We can't `let' gnus-newsgroup-name here, since that leads
;; to local variables leaking.
(let ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer)))
(let ((gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read
"Use posting style of group"
nil (gnus-read-active-file-p))
(gnus-group-group-name))
"")))
(gnus-setup-message 'message (message-mail)))))
(let* ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer))
(gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read
"Use posting style of group"
nil (gnus-read-active-file-p))
(gnus-group-group-name))
"")))
(gnus-setup-message 'message (message-mail))))
(defun gnus-group-news (&optional arg)
"Start composing a news.
@ -635,21 +635,21 @@ network. The corresponding back end must have a `request-post' method."
(interactive "P")
;; We can't `let' gnus-newsgroup-name here, since that leads
;; to local variables leaking.
(let ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer)))
(let ((gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read "Use group"
nil
(gnus-read-active-file-p))
(gnus-group-group-name))
"")))
(gnus-setup-message
'message
(message-news (gnus-group-real-name gnus-newsgroup-name))))))
(let* ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer))
(gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read "Use group"
nil
(gnus-read-active-file-p))
(gnus-group-group-name))
"")))
(gnus-setup-message
'message
(message-news (gnus-group-real-name gnus-newsgroup-name)))))
(defun gnus-group-post-news (&optional arg)
"Start composing a message (a news by default).
@ -678,19 +678,19 @@ posting style."
(interactive "P")
;; We can't `let' gnus-newsgroup-name here, since that leads
;; to local variables leaking.
(let ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer)))
(let ((gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read "Use group"
nil
(gnus-read-active-file-p))
"")
gnus-newsgroup-name)))
(gnus-setup-message 'message (message-mail)))))
(let* ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer))
(gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read "Use group"
nil
(gnus-read-active-file-p))
"")
gnus-newsgroup-name)))
(gnus-setup-message 'message (message-mail))))
(defun gnus-summary-news-other-window (&optional arg)
"Start composing a news in another window.
@ -703,26 +703,26 @@ network. The corresponding back end must have a `request-post' method."
(interactive "P")
;; We can't `let' gnus-newsgroup-name here, since that leads
;; to local variables leaking.
(let ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer)))
(let ((gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read "Use group"
nil
(gnus-read-active-file-p))
"")
gnus-newsgroup-name)))
(gnus-setup-message
'message
(progn
(message-news (gnus-group-real-name gnus-newsgroup-name))
(setq-local gnus-discouraged-post-methods
(remove
(car (gnus-find-method-for-group gnus-newsgroup-name))
gnus-discouraged-post-methods)))))))
(let* ((group gnus-newsgroup-name)
;; make sure last viewed article doesn't affect posting styles:
(gnus-article-copy)
(buffer (current-buffer))
(gnus-newsgroup-name
(if arg
(if (= 1 (prefix-numeric-value arg))
(gnus-group-completing-read "Use group"
nil
(gnus-read-active-file-p))
"")
gnus-newsgroup-name)))
(gnus-setup-message
'message
(progn
(message-news (gnus-group-real-name gnus-newsgroup-name))
(setq-local gnus-discouraged-post-methods
(remove
(car (gnus-find-method-for-group gnus-newsgroup-name))
gnus-discouraged-post-methods))))))
(defun gnus-summary-post-news (&optional arg)
"Start composing a message. Post to the current group by default.