From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GE/vA0A5BGKeKwAAgWs5BA (envelope-from ) for ; Wed, 09 Feb 2022 22:59:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aC6qAEA5BGKXAAAAauVa8A (envelope-from ) for ; Wed, 09 Feb 2022 22:59:28 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (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 5E88E340F2 for ; Wed, 9 Feb 2022 22:59:27 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 01E265F714; Wed, 9 Feb 2022 21:59:25 +0000 (UTC) X-Greylist: delayed 4293 seconds by postgrey-1.36 at yantan; Wed, 09 Feb 2022 21:59:22 UTC Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 7AF005F711 for ; Wed, 9 Feb 2022 21:59:22 +0000 (UTC) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id B58771B0009A; Wed, 9 Feb 2022 23:59:21 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1644443961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L2VHlAZ1j/YT60Ifem+PSU2soyTNuvh8AgbK5HdOZ/s=; b=pQZ/wWc/OckBSRbmeSeUghjSy/jkwaM9bPLkDU8lPlhLcuqAmg7bqixvIbxVi7crT5NQ48 GfDyfvw9YMx5sFmgtD9x5gGDdy7vbTgW9RxLNEvmMHDh6DF6W56AZ8MEu40YTldZ1ndw9A IrahqRt2ByvY6PL63u6irAMk9xFyPHHcThG/dInt9K+wq9RkqYcP5GaCCJ80TUJNg/mML/ 28nEt21f+7t7rLAt0bEKAo0dyT+qVyzFhJ9KKPc/aRg6k4F8WjKPZ9edErsHqqdZxub0Wp eTzaIH1bLqy7ksV8vmn2fxqzchWEdvWyR8GhZcgVX5FCbSnoUh43jazx82cMnQ== From: Tomi Ollila To: Utkarsh Singh , Notmuch mailing list Subject: Re: [PATCH] emacs: Add more front ends for address completion In-Reply-To: <87bkzhbez9.fsf@gmail.com> References: <87bkzhbez9.fsf@gmail.com> User-Agent: Notmuch/0.35+4~ge2bb4cd (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1644443961; a=rsa-sha256; cv=none; b=KqBeA+QJVt9vrNVutqIXLPBr9tigkUYpNlJbJ6divCfgXpCzFk77p01jC9HmBYB3gn/i6F xzSWtD3kV7wRplhHXikzPx/rfFqp+agaZSPp6wP2E39Nxf6jYdz3MwYUCyVCEFQsj2NUzX 9uaS2zecFP6xIVxU1+9Xm71rwSEPl8peZvEJ8HlwruaKPlH3ZRU2+yU/CCOqxuSZGEikPt 2eCxYV/rIHQiFC4wYqpRT8wJiqsZlu2RffH/maF3qfx5pmmzKbYDXRw08P3NIKIBm9o2id nji0bv1DYa4kjl86Uutpw/kbL2NJBQl98JrE/+13QuvBZDol0lmJ7cSQvT/w7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1644443961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L2VHlAZ1j/YT60Ifem+PSU2soyTNuvh8AgbK5HdOZ/s=; b=UObhWwsrMsV4xNKKfZmUOBU2iPHzjhEzwLWNmOmqmdGJbJvJ4+XQEClYDmrFTnA74jwKNI +WkInlSE+7q3ZlYHlNv0E8IPZV6hS8iSY2mN15PYNZdIoVjpbh6zDKg713lPPpBRmGMW6u 5STaJodoaPyuXevRdkqAlAbM/Tp9JXKsuxK4PlyKq5l1bcubZyjFb4+5gDW5VCJtlfazbU 6iITXJ3RmZ/xJYNhZjMQIjLOY00Gjpn3SThABnSo1xFSNyHchVmFkySRj1mk0j3uszT2Nx 7M1+TYUbbaAXiX9lcKnRp0ITtBWPNsI8sOZ2XINNo4LHTsoyKOuN1Dst/BJsOA== Message-ID-Hash: DWSNBTCCMDY2JWIYPGNTNOY63D2AW2XW X-Message-ID-Hash: DWSNBTCCMDY2JWIYPGNTNOY63D2AW2XW X-MailFrom: tomi.ollila@iki.fi 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-Country: DE ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644443967; 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:dkim-signature; bh=OxQL8lVzvYFNwFiIzbJIa1OKbt0391SGPAwgWPfbUDI=; b=Hhznpt1YstPzuOjZbd86U8X8scHGa2N53ZPwbTIrfAb6TYYPj7s+zht0kMf63txtWvo/se 7A1gduoWBR+6NNv+wBjNjuz+ktG4ygkzBczO2oOnzfuygu9ZyQBIVt92t0fRhPd/wMfXrI MR9xhLWjqg6c1iUEp7aumzDFpFNmMnLtSqHc+KTiGpsrn5DsVjfv1CGgJkb7lNywBbhxnc aTTlzyRFyTN8nnD57aVjqPZtxmo5nop85YS00Ts9oV43xE7tFmCvnTrT+adzMvhhX5Fkmv J+bk67QfdaorHPDX9ktK1wGJm/NKVJeQs89BzvPkSwWI/X+Jd1oHo+XzgFvOLg== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1644443967; a=rsa-sha256; cv=fail; b=cBmLyFc7skR+WoYJaS6p2P2To3Qcha3r2Re0D5MxgORD5dSPtj5dKrxzun/ocme+g/0IYG 5814gee2ftmLXxC+zX+tC9uiQhMDZpygk6zErK1GWzBrMM+Ic57eXSPnCeW4yrIELNws76 gBCDdLU+x53ukuu5lTUD9uLPIvFzB5ryQ1HddYIIfBQ2KWqWW9P17wMR6LlIKXXqHKQyHe /4YjjezMjXvYemIpFMNCnSrAC2qQYqyxcLenh5bXFISw7yTLfcOTY+LUZ+qtpfB7JkOeO1 m2AsKMzacfFPn3BLT8qvU5fIWRuB/MdVhFHdEBXr4XOjRK7vm/pTzSNUBDNFvA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b="pQZ/wWc/"; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.83 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b="pQZ/wWc/"; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 5E88E340F2 X-Spam-Score: -0.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: WHGh+jKoMLLJ On Tue, Feb 08 2022, Utkarsh Singh wrote: > Hello maintainers, > > Emacs Lisp Package Archive (ELPA) now includes a package called 'corfu', > according to its documentation: > > Corfu enhances the default completion in region function with a > completion overlay. The current candidates are shown in a popup > below or above the point. Corfu is the minimalistic > ~completion-in-region~ counterpart of the > [[https://github.com/minad/vertico][Vertico]] minibuffer UI. > > Hence, this patch tries to add support for `completion-in-region' in > `notmuch-address-expand-name'. By default, this behaviour is turned off > so that existing users can enjoy existing completion techniques. The current "default" (i.e. w/o any notmuch emacs mua configuration) is to use completing-read to do the completion. If "company" is available, then company is used by default (w/ all address harvesting and so on...). This is "messy" enough ;( (i.e the notmuch-address-selection-function is called if company mode is not available or notmuch-address-command is a string instead of 'internal or 'as-is (or whatnot, too tired to do deep investigation there ;/) This change, contributes even more "complexity" there. To keep the complexity to the same level would be adding more notmuch-address-selection-functions and have the defcustom there list the options (also probably the name of notmuch-address-selection-function would need to be changed to notmuch-fallback-address-selection-function ;/) Also, if name was notmuch-address-selection-function but its interface changed, current users using their own functions (I am in that list) would get error there (the interface would have to be (defun notmuch-address-selection-function (prompt collection initial-input &optional beg end) to be backward compatible) If name was changed then their own function would not be used -- which is OK, things change and users can read from NEWS how to be compatible again... All this said, I think this is not simple to solve, as this otherwise fine change would indicate :/ Tomi > > Thank you, > Utkarsh Singh > -- > Utkarsh Singh > https://utkarshsingh.xyz/ > From fdc88b81fef763f7d7dcdc899aa8e90482c574fa Mon Sep 17 00:00:00 2001 > From: Utkarsh Singh > Date: Tue, 8 Feb 2022 19:17:26 +0530 > Subject: [PATCH] emacs: Add more front ends for address completion > > Add support for address completion through completion-in-region. > * notmuch-address.el (notmuch-address-use-completion-in-region): > Introduce customizable variable to activate the new front end. > (notmuch-address-selection-function, notmuch-address-expand-name): Use > it. > --- > emacs/notmuch-address.el | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el > index 1a4cdda2..cfb56a3a 100644 > --- a/emacs/notmuch-address.el > +++ b/emacs/notmuch-address.el > @@ -123,10 +123,10 @@ you should make sure it is not somewhere publicly readable." > (defcustom notmuch-address-selection-function 'notmuch-address-selection-function > "The function to select address from given list. > > -The function is called with PROMPT, COLLECTION, and INITIAL-INPUT > -as arguments (subset of what `completing-read' can be called > -with). While executed the value of `completion-ignore-case' > -is t. See documentation of function > +The function is called with PROMPT, COLLECTION, INITIAL-INPUT, > +BEG and END as arguments (subset of what `completing-read' can be > +called with). While executed the value of > +`completion-ignore-case' is t. See documentation of function > `notmuch-address-selection-function' to know how address > selection is made by default." > :type 'function > @@ -150,13 +150,19 @@ matching `notmuch-address-completion-headers-regexp'." > :group 'notmuch-send > :group 'notmuch-address) > > +(defcustom notmuch-address-use-completion-in-region nil > + "Use `completion-in-region' for address completion." > + :type 'boolean > + :group 'notmuch-send > + :group 'notmuch-address) > + > ;;; Setup > > -(defun notmuch-address-selection-function (prompt collection initial-input) > - "Call (`completing-read' > - PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)" > - (completing-read > - prompt collection nil nil initial-input 'notmuch-address-history)) > +(defun notmuch-address-selection-function (prompt collection initial-input beg end) > + (if notmuch-address-use-completion-in-region > + (completion-in-region beg end collection) > + (completing-read > + prompt collection nil nil initial-input 'notmuch-address-history))) > > (defvar notmuch-address-completion-headers-regexp > "^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):") > @@ -245,7 +251,9 @@ requiring external commands." > (funcall notmuch-address-selection-function > (format "Address (%s matches): " num-options) > options > - orig))))) > + orig > + beg > + end))))) > (if chosen > (progn > (push chosen notmuch-address-history) > -- > 2.35.1