From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4PWeMC9TumKFAgAAbAwnHQ (envelope-from ) for ; Tue, 28 Jun 2022 03:02:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2NOWMC9TumKxiQAAauVa8A (envelope-from ) for ; Tue, 28 Jun 2022 03:02:39 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6C28320738 for ; Tue, 28 Jun 2022 03:02:39 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id EBB765E545; Tue, 28 Jun 2022 01:02:22 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2EDD15E54C for ; Tue, 28 Jun 2022 01:02:19 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 80BD75FBD7; Mon, 27 Jun 2022 21:02:18 -0400 (EDT) Received: (nullmailer pid 1569347 invoked by uid 1000); Tue, 28 Jun 2022 01:02:13 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 3/5] emacs/show: obey notmuch-show-max-text-part-size for part 0 Date: Mon, 27 Jun 2022 22:02:03 -0300 Message-Id: <20220628010205.1567784-4-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220628010205.1567784-1-david@tethera.net> References: <20220628010205.1567784-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: EVP6OAHHIIR2GVLHR56IIZQ3TBUSCAD6 X-Message-ID-Hash: EVP6OAHHIIR2GVLHR56IIZQ3TBUSCAD6 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656378159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=5A0a3Evvq/sRU4w5ueMJbkQd13oZKGDuNAEAXLg5ic8=; b=ZIB3Zzbo5xdafejpxHkFeeDghKWWFRElsoMWqmrjVosuCIscFMf39qIkqRqz14TWhZBVHb iDPhF5gkWS4zOggl2PiFCSRjJCz19XhH3mhX6jFs6vCWcPLVFt4jgGe4yGlM7JcWuHzev4 UFRT1A5PI4dOmUWxkHdjnCYLigSzBhIpEL2c9g7WJKCrbS7op+E1QdQfdp+o4JIwW1VZ1N GVW4YTz1lqg+zfoEcetDxmgBO/nGg9F97QpG3o5ykzuF1k49EUZnVEt7kwq0PU4wpKasi9 otmxfzjQ8Rwc9hffFrpX9ljUoWKV68AYXIhrtAQHA8cvIyV1/xvC1y8nCoKyMw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656378159; a=rsa-sha256; cv=none; b=HcndPJW8i0jFO2huZ18Ny7jPQwPoqPmf2MNKLKYdIol5u8ylpy28cFVR2/eppIcbpX4p2z PoOvGVL394bc2rwCcPxCfkRICdlcgTLsp0btbL4gCCZ77/tJZoqLW8Bvsc4Xh8X/x8Lk0I TZqqMSJW4+vz4qM01t6IOFk7AQkQH7l3UHMXUeeVeZvG0BuQD9y/i2SJyTrX8ndrDKjs0g iPRf9JYYkxdfC4NaSKNn6izqOlLTRHEAFGYoJYNis7HZgaEg+XtCSS64nnDLerqTvfEsVO fu3Sh09xJTRT3ovY8jcqO1y9bwYQGC2u9RlTTDmdBQPC9Zt+SvoDI9Q8zwuVYw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.21 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 6C28320738 X-Spam-Score: -1.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: WFOGFUjqMvU+ This parameter was originally introduced to hide large attachements that happened to be text/plain. From a performance point of view, there is no reason not to also hide large message bodies. --- doc/notmuch-emacs.rst | 3 + emacs/notmuch-show.el | 2 +- test/T450-emacs-show.sh | 18 ++++ .../notmuch-show-size | 64 +++++++++++++ .../notmuch-show-size-450 | 89 +++++++++++++++++++ 5 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 test/emacs-show.expected-output/notmuch-show-size create mode 100644 test/emacs-show.expected-output/notmuch-show-size-450 diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst index c2d16c5f..d6fa37e0 100644 --- a/doc/notmuch-emacs.rst +++ b/doc/notmuch-emacs.rst @@ -280,6 +280,9 @@ Display of messages can be controlled by the following variables :index:`notmuch-show-depth-limit` |docstring::notmuch-show-depth-limit| +:index:`notmuch-show-max-text-part-size` + |docstring::notmuch-show-max-text-part-size| + :index:`notmuch-multipart/alternative-discouraged` Which mime types to hide by default for multipart messages. diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index bac259f2..a25ea061 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1049,7 +1049,7 @@ is t, hide the part initially and show the button." (beg (point)) ;; This default header-p function omits the part button for ;; the first (or only) part if this is text/plain. - (button (and (or deep + (button (and (or deep long (funcall notmuch-show-insert-header-p-function part hide)) (notmuch-show-insert-part-header nth mime-type diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index 0749dc9d..e9c59cd3 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -109,6 +109,24 @@ test_emacs '(let ((notmuch-show-depth-limit 1)) (test-visible-output))' test_expect_equal_file $EXPECTED/notmuch-show-depth-1 OUTPUT +test_begin_subtest "Hide bodies of messages by size" +test_emacs '(let ((notmuch-show-max-text-part-size 1)) + (notmuch-search "thread:{id:87ocn0qh6d.fsf@yoom.home.cworth.org}") + (notmuch-test-wait) + (notmuch-search-show-thread) + (notmuch-test-wait) + (test-visible-output))' +test_expect_equal_file $EXPECTED/notmuch-show-size OUTPUT + +test_begin_subtest "Hide bodies of messages by size > 450" +test_emacs '(let ((notmuch-show-max-text-part-size 450)) + (notmuch-search "thread:{id:87ocn0qh6d.fsf@yoom.home.cworth.org}") + (notmuch-test-wait) + (notmuch-search-show-thread) + (notmuch-test-wait) + (test-visible-output))' +test_expect_equal_file $EXPECTED/notmuch-show-size-450 OUTPUT + test_begin_subtest "notmuch-show: elide non-matching messages (w/ notmuch-show-toggle-elide-non-matching)" test_emacs '(let ((notmuch-show-only-matching-messages nil)) (notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir storage\"") diff --git a/test/emacs-show.expected-output/notmuch-show-size b/test/emacs-show.expected-output/notmuch-show-size new file mode 100644 index 00000000..cdde467e --- /dev/null +++ b/test/emacs-show.expected-output/notmuch-show-size @@ -0,0 +1,64 @@ +Lars Kellogg-Stedman (2009-11-17) (inbox signed) +Subject: [notmuch] Working with Maildir storage? +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 14:00:54 -0500 + +[ multipart/mixed ] +[ multipart/signed ] +[ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] +[ text/plain (hidden) ] +[ application/pgp-signature ] +[ text/plain (hidden) ] + Mikhail Gusarov (2009-11-17) (inbox signed unread) + Subject: Re: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Wed, 18 Nov 2009 01:02:38 +0600 + + [ multipart/mixed ] + [ multipart/signed ] + [ Unknown key ID 0x9D20F6503E338888 or unsupported algorithm ] + [ text/plain (hidden) ] + [ application/pgp-signature ] + [ text/plain (hidden) ] + Lars Kellogg-Stedman (2009-11-17) (inbox signed) + Subject: Re: [notmuch] Working with Maildir storage? + To: Mikhail Gusarov + Cc: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 15:33:01 -0500 + + [ multipart/mixed ] + [ multipart/signed ] + [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] + [ text/plain (hidden) ] + [ application/pgp-signature ] + [ text/plain (hidden) ] + Mikhail Gusarov (2009-11-17) (inbox unread) + Subject: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Wed, 18 Nov 2009 02:50:48 +0600 + + [ text/plain (hidden) ] + Keith Packard (2009-11-17) (inbox unread) + Subject: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 13:24:13 -0800 + + [ text/plain (hidden) ] + Lars Kellogg-Stedman (2009-11-18) (inbox signed unread) + Subject: Re: [notmuch] Working with Maildir storage? + To: Keith Packard + Cc: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 19:50:40 -0500 + + [ multipart/mixed ] + [ multipart/signed ] + [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] + [ text/plain (hidden) ] + [ application/pgp-signature ] + [ text/plain (hidden) ] + Carl Worth (2009-11-18) (inbox unread) + Subject: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Wed, 18 Nov 2009 02:08:10 -0800 + + [ text/plain (hidden) ] diff --git a/test/emacs-show.expected-output/notmuch-show-size-450 b/test/emacs-show.expected-output/notmuch-show-size-450 new file mode 100644 index 00000000..ec34612e --- /dev/null +++ b/test/emacs-show.expected-output/notmuch-show-size-450 @@ -0,0 +1,89 @@ +Lars Kellogg-Stedman (2009-11-17) (inbox signed) +Subject: [notmuch] Working with Maildir storage? +To: notmuch@notmuchmail.org +Date: Tue, 17 Nov 2009 14:00:54 -0500 + +[ multipart/mixed ] +[ multipart/signed ] +[ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] +[ text/plain (hidden) ] +[ application/pgp-signature ] +[ text/plain ] +[ 4-line signature. Click/Enter to show. ] + Mikhail Gusarov (2009-11-17) (inbox signed unread) + Subject: Re: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Wed, 18 Nov 2009 01:02:38 +0600 + + [ multipart/mixed ] + [ multipart/signed ] + [ Unknown key ID 0x9D20F6503E338888 or unsupported algorithm ] + [ text/plain ] + + Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did + gyre and gimble: + + LK> Resulted in 4604 lines of errors along the lines of: + + LK> Error opening + LK> + /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S: + LK> Too many open files + + See the patch just posted here. + + [ 2-line signature. Click/Enter to show. ] + [ application/pgp-signature ] + [ text/plain ] + [ 4-line signature. Click/Enter to show. ] + Lars Kellogg-Stedman (2009-11-17) (inbox signed) + Subject: Re: [notmuch] Working with Maildir storage? + To: Mikhail Gusarov + Cc: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 15:33:01 -0500 + + [ multipart/mixed ] + [ multipart/signed ] + [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] + [ text/plain (hidden) ] + [ application/pgp-signature ] + [ text/plain ] + [ 4-line signature. Click/Enter to show. ] + Mikhail Gusarov (2009-11-17) (inbox unread) + Subject: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Wed, 18 Nov 2009 02:50:48 +0600 + + [ text/plain (hidden) ] + Keith Packard (2009-11-17) (inbox unread) + Subject: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 13:24:13 -0800 + + [ text/plain (hidden) ] + Lars Kellogg-Stedman (2009-11-18) (inbox signed unread) + Subject: Re: [notmuch] Working with Maildir storage? + To: Keith Packard + Cc: notmuch@notmuchmail.org + Date: Tue, 17 Nov 2009 19:50:40 -0500 + + [ multipart/mixed ] + [ multipart/signed ] + [ Unknown key ID 0xD74695063141ACD8 or unsupported algorithm ] + [ text/plain ] + > I've also pushed a slightly more complicated (and complete) fix to my + > private notmuch repository + + The version of lib/messages.cc in your repo doesn't build because it's + missing "#include " (for the uint32_t on line 466). + + [ 4-line signature. Click/Enter to show. ] + [ application/pgp-signature ] + [ text/plain ] + [ 4-line signature. Click/Enter to show. ] + Carl Worth (2009-11-18) (inbox unread) + Subject: [notmuch] Working with Maildir storage? + To: notmuch@notmuchmail.org + Date: Wed, 18 Nov 2009 02:08:10 -0800 + + [ text/plain (hidden) ] -- 2.35.2