From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.bugs Subject: bug#56422: 29.0.50; mail-extract-address-components poorly handles " via " addresses Date: Wed, 06 Jul 2022 11:22:35 -0400 Message-ID: Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40522"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) To: 56422@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 06 17:23:09 2022 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 1o96rt-000ANg-CO for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Jul 2022 17:23:09 +0200 Original-Received: from localhost ([::1]:48482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o96rr-00080a-RQ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Jul 2022 11:23:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o96rm-00080S-9n for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2022 11:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o96rm-00073q-1m for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2022 11:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o96rl-0001UB-QJ for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2022 11:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sam Steingold Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Jul 2022 15:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56422 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16571209735680 (code B ref -1); Wed, 06 Jul 2022 15:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Jul 2022 15:22:53 +0000 Original-Received: from localhost ([127.0.0.1]:54875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o96rV-0001TQ-1Q for submit@debbugs.gnu.org; Wed, 06 Jul 2022 11:22:52 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o96rR-0001TG-9s for submit@debbugs.gnu.org; Wed, 06 Jul 2022 11:22:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o96rR-0007wo-34 for bug-gnu-emacs@gnu.org; Wed, 06 Jul 2022 11:22:41 -0400 Original-Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]:42913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o96rO-00070l-VS; Wed, 06 Jul 2022 11:22:40 -0400 Original-Received: by mail-qt1-x82f.google.com with SMTP id g14so18668194qto.9; Wed, 06 Jul 2022 08:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:user-agent:return-receipt-to:reply-to:date :message-id:mime-version; bh=2tlD6/r2K7Y9i3eFUtVRl8oHCH3BVJURAB5IYsvmOc8=; b=koUSr/kT2phXFdlQqUK3U/sk0Htx0rv9hgf8yEBkIYWzJL1NdUhWm4jUdAEtpwBZPN GZuyjxYi2Gc88lO1kx6dOA1BF0IjAuSZzbWifBebSHoSNjduW3sUHbR6LDjAngNAyDOE qZsnP/QLrSg5cqWNTqhVXnvd3b333VqTDrGzPmY7CWuvNsv1rvsHq52rQdWnmVLoXzoJ SDCL6PSWC6mTz7H4wkH/eyS5/403f+oIwIy6olSlvrnVVMfa0ktozz0Fn6TyCXJTakUY j3nfOAJUKYfZAeQDckVELzVocFT8VDAtGJx6DpnabMSKYTpdhz12PxG7891+xp+RfUXn 2e7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:user-agent :return-receipt-to:reply-to:date:message-id:mime-version; bh=2tlD6/r2K7Y9i3eFUtVRl8oHCH3BVJURAB5IYsvmOc8=; b=P81q+28iTYPSlD55ybE1Rjpci8T6+lrvw9edPJtoM1cbt3VeTrvjNPQVnLZyj+dmYy lgTjl3XdMZi6T+6z66lgHuNqczOyFrCm8muo31XQwtBmvHhFGZh4muMA13FteGMtYXMK R0cGaYbszwR8WBajVHCx3wnU5QoqKj5tgL7AtMRQ18ZQfWMYpeNPl7U8okLKVVQDZ942 axpSi2fUeQBZzlBCTk9+PJsyCawk6plZ04w3xVx5kTcLazEo4B3tYVNFP+kKQvH0CFfn pMRS+Z1oO1wAcMALyrQo14EHQJQKl702HW0behHCVBjlcpEApkR6K/323ddhllnRgpxA 1IqQ== X-Gm-Message-State: AJIora/fnNJqOi0ciIje9uCmUI7v+OASXaQCFFFwWv97Z49plwUFUhfR yvmDrC29ahzOhUzoMaEsFnrU+2AcrA== X-Google-Smtp-Source: AGRyM1tR6GGUyz8mWETqFrLXkmnQ51uAMTTpNC14UDssRp5znlTNG5r8ZfZS42jfh5Nm9E3b9gc7Aw== X-Received: by 2002:ac8:4e43:0:b0:31b:f4d0:3e2f with SMTP id e3-20020ac84e43000000b0031bf4d03e2fmr33224552qtw.34.1657120956930; Wed, 06 Jul 2022 08:22:36 -0700 (PDT) Original-Received: from 3c22fb11fdab.ant.amazon.com (pool-108-30-23-113.nycmny.fios.verizon.net. [108.30.23.113]) by smtp.gmail.com with ESMTPSA id 9-20020a05620a048900b006aee741fa3esm30439498qkr.40.2022.07.06.08.22.36 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 08:22:36 -0700 (PDT) X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Received-SPF: pass client-ip=2607:f8b0:4864:20::82f; envelope-from=sam.steingold@gmail.com; helo=mail-qt1-x82f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:236264 Archived-At: Often "From" email addresses in mailing lists look like this: --8<---------------cut here---------------start------------->8--- From: Po Lu via "Emacs development discussions." From: carlmarcos--- via Users list for the GNU Emacs text editor From: Stefan Monnier via Users list for the GNU Emacs text editor --8<---------------cut here---------------end--------------->8--- `mail-extract-address-components' handles them poorly: --8<---------------cut here---------------start------------->8--- (mail-extract-address-components "Po Lu via \"Emacs development discussions.\" ") => ("Po Lu via" "emacs-devel@gnu.org") (mail-extract-address-components "carlmarcos--- via Users list for the GNU Emacs text editor ") => ("carlmarcos" "help-gnu-emacs@gnu.org") (mail-extract-address-components "Stefan Monnier via Users list for the GNU Emacs text editor ") => ("Stefan Monnier via Users list for the" "help-gnu-emacs@gnu.org") --8<---------------cut here---------------end--------------->8--- The correct handling would be --8<---------------cut here---------------start------------->8--- (mail-extract-address-components "Po Lu via \"Emacs development discussions.\" ") => ("Emacs development discussions." "emacs-devel@gnu.org") (mail-extract-address-components "carlmarcos--- via Users list for the GNU Emacs text editor ") => ("Users list for the GNU Emacs text editor" "help-gnu-emacs@gnu.org") (mail-extract-address-components "Stefan Monnier via Users list for the GNU Emacs text editor ") => ("Users list for the GNU Emacs text editor" "help-gnu-emacs@gnu.org") --8<---------------cut here---------------end--------------->8--- or, at least, --8<---------------cut here---------------start------------->8--- (mail-extract-address-components "Po Lu via \"Emacs development discussions.\" ") => ("Po Lu via \"Emacs development discussions.\"" "emacs-devel@gnu.org") (mail-extract-address-components "carlmarcos--- via Users list for the GNU Emacs text editor ") => ("carlmarcos--- via Users list for the GNU Emacs text editor" "help-gnu-emacs@gnu.org") (mail-extract-address-components "Stefan Monnier via Users list for the GNU Emacs text editor ") => ("Stefan Monnier via Users list for the GNU Emacs text editor" "help-gnu-emacs@gnu.org") --8<---------------cut here---------------end--------------->8--- Please see the relevant discussion on the BBDB user list: https://lists.nongnu.org/archive/html/bbdb-user/2022-06/msg00000.html https://lists.nongnu.org/archive/html/bbdb-user/2022-07/msg00000.html In https://lists.nongnu.org/archive/html/bbdb-user/2022-07/msg00006.html I propose a workaround for a _single_ address (i.e., when the second argument to `mail-extract-address-components' is nil): --8<---------------cut here---------------start------------->8--- (defun mail-extract-handle-via (args) "Handle `via` in email address" (let ((address (car args)) (all (cadr args))) (if (and (null all) (string-match " via \\(.*\\)$" address)) (list (match-string 1 address) nil) (list address all)))) (advice-add 'mail-extract-address-components :filter-args 'mail-extract-handle-via) --8<---------------cut here---------------end--------------->8--- this is clearly suboptimal, especially when the "name" part of the address contains many words: --8<---------------cut here---------------start------------->8--- (mail-extract-address-components "Stefan Monnier via Users list for the GNU Emacs text editor ") ("Users list for the" "help-gnu-emacs@gnu.org") --8<---------------cut here---------------end--------------->8--- It appears that `mail-header-parse-address' is a better choice (as per https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10406) but you might still consider addressing this issue... Thank you. In GNU Emacs 29.0.50 (build 2, x86_64-apple-darwin21.5.0, NS appkit-2113.50 Version 12.4 (Build 21F79)) of 2022-07-05 built on 3c22fb11fdab.ant.amazon.com Repository revision: 59276ff81d1ab391f4e3cd91f3070a12c51a3507 Repository branch: master Windowing system distributor 'Apple', version 10.3.2113 System Description: macOS 12.4 -- Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113 http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com https://www.peaceandtolerance.org/ https://honestreporting.com The past is gone, the present is ephemeral, the future is a guess.