From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] EUDC email addresses via completion-at-point in message-mode Date: Sat, 30 Apr 2022 02:04:05 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1160"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: emacs-devel@gnu.org To: Alexander Adolf Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 30 01:05:03 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nkZfa-000AWx-0G for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Apr 2022 01:05:02 +0200 Original-Received: from localhost ([::1]:43016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nkZfY-0006Xy-Eh for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Apr 2022 19:05:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkZek-0005ei-HW for emacs-devel@gnu.org; Fri, 29 Apr 2022 19:04:10 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:55841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nkZei-0006vR-N3 for emacs-devel@gnu.org; Fri, 29 Apr 2022 19:04:10 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id F2A045C0148; Fri, 29 Apr 2022 19:04:07 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 29 Apr 2022 19:04:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1651273447; x=1651359847; bh=i1dTUYjslj zsuv8WMbV32u385suAeBf5+LdVb1lFzXk=; b=Mga74LwseZZoUhb0bksvjQtxVW zWjxagFWkEWd1kQsm0mxm9MDtBu1k5oXLsuIhi2JLgkSkCS/PcmGwNnfltptmZij 5FCCY1osgBDyQXd3W7tRws9Hxdfyow1kQ0PSZA+gIhW8OCLOJx7LVffx0fQ4zU2x WnTb/fDbiQCbyerdqaI+FM7NZT4IbaYyGiwnFQgkNmtZP/doHlFo5S2DVw2Y2Zn+ 4Pf094UrVaq0MppHQ2Et4cuCdSfmgHeMGHzV5qaF8miyhPXzy2hgbL+7f3Hn4BOB v1iCDCURlEfzFqEDw6oxOLHouQAh+zS+MfH1kveURoN+PfYLJ9g2dYbprGRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1651273447; x= 1651359847; bh=i1dTUYjsljzsuv8WMbV32u385suAeBf5+LdVb1lFzXk=; b=Z xX5H+1JLhiGHqxCMOfMGyy8U325hl0Gl7g6X9AcKtXHSyFqxqFsMPqqeoI3qICXZ xMMPYKuLOuZLKHw3nXdrhtoK2ryUzZ0ZfHXNisEr5UVN7hIEM5yKFjySrKXTFEAR maP5hHA6PsLKsJqQ3i3WrwutiKsYLp576BSa8P+Q8P/U8xHxcomPW+WIwI/T/3cH zL0Qgk9giIHiRtHdoCFzYD3GRA9pzp7TBaZ7gn2pye/zazCKHgr6d71VOuIrmI8d KQEueg0O3wtGeN7j9/EG3ItgYwQt00rivMioYS4tj7HMYhQuFZOLlwSxEpJn7xhC JIzsUy8zr5FSHZ4LZD/lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddtgdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufgjfhgffffkgggtsehttdertddtredtnecuhfhrohhmpefhihhlihhp phcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrf grthhtvghrnhepfffhjeevieeiiedutefgheffleeiveeffeeftdekleehledufeeuuedu heevieffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epfhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Apr 2022 19:04:07 -0400 (EDT) In-Reply-To: (Alexander Adolf's message of "Thu, 28 Apr 2022 19:15:15 +0200") Mail-Followup-To: Alexander Adolf , emacs-devel@gnu.org Received-SPF: pass client-ip=66.111.4.29; envelope-from=fgunbin@fastmail.fm; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289024 Archived-At: Hello Alexander, On 28/04/2022 19:15 +0200, Alexander Adolf wrote: >>> + (progn >>> + (setq-local completion-styles '(substring partial-completion)) >>> + (let* ((beg (save-excursion >>> + (if (re-search-backward "\\([:,]\\|^\\)[ \t]*" >>> + (point-at-bol) 'move) >> >> t instead of 'move? > > Hm. Quoting from the docstring (re-search-forward in this case): > ---------------------------- Begin Quote ----------------------------- > The optional third argument NOERROR indicates how errors are handled > when the search fails. If it is nil or omitted, emit an error; if it > is t, simply return nil and do nothing; if it is neither nil nor t, > move to the limit of search and return nil. > ----------------------------- End Quote ------------------------------ > > This reads as if t ("do nothing") vs. 'move ("move to the limit of > search") should make a difference? A few quick experiments seem to > indicate that in practice both seem to behave the same though. In this > light, I'm fine with changing 'move to t. Well honestly I was fooled by save-excursion, and didn't notice the return value of (point), with which the value we're talking about _may_ matter. However, your regexp will always match, due to \\|^ branch which will find bol, so you can just do: (save-excursion (re-search-backward "\\([:,]\\|^\\)[ \t]*") (match-end 0)) >> Can it be done in some other way? > > Short answer: I don't think so. > > Longer answer: > > The motivation for putting this is that completion-at-point filters the > completion tables based on completion-styles. Thus, if completion-styles > is set too restrictive, useful results may not be offered to the user. > The default completion-styles in message-mode is '(basic > partial-completion emacs22). I wanted 'substring to be the primary as it > matches the search term anywhere within the candidate, as opposed to > 'basic which matches it at the beginning only. In this respect, you > might view 'substring as a super-set of 'basic. > > That said, it would probably be desirable for message mode to have > different values for both, completion-at-point-functions and > completion-styles, depending on where point is (email header, newsgroup > header, message body, etc.). But this seems like a wider discussion > about the architecture of message.el rather than this patch. Yes, sounds like another use case for completion-category-overrides. Thanks.