From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id QHgbOwHte2aTkwAA62LTzQ:P1 (envelope-from ) for ; Wed, 26 Jun 2024 10:27:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id QHgbOwHte2aTkwAA62LTzQ (envelope-from ) for ; Wed, 26 Jun 2024 12:27:14 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; 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; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=adamkovic.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1719397633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: references:references:list-id:list-help:list-owner:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=rE4buciex62DDi5WYzTfkWKKtuQe7A2QamwdkhrEimI=; b=bvpHVZZso+MSO0WxOCTl32Mpf6tLepF571Niwh8ZM7YUhc/pkkowEmppskEdGauw0SPGit 1pg5hE4PWI0w86aPZ7nBInhZ/05OclvYpFu6kdGhUGBI82GK/0W/IMp1qOIBG4DKunn2zv PmOu/Fy/+RXjhMQMcfW4DjANt162rSITHBejYPXyVK9O5J1Jq1gwtBZoUa1agNkMN+u/zC rEfdEdKIn3bH8Qt9nTLPnE9PK0IhteY+ab9ti/u/iV9vBH4mdk3/SRLaGHrzxGB0rUQZR2 MDnZdmj+zaLyprtulrMKUgBNKRJnscuwPupIi6y4PVM35+hTvIrQo4i0DufiVA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1719397633; a=rsa-sha256; cv=none; b=ta4y1SR9d7QAdQPNAg//Df7ROsW70B9W3KC6J9SfONqEU+IN0Oj/L1/PRl4mKo5gaMYRy1 hH3qNgXtomkus5CQSxE/EuGvGPMW7Si2OMJj3A4+RM4FU4FTOAOiBPPxZP4qFUSb+Q2Gy8 ZNsSBkPlSPk0zKvdh8Q2tF0UDxDku1LOgGszkm9UsQ7g05f5gS5Xrqt2zOOCop8FdoIFk5 709GByPBXRvwLoxyH+Yi6qGs3AtVzhQ4pnIlmyrR1qC/4cQtq0Cxt9XqyhfoXgRNC59zD6 RacFZQDVjrmNS0evB/1eghN4Acp6XjdO9FeKgpSqtdXKz4EZhH7VizUhOv5oCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; 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; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=adamkovic.org (policy=none) 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 7891E60262 for ; Wed, 26 Jun 2024 12:27:13 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2B2FF5F82D; Wed, 26 Jun 2024 10:27:05 +0000 (UTC) X-Greylist: delayed 413 seconds by postgrey-1.36 at yantan; Thu, 20 Jun 2024 12:36:10 UTC Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) by mail.notmuchmail.org (Postfix) with ESMTPS id 2FCFB5F7E6 for ; Thu, 20 Jun 2024 12:36:10 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id E8BB31380468 for ; Thu, 20 Jun 2024 08:29:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 20 Jun 2024 08:29:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1718886555; x=1718972955; bh=yI8rjb5cDChPXr/Dy+4CB 8Wu0aoH8twccPQP8MMU0gA=; b=KbYlEVnCKrW5bo4Wam3nZp4MspGzQ/GqlG2Ez 3+9Dtf27Bg5h/xtgrBsE0PvNZlTQ30NHhdjxOx4YySC0d8OBPA+MDxzEszYoPIW7 MWnnVe4EO+Q1OgvjhOd3xtFGLZXbfafu7WPzlc04OeNU710Yr971m41Xl9GT/Cln 2tjokvqkKDRqy4kzsdYT0Va0RpiLBHL4R7bcP2TYc6KF4h6BUYSA1uvRwPf7KpoQ QYjXWG9mbQphx7OwMxtdWJrsJFKyIE/zqqU2Qyqv0nwy99TPbMQQGQoX8blK+RHu sxWWMXz23ViEDhVNZKKDoRhm7IGSil6G/eMQp3E+woHVlLlbw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1718886555; x=1718972955; bh=yI8rjb5cDChPXr/Dy+4CB8Wu0aoH 8twccPQP8MMU0gA=; b=jOkEIjcsmvccg+gIzgEtbQA2U6zDyV0+9iSFEUuqP3Ft lL4YWFVLW6QUwDfe1/s5HZYz+YhEdujQPI1PgpaE6gacBT8SQJO/fMpoHem9u2aF kFIglIYvgVk147DTNTVzU+1Udw/NOmlAzRK1fCp+9jlAZUOz8HIwv4ArC36uK0d3 6nHTlwhhybXE8QTCsO2k4suCYUnlkwaHj3GEBZyLKYRzvucKLxLWaug9ydRZq+DQ SBeo1XJx5Suj1cuNUWMbtcbmB046D8ZjTfOHGRDbQWfrlKrwRMHywP00wi6D7PGq IMN3UpcCTczXlntb1SFU0GHYidYLDPFuktuRzYvTXg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeefvddgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufhffkfggtgesmhdtreertd dtjeenucfhrhhomheptfhuugholhhfucetuggrmhhkohhvihgtuceorhhuugholhhfsegr uggrmhhkohhvihgtrdhorhhgqeenucggtffrrghtthgvrhhnpeekkeeitefgueelkeefhe fgtedvkeekvdfhffffuddtjeehffevvdfhfeelvefgjeenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhguohhlfhesrggurghmkhhovhhitg drohhrgh X-ME-Proxy: Feedback-ID: i88214938:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 20 Jun 2024 08:29:14 -0400 (EDT) From: =?utf-8?Q?Rudolf_Adamkovi=C4=8D?= To: notmuch@notmuchmail.org Subject: Fwd: [PATCH] Fix saved-search buffer titles References: Date: Thu, 20 Jun 2024 14:29:10 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-MailFrom: rudolf@adamkovic.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 Message-ID-Hash: QKTQ4YGWQL3OYAWSUQKLEBNLBH3UJST7 X-Message-ID-Hash: QKTQ4YGWQL3OYAWSUQKLEBNLBH3UJST7 X-Mailman-Approved-At: Wed, 26 Jun 2024 10:27:03 +0000 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: X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Migadu-Spam-Score: 0.41 X-Spam-Score: 0.41 X-Migadu-Queue-Id: 7891E60262 X-Migadu-Scanner: mx11.migadu.com X-TUID: g/nGwrV48J4A --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ping. -------------------- Start of forwarded message -------------------- From: Rudolf Adamkovi=C4=8D To: notmuch@notmuchmail.org Subject: [PATCH] Fix saved-search buffer titles Date: Thu, 14 Dec 2023 23:50:14 +0100 --=-=-= Content-Type: multipart/mixed; boundary="==-=-=" --==-=-= Content-Type: text/plain Content-Disposition: inline Fellow hackers, So, I have always wondered why Notmuch uses the strangest buffer titles ever, and yesterday I decided to take a look under the hood... I found that the code in 'notmuch-search-buffer-title' defines and uses a pair of variables, named 'longest' and 'longest-length', but never sets the latter, which causes the strange buffer titles I observe. Please see the attached patch with a fix. P.S. I could not make the test suite work, not in the time I had for the fix, so ... see the test in the commit message. :) Rudy --==-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-emacs-Fix-saved-search-buffer-titles.patch >From c0cb08a843b5c904642da639f94c4a5e43d1ef14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Wed, 13 Dec 2023 22:39:02 +0100 Subject: [PATCH] emacs: Fix saved-search buffer titles REPRODUCTION STEPS: (let ((notmuch-saved-searches (list (list :name "Emacs List" :query "query:lists-emacs") (list :name "All Lists" :query "query:lists")))) (notmuch-search-buffer-title "query:lists-emacs" )) ACTUAL: "*notmuch-saved-search-[ All Lists ]-emacs*" EXPECTED: "*notmuch-saved-search-Emacs List*" --- emacs/notmuch.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6eef4af1..1ac145f0 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -964,17 +964,20 @@ unthreaded) and whether it's SAVED (t or nil)." (defun notmuch-search-buffer-title (query &optional type) "Returns the title for a buffer with notmuch search results." (let* ((saved-search - (let (longest - (longest-length 0)) - (cl-loop for tuple in notmuch-saved-searches - if (let ((quoted-query - (regexp-quote - (notmuch-saved-search-get tuple :query)))) - (and (string-match (concat "^" quoted-query) query) - (> (length (match-string 0 query)) - longest-length))) - do (setq longest tuple)) - longest)) + (cl-loop with match + with match-length = 0 + for candidate in notmuch-saved-searches + for length = (let* ((query* (notmuch-saved-search-get + candidate + :query)) + (regexp (concat "^" + (regexp-quote query*)))) + (and (string-match regexp query) + (length (match-string 0 query)))) + if (and length (> length match-length)) + do (setq match candidate + match-length length) + finally return match)) (saved-search-name (notmuch-saved-search-get saved-search :name)) (saved-search-type (notmuch-saved-search-get saved-search :search-type)) (saved-search-query (notmuch-saved-search-get saved-search :query))) -- 2.39.3 (Apple Git-145) --==-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable --=20 "The introduction of suitable abstractions is our only mental aid to organize and master complexity." --- Edsger Wybe Dijkstra, 1930-2002 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --==-=-=-- --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable -------------------- End of forwarded message -------------------- --=20 "I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it= ." --- Mark Twain, paraphrased Rudolf Adamkovi=C4=8D [he/him] http://adamkovic.org --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --=-=-=--