From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#44981: 28.0.50; Restore nnimap-split-download-body? Date: Sat, 05 Dec 2020 15:57:17 +0000 Message-ID: <87wnxw1c0y.fsf@tcd.ie> References: <87y2iip3ky.fsf@ericabrahamsen.net> <878sag4i4f.fsf@gnus.org> <87v9djsqxl.fsf@ericabrahamsen.net> <87k0tzz4wf.fsf@gnus.org> <87k0ty92ge.fsf@ericabrahamsen.net> <87zh2tyhmv.fsf@tcd.ie> <87pn3pmn4i.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15249"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , 44981@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 05 16:59:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klZxs-0003qf-Ic for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 16:59:16 +0100 Original-Received: from localhost ([::1]:52998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klZxr-0003ud-ED for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 10:59:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klZwg-0003Qn-JP for bug-gnu-emacs@gnu.org; Sat, 05 Dec 2020 10:58:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1klZwg-0002KZ-BH for bug-gnu-emacs@gnu.org; Sat, 05 Dec 2020 10:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1klZwg-0003Hx-Aa for bug-gnu-emacs@gnu.org; Sat, 05 Dec 2020 10:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Dec 2020 15:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44981 X-GNU-PR-Package: emacs Original-Received: via spool by 44981-submit@debbugs.gnu.org id=B44981.160718384812591 (code B ref 44981); Sat, 05 Dec 2020 15:58:02 +0000 Original-Received: (at 44981) by debbugs.gnu.org; 5 Dec 2020 15:57:28 +0000 Original-Received: from localhost ([127.0.0.1]:48056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klZw7-0003H0-Pv for submit@debbugs.gnu.org; Sat, 05 Dec 2020 10:57:28 -0500 Original-Received: from mail-wr1-f44.google.com ([209.85.221.44]:33155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klZw6-0003Gn-0n for 44981@debbugs.gnu.org; Sat, 05 Dec 2020 10:57:26 -0500 Original-Received: by mail-wr1-f44.google.com with SMTP id u12so8316677wrt.0 for <44981@debbugs.gnu.org>; Sat, 05 Dec 2020 07:57:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=DzwTrfsbcH3s6eceI9Mser1RnxBRZHVODIn7SpQN7d0=; b=Vog87jIX5rZIQD2RhDFpSL7pSALX6d5exolxE1D8b/CchGmUF3iNtCtGL2PIYgfCSb jrf7QMBn4DtDrpeseKQcRI0SVUxpuJeTjij327LGqsy1ZVqSWreJLIcbuNF3RoAX1tp0 PfusK7IWQQcaYgsD+a9WMBgpRhZLl9n0lsgkdWUM1UNtRkcBxEJf6O5ZSeLVJGCrwNKD haiNv8reU6Su7lqbYaY1cKhyRRHviDgeVl4Rxiq/FG4A5tidEQ5TVLrKp9RW5HNEm1ex LzdWm6uTz9wCIVw3nO/tXCam/NzoTuSaYSuObx6lPVC/ENG/0M//mixHhCxQOeULY8HA RbDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=DzwTrfsbcH3s6eceI9Mser1RnxBRZHVODIn7SpQN7d0=; b=cpKP55qWDdeY2t/m5xqiRDtuaGQdwm3tZMZv1UYoLrVzvQMiZ/jN3qJWfonFbTcU4L xwQbD8nlnnWpjwrgSzWgJ5xIUFhU6IJjBKTxW5HbXn9oQaSJ1M7SDe7cYY0wVDiqcsHQ s38H0LSXwqAhl0hb8fTYQK8OBkgm2h9XeBxHa7dvYOd5lICHMcugE1tHZ+JX1hQomgyt +ZdkFL15AnIqRNQyfyrqxwfZ6E0fcDXNoZhyMra4D0BmUbCp6OPACj6/ES+rYiKstkAS 8qoMQ9kUEggrL+1ooPrsJ0AxIBcELDhFCBbSGLBy88BUTGz/D1zgMqlNrzecy6YFYN3h J6Jg== X-Gm-Message-State: AOAM531pUCDlWZuFZ34qy8b4Vd1KXWjC1gXOl0YQRABuoy6nbpPByi5t a8e/7zfJ6eVzyMpth8sxVnxpzA== X-Google-Smtp-Source: ABdhPJz/YOFWimNY5Ay2NY1yVH2KE+J2XmHDfuVVglfxsWnEYzSq4MfKyzPY4AU4FiJ4ZZPwIdFUSQ== X-Received: by 2002:adf:e3cf:: with SMTP id k15mr10574640wrm.259.1607183840067; Sat, 05 Dec 2020 07:57:20 -0800 (PST) Original-Received: from localhost ([51.37.47.98]) by smtp.gmail.com with ESMTPSA id c190sm7605021wme.19.2020.12.05.07.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2020 07:57:18 -0800 (PST) In-Reply-To: <87pn3pmn4i.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Fri, 04 Dec 2020 10:39:41 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195037 Archived-At: --=-=-= Content-Type: text/plain Eric Abrahamsen writes: > I'm not sure why spam.el would need to work on the default value of > `nnimap-split-download-body'. If spam.el determines that widening is > needed, it's going to download message bodies across the board anyway. > The only reason to preserve the user's own customization would be if the > user later unloaded spam.el -- then it should restore the previous > value. But how often would that actually be useful? > > In principle, TRT would be to have spam.el let-bind a variable around > the splitting process. But I don't think the code is set up that way: > all the spam.el stuff happens "inside" the splitting process, not around > it. How about the attached kludgy but conservative dance? -- Basil --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Stop-using-deprecated-nnimap-variable-in-spam.el.patch >From 9792b97faf4e5b1dc22e58d99806ec17a9fd7985 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 5 Dec 2020 15:28:35 +0000 Subject: [PATCH] Stop using deprecated nnimap variable in spam.el * lisp/gnus/nnimap.el (nnimap--split-download-body): New variable. (nnimap-fetch-inbox): Use it in conjunction with nnimap-split-download-body. * lisp/gnus/spam.el: Don't load nnimap.el at compile time for a dynamic variable. (spam-setup-widening): Rather than unconditionally set deprecated nnimap-split-download-body-default, set nnimap--split-download-body to recognizable non-nil value only if it is nil (bug#44981). (spam-teardown-widening): Undo this if nnimap--split-download-body still holds the recognizable value. (spam-unload-hook): Call spam-teardown-widening to revert any change to the value of nnimap--split-download-body. --- lisp/gnus/nnimap.el | 6 +++++- lisp/gnus/spam.el | 26 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index a860333066..c8b700ebcc 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -157,6 +157,9 @@ nnimap-split-download-body :version "28.1" :type 'boolean) +(defvar nnimap--split-download-body nil + "Like `nnimap-split-download-body', but for internal use.") + (defvar nnimap-process nil) (defvar nnimap-status-string "") @@ -2108,7 +2111,8 @@ nnimap-fetch-inbox "BODY.PEEK" "RFC822.PEEK")) (cond - (nnimap-split-download-body + ((or nnimap-split-download-body + nnimap--split-download-body) "[]") ((nnimap-ver4-p) "[HEADER]") diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 96a7da2313..e74aef3efe 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -44,12 +44,9 @@ ;;; for the definitions of group content classification and spam processors (require 'gnus) -(eval-when-compile (require 'hashcash)) - -;; for nnimap-split-download-body-default -(eval-when-compile (require 'nnimap)) - -(eval-when-compile (require 'cl-lib)) +(eval-when-compile + (require 'cl-lib) + (require 'hashcash)) ;; autoload query-dig (autoload 'query-dig "dig") @@ -1228,10 +1225,20 @@ spam-generic-score ;;{{{ set up widening, processor checks -;;; set up IMAP widening if it's necessary +(defconst spam--widened (list ()) + "Unique value identifying changes to `nnimap--split-download-body'.") + (defun spam-setup-widening () - (when (spam-widening-needed-p) - (setq nnimap-split-download-body-default t))) + "Set up IMAP widening if it's necessary." + (and (boundp 'nnimap--split-download-body) + (not nnimap--split-download-body) + (spam-widening-needed-p) + (setq nnimap--split-download-body spam--widened))) + +(defun spam-teardown-widening () + "Tear down IMAP widening." + (when (eq (bound-and-true-p nnimap--split-download-body) spam--widened) + (setq nnimap--split-download-body nil))) (defun spam-widening-needed-p (&optional force-symbols) (let (found) @@ -2865,6 +2872,7 @@ spam-initialize (defun spam-unload-hook () "Uninstall the spam.el hooks." (interactive) + (spam-teardown-widening) (remove-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save) (remove-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load) (remove-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load) -- 2.29.2 --=-=-=--