From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id aJkkAkbpu2B9dQAAsNZ9tg (envelope-from ); Sat, 05 Jun 2021 21:14:46 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id wD0jAkLpu2DCSwAAbx9fmQ (envelope-from ); Sat, 05 Jun 2021 21:14:42 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1622927681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jA97XAxUzYCxiq205abwE1E9IW7Lc5I/cM4jq9LGRVM=; b=xv4s44NkB4UmHlR+tdAaj+rDuBpsmXadm0iuwCuVhjVoPzO78P9eBqxN4Zlu0xB3UBdlVd JwzwtjinDa+QpuH7DqAYmsE3LR2E4VN9dddxGOYpwI02BYI+eJmJGSF4f9N4ops47UncST 879bOyFm6j59AE//PfN/W0UV9lHGpesJimubH9fU/oqX+dlqELSYFkqO/FeB3cMt4vHy3q Vz5/lgcLor/gb7TuWNMSl9XpjF9eGI9rkqTyaAd9gIi1n2GdXBcT4XWdWobt1z1/4598Uv PSz5t5fF52jbA89ZquKfReXgVJSqmUMB+FW2AxqpQ9P5C1i9dqnEa4Ik345X9g== From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH 12/18] piem-lei-query-thread: Add bug#NNN special case when eliding subject Date: Sat, 5 Jun 2021 17:13:56 -0400 Message-Id: <20210605211402.20304-13-kyle@kyleam.com> In-Reply-To: <20210605211402.20304-1-kyle@kyleam.com> References: <20210605211402.20304-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: B5uMBVtE89hx In debbugs threads, it's not uncommon for a leading "[bug#NNN]" in the subject to be converted to "bug#NNN:" [*]. I'm not sure what the source of this is, but it prevents the suppression of an otherwise identical subject. It's probably not worth normalizing before the comparison to get full suppression, but it'd be nice to at least elide the main part of the subject so it's more obvious that it didn't change. Add a special case so that "bug#NNN:" prefix is treated the same as a bracketed prefix. [*] example: https://yhetil.org/guix-patches/20201128051435.30580-1-kyle@kyleam.com --- My guess, which I haven't tried to confirm at all, is that the "[bug#NNN]" => "bug#NNN:" conversion is triggered via the debbugs.el interface. piem-lei.el | 14 ++++++++++++-- tests/piem-lei-tests.el | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/piem-lei.el b/piem-lei.el index f7ccc6e4..3760176c 100644 --- a/piem-lei.el +++ b/piem-lei.el @@ -345,8 +345,18 @@ (defvar piem-lei-query--subject-split-re (rx string-start ;; Prefix. (group (zero-or-more space) - (one-or-more "[" (one-or-more (not (any "]" "\n"))) "]" - (one-or-more space))) + (or (and (one-or-more (and "bug#" (one-or-more digit) ":")) + (one-or-more space) + (zero-or-more + ;; This pattern... + "[" (one-or-more (not (any "]" "\n"))) "]" + (one-or-more space))) + (one-or-more + ;; ... is repeated here. Extract it to an rx-let + ;; binding once minimum Emacs version is at least + ;; 27. + "[" (one-or-more (not (any "]" "\n"))) "]" + (one-or-more space)))) ;; Main subject. A match consists of at least two islands of ;; non-space characters because there's not much point in ;; eliding one word. diff --git a/tests/piem-lei-tests.el b/tests/piem-lei-tests.el index 71dc1099..dd58360b 100644 --- a/tests/piem-lei-tests.el +++ b/tests/piem-lei-tests.el @@ -110,7 +110,11 @@ (ert-deftest piem-lei-query--elide-subject:elide () (should (equal (concat "[bug#00000] [PATCH v2] " piem-lei-tests-elide-string) (piem-lei-query--elide-subject "[bug#00000] [PATCH] abc def" - "[bug#00000] [PATCH v2] abc def")))) + "[bug#00000] [PATCH v2] abc def"))) + (should (equal (concat "bug#00000: [PATCH v2] " piem-lei-tests-elide-string) + (piem-lei-query--elide-subject + "[bug#00000] [PATCH] abc def" + "bug#00000: [PATCH v2] abc def")))) (provide 'piem-lei-tests) ;;; piem-lei-tests.el ends here -- 2.31.1