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

* lisp/gnus/gnus-sum.el: Prepare for lexical-binding

Add defvars for all the gnus-tmp-*.
(gnus-summary-make-local-variables): Move let binding to avoid setq.
(gnus-set-global-variables): Use dolist.
(gnus-summary-from-or-to-or-newsgroups, gnus-summary-insert-line)
(gnus-summary-insert-dummy-line): Avoid dynbind args.
(gnus-build-old-threads): Remove unused var 'id'.
(gnus-nov-parse-line): Remove unused var 'buffer'.
(gnus-thread-header): Prepare it for a lexbind world.
(gnus-adjust-marked-articles): Remove unused var 'marks'.
(gnus-mark-xrefs-as-read): Remove unused var 'idlist'.
(gnus-summary-display-article): Erase&widen before mm-enable-multibyte.
(gnus-summary-better-unread-subject): Remove unused var 'score'.
(gnus-summary-find-matching): Remove unused var 'd'.
(ps-right-header, ps-left-header, shr-ignore-cache): Declare vars.
(gnus-summary-idna-message, gnus-summary-morse-message)
(gnus-summary-sort-by-original):
Fix interactive spec since we don't actually use any prefix arg.
(gnus-summary-move-article, gnus-read-move-group-name): Use user-error.
(gnus-summary-move-article): Use dolist.
(gnus-summary-edit-article): Fix unquoting.
(gnus-summary-highlight-line-0, gnus-summary-highlight-line):
Declare dynbind vars documented in gnus-summary-highlight.
This commit is contained in:
Stefan Monnier 2019-04-08 16:49:11 -04:00
parent 0667c73708
commit 36dc39bfbf

View file

@ -27,7 +27,34 @@
(require 'cl-lib) (require 'cl-lib)
(defvar tool-bar-mode) (defvar tool-bar-mode)
(defvar gnus-category-predicate-alist)
(defvar gnus-category-predicate-cache)
(defvar gnus-inhibit-article-treatments)
(defvar gnus-inhibit-demon)
(defvar gnus-tmp-article-number)
(defvar gnus-tmp-closing-bracket)
(defvar gnus-tmp-current)
(defvar gnus-tmp-dummy)
(defvar gnus-tmp-expirable)
(defvar gnus-tmp-from)
(defvar gnus-tmp-group-name)
(defvar gnus-tmp-header) (defvar gnus-tmp-header)
(defvar gnus-tmp-indentation)
(defvar gnus-tmp-level)
(defvar gnus-tmp-lines)
(defvar gnus-tmp-number)
(defvar gnus-tmp-opening-bracket)
(defvar gnus-tmp-process)
(defvar gnus-tmp-replied)
(defvar gnus-tmp-score)
(defvar gnus-tmp-score-char)
(defvar gnus-tmp-subject)
(defvar gnus-tmp-subject-or-nil)
(defvar gnus-tmp-unread)
(defvar gnus-tmp-unread-and-unselected)
(defvar gnus-tmp-unread-and-unticked)
(defvar gnus-tmp-user-defined)
(defvar gnus-use-article-prefetch)
(require 'gnus) (require 'gnus)
(require 'gnus-group) (require 'gnus-group)
@ -784,7 +811,7 @@ score file."
:group 'gnus-score-default :group 'gnus-score-default
:type 'integer) :type 'integer)
(defun gnus-widget-reversible-match (widget value) (defun gnus-widget-reversible-match (_widget value)
"Ignoring WIDGET, convert VALUE to internal form. "Ignoring WIDGET, convert VALUE to internal form.
VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol." VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
;; (debug value) ;; (debug value)
@ -794,7 +821,7 @@ VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
(eq (nth 0 value) 'not) (eq (nth 0 value) 'not)
(symbolp (nth 1 value))))) (symbolp (nth 1 value)))))
(defun gnus-widget-reversible-to-internal (widget value) (defun gnus-widget-reversible-to-internal (_widget value)
"Ignoring WIDGET, convert VALUE to internal form. "Ignoring WIDGET, convert VALUE to internal form.
VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom. VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)." FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
@ -803,7 +830,7 @@ FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
(list value nil) (list value nil)
(list (nth 1 value) t))) (list (nth 1 value) t)))
(defun gnus-widget-reversible-to-external (widget value) (defun gnus-widget-reversible-to-external (_widget value)
"Ignoring WIDGET, convert VALUE to external form. "Ignoring WIDGET, convert VALUE to external form.
VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom. VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
\(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)." \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
@ -1385,7 +1412,8 @@ the normal Gnus MIME machinery."
(?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from))) (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
?s) ?s)
(?a (or (car (funcall gnus-extract-address-components gnus-tmp-from)) (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
gnus-tmp-from) ?s) gnus-tmp-from)
?s)
(?F gnus-tmp-from ?s) (?F gnus-tmp-from ?s)
(?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s) (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
(?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s) (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
@ -1397,12 +1425,15 @@ the normal Gnus MIME machinery."
(?k (gnus-summary-line-message-size gnus-tmp-header) ?s) (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
(?L gnus-tmp-lines ?s) (?L gnus-tmp-lines ?s)
(?Z (or (nnir-article-rsv (mail-header-number gnus-tmp-header)) (?Z (or (nnir-article-rsv (mail-header-number gnus-tmp-header))
0) ?d) 0)
?d)
(?G (or (nnir-article-group (mail-header-number gnus-tmp-header)) (?G (or (nnir-article-group (mail-header-number gnus-tmp-header))
"") ?s) "")
?s)
(?g (or (gnus-group-short-name (?g (or (gnus-group-short-name
(nnir-article-group (mail-header-number gnus-tmp-header))) (nnir-article-group (mail-header-number gnus-tmp-header)))
"") ?s) "")
?s)
(?O gnus-tmp-downloaded ?c) (?O gnus-tmp-downloaded ?c)
(?I gnus-tmp-indentation ?s) (?I gnus-tmp-indentation ?s)
(?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s) (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
@ -1427,7 +1458,8 @@ the normal Gnus MIME machinery."
(?P (gnus-pick-line-number) ?d) (?P (gnus-pick-line-number) ?d)
(?B gnus-tmp-thread-tree-header-string ?s) (?B gnus-tmp-thread-tree-header-string ?s)
(user-date (gnus-user-date (user-date (gnus-user-date
,(macroexpand '(mail-header-date gnus-tmp-header))) ?s)) ,(macroexpand '(mail-header-date gnus-tmp-header)))
?s))
"An alist of format specifications that can appear in summary lines. "An alist of format specifications that can appear in summary lines.
These are paired with what variables they correspond with, along with These are paired with what variables they correspond with, along with
the type of the variable (string, integer, character, etc).") the type of the variable (string, integer, character, etc).")
@ -1672,6 +1704,7 @@ For example:
(eval-when-compile (eval-when-compile
;; Bind features so that require will believe that gnus-sum has ;; Bind features so that require will believe that gnus-sum has
;; already been loaded (avoids infinite recursion) ;; already been loaded (avoids infinite recursion)
(with-no-warnings (defvar features)) ;Not just a local variable.
(let ((features (cons 'gnus-sum features))) (let ((features (cons 'gnus-sum features)))
(require 'gnus-art))) (require 'gnus-art)))
@ -3107,18 +3140,16 @@ The following commands are available:
(defun gnus-summary-make-local-variables () (defun gnus-summary-make-local-variables ()
"Make all the local summary buffer variables." "Make all the local summary buffer variables."
(let (global)
(dolist (local gnus-summary-local-variables) (dolist (local gnus-summary-local-variables)
(if (consp local) (if (consp local)
(progn (let ((global (if (eq (cdr local) 'global)
(if (eq (cdr local) 'global)
;; Copy the global value of the variable. ;; Copy the global value of the variable.
(setq global (symbol-value (car local))) (symbol-value (car local))
;; Use the value from the list. ;; Use the value from the list.
(setq global (eval (cdr local)))) (eval (cdr local)))))
(set (make-local-variable (car local)) global)) (set (make-local-variable (car local)) global))
;; Simple nil-valued local variable. ;; Simple nil-valued local variable.
(set (make-local-variable local) nil))))) (set (make-local-variable local) nil))))
;; Summary data functions. ;; Summary data functions.
@ -3525,13 +3556,12 @@ buffer that was in action when the last article was fetched."
(score-file gnus-current-score-file) (score-file gnus-current-score-file)
(default-charset gnus-newsgroup-charset) (default-charset gnus-newsgroup-charset)
vlist) vlist)
(let ((locals gnus-newsgroup-variables)) (dolist (local gnus-newsgroup-variables)
(while locals (push (eval (if (consp local) (car local)
(if (consp (car locals)) local)
(push (eval (caar locals)) vlist) t)
(push (eval (car locals)) vlist)) vlist))
(setq locals (cdr locals))) (setq vlist (nreverse vlist))
(setq vlist (nreverse vlist)))
(with-temp-buffer (with-temp-buffer
(setq gnus-newsgroup-name name (setq gnus-newsgroup-name name
gnus-newsgroup-marked marked gnus-newsgroup-marked marked
@ -3546,12 +3576,11 @@ buffer that was in action when the last article was fetched."
gnus-reffed-article-number reffed gnus-reffed-article-number reffed
gnus-current-score-file score-file gnus-current-score-file score-file
gnus-newsgroup-charset default-charset) gnus-newsgroup-charset default-charset)
(let ((locals gnus-newsgroup-variables)) (dolist (local gnus-newsgroup-variables)
(while locals (set (if (consp local)
(if (consp (car locals)) (car local)
(set (caar locals) (pop vlist)) local)
(set (car locals) (pop vlist))) (pop vlist)))))))
(setq locals (cdr locals))))))))
(defun gnus-summary-article-unread-p (article) (defun gnus-summary-article-unread-p (article)
"Say whether ARTICLE is unread or not." "Say whether ARTICLE is unread or not."
@ -3639,19 +3668,23 @@ buffer that was in action when the last article was fetched."
pos))) pos)))
(setq gnus-summary-mark-positions pos)))) (setq gnus-summary-mark-positions pos))))
(defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number) (defun gnus-summary-insert-dummy-line (subject number)
"Insert a dummy root in the summary buffer." "Insert a dummy root in the summary buffer."
(beginning-of-line) (beginning-of-line)
(add-text-properties (add-text-properties
(point) (progn (eval gnus-summary-dummy-line-format-spec) (point)) (point) (let ((gnus-tmp-subject subject)
(list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number))) (gnus-tmp-number number))
(eval gnus-summary-dummy-line-format-spec t)
(point))
(list 'gnus-number number 'gnus-intangible number)))
(defun gnus-summary-extract-address-component (from) (defun gnus-summary-extract-address-component (from)
(or (car (funcall gnus-extract-address-components from)) (or (car (funcall gnus-extract-address-components from))
from)) from))
(defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from) (defun gnus-summary-from-or-to-or-newsgroups (header from)
(let ((mail-parse-charset gnus-newsgroup-charset) (let ((gnus-tmp-from from)
(mail-parse-charset gnus-newsgroup-charset)
;; Is it really necessary to do this next part for each summary line? ;; Is it really necessary to do this next part for each summary line?
;; Luckily, doesn't seem to slow things down much. ;; Luckily, doesn't seem to slow things down much.
(mail-parse-ignored-charsets (mail-parse-ignored-charsets
@ -3678,25 +3711,31 @@ buffer that was in action when the last article was fetched."
(and (and
(memq 'Newsgroups gnus-extra-headers) (memq 'Newsgroups gnus-extra-headers)
(eq (car (gnus-find-method-for-group (eq (car (gnus-find-method-for-group
gnus-newsgroup-name)) 'nntp) gnus-newsgroup-name))
'nntp)
(gnus-group-real-name gnus-newsgroup-name)))) (gnus-group-real-name gnus-newsgroup-name))))
(concat gnus-summary-newsgroup-prefix newsgroups))))) (concat gnus-summary-newsgroup-prefix newsgroups)))))
(bidi-string-mark-left-to-right (bidi-string-mark-left-to-right
(inline (inline
(gnus-summary-extract-address-component gnus-tmp-from)))))) (gnus-summary-extract-address-component gnus-tmp-from))))))
(defun gnus-summary-insert-line (gnus-tmp-header (defun gnus-summary-insert-line (header level current undownloaded
gnus-tmp-level gnus-tmp-current unread replied expirable subject-or-nil
undownloaded gnus-tmp-unread gnus-tmp-replied &optional dummy score process)
gnus-tmp-expirable gnus-tmp-subject-or-nil (if (>= level (length gnus-thread-indent-array))
&optional gnus-tmp-dummy gnus-tmp-score
gnus-tmp-process)
(if (>= gnus-tmp-level (length gnus-thread-indent-array))
(gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array)) (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
gnus-tmp-level))) level)))
(let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level)) (let* ((gnus-tmp-header header)
(gnus-tmp-level level)
(gnus-tmp-current current)
(gnus-tmp-unread unread)
(gnus-tmp-expirable expirable)
(gnus-tmp-subject-or-nil subject-or-nil)
(gnus-tmp-dummy dummy)
(gnus-tmp-process process)
(gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
(gnus-tmp-lines (mail-header-lines gnus-tmp-header)) (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
(gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0)) (gnus-tmp-score (or score gnus-summary-default-score 0))
(gnus-tmp-score-char (gnus-tmp-score-char
(if (or (null gnus-summary-default-score) (if (or (null gnus-summary-default-score)
(<= (abs (- gnus-tmp-score gnus-summary-default-score)) (<= (abs (- gnus-tmp-score gnus-summary-default-score))
@ -3709,7 +3748,7 @@ buffer that was in action when the last article was fetched."
(cond (gnus-tmp-process gnus-process-mark) (cond (gnus-tmp-process gnus-process-mark)
((memq gnus-tmp-current gnus-newsgroup-cached) ((memq gnus-tmp-current gnus-newsgroup-cached)
gnus-cached-mark) gnus-cached-mark)
(gnus-tmp-replied gnus-replied-mark) (replied gnus-replied-mark)
((memq gnus-tmp-current gnus-newsgroup-forwarded) ((memq gnus-tmp-current gnus-newsgroup-forwarded)
gnus-forwarded-mark) gnus-forwarded-mark)
((memq gnus-tmp-current gnus-newsgroup-saved) ((memq gnus-tmp-current gnus-newsgroup-saved)
@ -4461,7 +4500,7 @@ Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
;; build complete threads - if the roots haven't been expired by the ;; build complete threads - if the roots haven't been expired by the
;; server, that is. ;; server, that is.
(let ((mail-parse-charset gnus-newsgroup-charset) (let ((mail-parse-charset gnus-newsgroup-charset)
id heads) heads)
(maphash (maphash
(lambda (id refs) (lambda (id refs)
(when (not (car refs)) (when (not (car refs))
@ -4485,7 +4524,6 @@ Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
;; on the beginning of the line. ;; on the beginning of the line.
(defsubst gnus-nov-parse-line (number dependencies &optional force-new) (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
(let ((eol (point-at-eol)) (let ((eol (point-at-eol))
(buffer (current-buffer))
header references in-reply-to) header references in-reply-to)
;; overview: [num subject from date id refs chars lines misc] ;; overview: [num subject from date id refs chars lines misc]
@ -4940,8 +4978,16 @@ Note that THREAD must never, ever be anything else than a variable -
using some other form will lead to serious barfage." using some other form will lead to serious barfage."
(or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread))) (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
;; (8% speedup to gnus-summary-prepare, just for fun :-) ;; (8% speedup to gnus-summary-prepare, just for fun :-)
(cond
((and (boundp 'lexical-binding) lexical-binding)
;; FIXME: This version could be a "defsubst" rather than a macro.
`(#[257 "\211:\203\16\0\211@;\203\15\0A@@\207"
[] 2]
,thread))
(t
;; Not sure how XEmacs handles these things, so let's keep the old code.
(list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
(vector thread) 2)) (vector thread) 2))))
(defsubst gnus-article-sort-by-number (h1 h2) (defsubst gnus-article-sort-by-number (h1 h2)
"Sort articles by article number." "Sort articles by article number."
@ -5972,7 +6018,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
(min (car active)) (min (car active))
(max (cdr active)) (max (cdr active))
(types gnus-article-mark-lists) (types gnus-article-mark-lists)
marks var articles article mark mark-type var articles article mark mark-type
bgn end) bgn end)
;; Hack to avoid adjusting marks for imap. ;; Hack to avoid adjusting marks for imap.
(when (eq (car (gnus-find-method-for-group (gnus-info-group info))) (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
@ -6234,7 +6280,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
(defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads) (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
"Look through all the headers and mark the Xrefs as read." "Look through all the headers and mark the Xrefs as read."
(let ((virtual (gnus-virtual-group-p from-newsgroup)) (let ((virtual (gnus-virtual-group-p from-newsgroup))
name info xref-hashtb idlist method nth4) name info xref-hashtb method nth4)
(with-current-buffer gnus-group-buffer (with-current-buffer gnus-group-buffer
(when (setq xref-hashtb (when (setq xref-hashtb
(gnus-create-xref-hashtb from-newsgroup headers unreads)) (gnus-create-xref-hashtb from-newsgroup headers unreads))
@ -7488,7 +7534,7 @@ The state which existed when entering the ephemeral is reset."
(with-current-buffer buffer (with-current-buffer buffer
(gnus-deaden-summary)))))) (gnus-deaden-summary))))))
(defun gnus-summary-wake-up-the-dead (&rest args) (defun gnus-summary-wake-up-the-dead (&rest _)
"Wake up the dead summary buffer." "Wake up the dead summary buffer."
(interactive) (interactive)
(gnus-dead-summary-mode -1) (gnus-dead-summary-mode -1)
@ -7714,6 +7760,12 @@ Given a prefix, will force an `article' buffer configuration."
(gnus-article-setup-buffer)) (gnus-article-setup-buffer))
(gnus-set-global-variables) (gnus-set-global-variables)
(with-current-buffer gnus-article-buffer (with-current-buffer gnus-article-buffer
;; The buffer may be non-empty and even narrowed, so go back to
;; a sane state.
(widen)
;; We're going to erase the buffer anyway so do it now: it can save us from
;; uselessly performing multibyte-conversion of the current content.
(let ((inhibit-read-only t)) (erase-buffer))
(setq gnus-article-charset gnus-newsgroup-charset) (setq gnus-article-charset gnus-newsgroup-charset)
(setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets) (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
(mm-enable-multibyte)) (mm-enable-multibyte))
@ -7857,7 +7909,7 @@ If BACKWARD, the previous article is selected instead of the next."
(gnus-summary-walk-group-buffer (gnus-summary-walk-group-buffer
gnus-newsgroup-name cmd unread backward point)))))))) gnus-newsgroup-name cmd unread backward point))))))))
(defun gnus-summary-walk-group-buffer (from-group cmd unread backward start) (defun gnus-summary-walk-group-buffer (_from-group cmd unread backward start)
(let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1)) (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
(?\C-p (gnus-group-prev-unread-group 1)))) (?\C-p (gnus-group-prev-unread-group 1))))
(cursor-in-echo-area t) (cursor-in-echo-area t)
@ -8151,7 +8203,7 @@ score higher than the default score."
"Select the first unread subject that has a score over the default score." "Select the first unread subject that has a score over the default score."
(interactive) (interactive)
(let ((data gnus-newsgroup-data) (let ((data gnus-newsgroup-data)
article score) article)
(while (and (setq article (gnus-data-number (car data))) (while (and (setq article (gnus-data-number (car data)))
(or (gnus-data-read-p (car data)) (or (gnus-data-read-p (car data))
(not (> (gnus-summary-article-score article) (not (> (gnus-summary-article-score article)
@ -8564,7 +8616,7 @@ If UNREPLIED (the prefix), limit to unreplied articles."
(gnus-summary-limit gnus-newsgroup-replied)) (gnus-summary-limit gnus-newsgroup-replied))
(gnus-summary-position-point)) (gnus-summary-position-point))
(defun gnus-summary-limit-exclude-marks (marks &optional reverse) (defun gnus-summary-limit-exclude-marks (marks &optional _reverse)
"Exclude articles that are marked with MARKS (e.g. \"DK\"). "Exclude articles that are marked with MARKS (e.g. \"DK\").
If REVERSE, limit the summary buffer to articles that are marked If REVERSE, limit the summary buffer to articles that are marked
with MARKS. MARKS can either be a string of marks or a list of marks. with MARKS. MARKS can either be a string of marks or a list of marks.
@ -8866,7 +8918,7 @@ fetch-old-headers verbiage, and so on."
(push gnus-newsgroup-limit gnus-newsgroup-limits) (push gnus-newsgroup-limit gnus-newsgroup-limits)
(setq gnus-newsgroup-limit nil) (setq gnus-newsgroup-limit nil)
(maphash (maphash
(lambda (id deps) (lambda (_id deps)
(unless (car deps) (unless (car deps)
;; These threads have no parents -- they are roots. ;; These threads have no parents -- they are roots.
(let ((nodes (cdr deps)) (let ((nodes (cdr deps))
@ -9524,6 +9576,9 @@ fetched headers for, whether they are displayed or not."
(func `(lambda (h) (,(intern (concat "mail-header-" header)) h))) (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
(case-fold-search t)) (case-fold-search t))
(dolist (header gnus-newsgroup-headers) (dolist (header gnus-newsgroup-headers)
;; FIXME: when called from gnus-summary-limit-include-thread via
;; gnus-summary-limit-include-matching-articles, `regexp' is a decoded
;; string whereas the header isn't decoded.
(when (string-match regexp (funcall func header)) (when (string-match regexp (funcall func header))
(push (mail-header-number header) articles))) (push (mail-header-number header) articles)))
(nreverse articles))) (nreverse articles)))
@ -9538,7 +9593,7 @@ be taken into consideration. If NOT-CASE-FOLD, case won't be folded
in the comparisons. If NOT-MATCHING, return a list of all articles that in the comparisons. If NOT-MATCHING, return a list of all articles that
not match REGEXP on HEADER." not match REGEXP on HEADER."
(let ((case-fold-search (not not-case-fold)) (let ((case-fold-search (not not-case-fold))
articles d func) articles func)
(if (consp header) (if (consp header)
(if (eq (car header) 'extra) (if (eq (car header) 'extra)
(setq func (setq func
@ -9658,6 +9713,10 @@ to save in."
(gnus-summary-remove-process-mark article)) (gnus-summary-remove-process-mark article))
(ps-despool filename)) (ps-despool filename))
(defvar ps-right-header)
(defvar ps-left-header)
(defvar shr-ignore-cache)
(defun gnus-print-buffer () (defun gnus-print-buffer ()
(let ((ps-left-header (let ((ps-left-header
(list (list
@ -9883,7 +9942,7 @@ prefix specifies how many places to rotate each letter forward."
;; Create buttons and stuff... ;; Create buttons and stuff...
(gnus-treat-article nil)) (gnus-treat-article nil))
(defun gnus-summary-idna-message (&optional arg) (defun gnus-summary-idna-message (&optional _arg)
"Decode IDNA encoded domain names in the current articles. "Decode IDNA encoded domain names in the current articles.
IDNA encoded domain names looks like `xn--bar'. If a string IDNA encoded domain names looks like `xn--bar'. If a string
remain unencoded after running this function, it is likely an remain unencoded after running this function, it is likely an
@ -9891,7 +9950,7 @@ invalid IDNA string (`xn--bar' is invalid).
You must have GNU Libidn (URL `https://www.gnu.org/software/libidn/') You must have GNU Libidn (URL `https://www.gnu.org/software/libidn/')
installed for this command to work." installed for this command to work."
(interactive "P") (interactive)
(gnus-summary-select-article) (gnus-summary-select-article)
(let ((mail-header-separator "")) (let ((mail-header-separator ""))
(gnus-eval-in-buffer-window gnus-article-buffer (gnus-eval-in-buffer-window gnus-article-buffer
@ -9903,9 +9962,9 @@ installed for this command to work."
(replace-match (puny-decode-domain (match-string 1)))) (replace-match (puny-decode-domain (match-string 1))))
(set-window-start (get-buffer-window (current-buffer)) start)))))) (set-window-start (get-buffer-window (current-buffer)) start))))))
(defun gnus-summary-morse-message (&optional arg) (defun gnus-summary-morse-message (&optional _arg)
"Morse decode the current article." "Morse decode the current article."
(interactive "P") (interactive)
(gnus-summary-select-article) (gnus-summary-select-article)
(let ((mail-header-separator "")) (let ((mail-header-separator ""))
(gnus-eval-in-buffer-window gnus-article-buffer (gnus-eval-in-buffer-window gnus-article-buffer
@ -9963,11 +10022,11 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
(cond ((and (eq action 'move) (cond ((and (eq action 'move)
(not (gnus-check-backend-function (not (gnus-check-backend-function
'request-move-article gnus-newsgroup-name))) 'request-move-article gnus-newsgroup-name)))
(error "The current group does not support article moving")) (user-error "The current group does not support article moving"))
((and (eq action 'crosspost) ((and (eq action 'crosspost)
(not (gnus-check-backend-function (not (gnus-check-backend-function
'request-replace-article gnus-newsgroup-name))) 'request-replace-article gnus-newsgroup-name)))
(error "The current group does not support article editing"))) (user-error "The current group does not support article editing")))
(let ((articles (gnus-summary-work-articles n)) (let ((articles (gnus-summary-work-articles n))
(prefix (if (gnus-check-backend-function (prefix (if (gnus-check-backend-function
'request-move-article gnus-newsgroup-name) 'request-move-article gnus-newsgroup-name)
@ -9979,7 +10038,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
(crosspost "Crosspost" "Crossposting"))) (crosspost "Crosspost" "Crossposting")))
(copy-buf (save-excursion (copy-buf (save-excursion
(nnheader-set-temp-buffer " *copy article*"))) (nnheader-set-temp-buffer " *copy article*")))
art-group to-method new-xref article to-groups art-group to-method new-xref to-groups
articles-to-update-marks encoded) articles-to-update-marks encoded)
(unless (assq action names) (unless (assq action names)
(error "Unknown action %s" action)) (error "Unknown action %s" action))
@ -10029,8 +10088,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
(or (car select-method) (or (car select-method)
(gnus-group-decoded-name to-newsgroup)) (gnus-group-decoded-name to-newsgroup))
articles) articles)
(while articles (dolist (article articles)
(setq article (pop articles))
;; Set any marks that may have changed in the summary buffer. ;; Set any marks that may have changed in the summary buffer.
(when gnus-preserve-marks (when gnus-preserve-marks
(gnus-summary-push-marks-to-backend article)) (gnus-summary-push-marks-to-backend article))
@ -10232,7 +10290,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
to-newsgroup to-newsgroup
select-method)) select-method))
;;;!!!Why is this necessary? ;;!!!Why is this necessary?
(set-buffer gnus-summary-buffer) (set-buffer gnus-summary-buffer)
(when (eq action 'move) (when (eq action 'move)
@ -10598,7 +10656,7 @@ groups."
(let ((mbl mml-buffer-list)) (let ((mbl mml-buffer-list))
(setq mml-buffer-list nil) (setq mml-buffer-list nil)
(let ((rfc2047-quote-decoded-words-containing-tspecials t)) (let ((rfc2047-quote-decoded-words-containing-tspecials t))
(mime-to-mml ,'current-handles)) (mime-to-mml ',current-handles))
(let ((mbl1 mml-buffer-list)) (let ((mbl1 mml-buffer-list))
(setq mml-buffer-list mbl) (setq mml-buffer-list mbl)
(set (make-local-variable 'mml-buffer-list) mbl1)) (set (make-local-variable 'mml-buffer-list) mbl1))
@ -10886,8 +10944,8 @@ the actual number of articles unmarked is returned."
(set var (cons article (symbol-value var))) (set var (cons article (symbol-value var)))
(if (memq type '(processable cached replied forwarded recent saved)) (if (memq type '(processable cached replied forwarded recent saved))
(gnus-summary-update-secondary-mark article) (gnus-summary-update-secondary-mark article)
;;; !!! This is bogus. We should find out what primary ;; !!! This is bogus. We should find out what primary
;;; !!! mark we want to set. ;; !!! mark we want to set.
(gnus-summary-update-mark gnus-del-mark 'unread))))) (gnus-summary-update-mark gnus-del-mark 'unread)))))
(defun gnus-summary-mark-as-expirable (n) (defun gnus-summary-mark-as-expirable (n)
@ -12016,10 +12074,10 @@ Argument REVERSE means reverse order."
(interactive "P") (interactive "P")
(gnus-summary-sort 'marks reverse)) (gnus-summary-sort 'marks reverse))
(defun gnus-summary-sort-by-original (&optional reverse) (defun gnus-summary-sort-by-original (&optional _reverse)
"Sort the summary buffer using the default sorting method. "Sort the summary buffer using the default sorting method.
Argument REVERSE means reverse order." Argument REVERSE means reverse order."
(interactive "P") (interactive)
(let* ((inhibit-read-only t) (let* ((inhibit-read-only t)
(gnus-summary-prepare-hook nil)) (gnus-summary-prepare-hook nil))
;; We do the sorting by regenerating the threads. ;; We do the sorting by regenerating the threads.
@ -12345,7 +12403,7 @@ save those articles instead."
(string= to-newsgroup prefix)) (string= to-newsgroup prefix))
(setq to-newsgroup default)) (setq to-newsgroup default))
(unless to-newsgroup (unless to-newsgroup
(error "No group name entered")) (user-error "No group name entered"))
(setq encoded (encode-coding-string (setq encoded (encode-coding-string
to-newsgroup to-newsgroup
(gnus-group-name-charset to-method to-newsgroup))) (gnus-group-name-charset to-method to-newsgroup)))
@ -12357,7 +12415,7 @@ save those articles instead."
(gnus-activate-group encoded nil nil to-method) (gnus-activate-group encoded nil nil to-method)
(gnus-subscribe-group encoded)) (gnus-subscribe-group encoded))
(error "Couldn't create group %s" to-newsgroup))) (error "Couldn't create group %s" to-newsgroup)))
(error "No such group: %s" to-newsgroup)) (user-error "No such group: %s" to-newsgroup))
encoded))) encoded)))
(defvar gnus-summary-save-parts-counter) (defvar gnus-summary-save-parts-counter)
@ -12655,14 +12713,21 @@ If REVERSE, save parts that do not match TYPE."
(c cond) (c cond)
(list gnus-summary-highlight)) (list gnus-summary-highlight))
(while list (while list
(setcdr c (cons (list (caar list) (list 'quote (cdar list))) (setcdr c `((,(caar list) ',(cdar list))))
nil))
(setq c (cdr c) (setq c (cdr c)
list (cdr list))) list (cdr list)))
(gnus-byte-compile (list 'lambda nil cond)))))) (gnus-byte-compile
`(lambda ()
(with-no-warnings ;See docstring of gnus-summary-highlight.
(defvar score) (defvar default) (defvar default-high)
(defvar default-low) (defvar mark) (defvar uncached))
,cond))))))
(defun gnus-summary-highlight-line () (defun gnus-summary-highlight-line ()
"Highlight current line according to `gnus-summary-highlight'." "Highlight current line according to `gnus-summary-highlight'."
(with-no-warnings ;See docstring of gnus-summary-highlight.
(defvar score) (defvar default) (defvar default-high) (defvar default-low)
(defvar mark) (defvar uncached))
(let* ((beg (point-at-bol)) (let* ((beg (point-at-bol))
(article (or (gnus-summary-article-number) gnus-current-article)) (article (or (gnus-summary-article-number) gnus-current-article))
(score (or (cdr (assq article (score (or (cdr (assq article