Re: Address completion in Emacs
authorDavid Edmondson <dme@dme.org>
Fri, 12 Dec 2014 12:14:37 +0000 (12:14 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:46:58 +0000 (14:46 -0700)
cc/dfb63a9c0853c1422160b3ed8ae63d14c81253 [new file with mode: 0644]

diff --git a/cc/dfb63a9c0853c1422160b3ed8ae63d14c81253 b/cc/dfb63a9c0853c1422160b3ed8ae63d14c81253
new file mode 100644 (file)
index 0000000..6b65813
--- /dev/null
@@ -0,0 +1,139 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 172E5431FBF\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Dec 2014 04:15:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7, UNPARSEABLE_RELAY=0.001]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id hdCSfxjzEakX for <notmuch@notmuchmail.org>;\r
+       Fri, 12 Dec 2014 04:14:41 -0800 (PST)\r
+Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com\r
+       [209.85.212.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 92B3E431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Dec 2014 04:14:41 -0800 (PST)\r
+Received: by mail-wi0-f174.google.com with SMTP id h11so2278313wiw.13\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Dec 2014 04:14:40 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:user-agent:to:subject:in-reply-to:references\r
+       :from:date:message-id:mime-version:content-type\r
+       :content-transfer-encoding;\r
+       bh=JOGb0u413mLYj9cnvbUtG3S8Aa9y1N3MK9JOXgF9QdY=;\r
+       b=ZyHrqtH0HysXE+J5g/TpR5BXWuWhKIpxar5WTz3fY2LWCB+ZV4Qis9L94piV+C3Vn8\r
+       UYfXeOaqYq2zitO7wv9cP03QFa4RSAEXgxR6VSnxmRed2msqA+SJO/xUsHbwBx1FbvzQ\r
+       6bDboguM0+IBWsttN70c5hIVwSEBWDTqNzOn32J6nyuKvN594B/FCpEYWu+u7CWnFsfK\r
+       NMZY0HYPPIz7+R/MxYZFgLsYrjiEjA2DKIccszO+OvoLNHZwiuUcGqpwmEtgB1sAvRui\r
+       wLY3Mk7JaKMFhCDtGbWUvI9LiLKfBXyIp/OURouuE62D4l+0t0M40FLS1SgDk4FauTtO\r
+       DICQ==\r
+X-Gm-Message-State:\r
+ ALoCoQkAiXrmgFTM8znagNDIk3lRgjnA36KGjTEfu28ldWhmjFh0olHuBX4TSYp/gvDP2yltNNC0\r
+X-Received: by 10.180.104.197 with SMTP id gg5mr7176768wib.7.1418386479203;\r
+       Fri, 12 Dec 2014 04:14:39 -0800 (PST)\r
+Received: from disaster-area.hh.sledj.net\r
+       ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+       by mx.google.com with ESMTPSA id ef1sm1748684wic.0.2014.12.12.04.14.38\r
+       (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+       Fri, 12 Dec 2014 04:14:38 -0800 (PST)\r
+Received: from localhost (30000@localhost [local]);\r
+       by localhost (OpenSMTPD) with ESMTPA id e15c7be9;\r
+       Fri, 12 Dec 2014 12:14:37 +0000 (UTC)\r
+User-Agent: OpenSMTPD enqueuer (Demoostik)\r
+To: Lele Gaifax <lele@metapensiero.it>, notmuch@notmuchmail.org\r
+Subject: Re: Address completion in Emacs\r
+In-Reply-To: <87d27p9t0f.fsf@nautilus.nautilus>\r
+References: <87d27p9t0f.fsf@nautilus.nautilus>\r
+From: David Edmondson <dme@dme.org>\r
+Date: Fri, 12 Dec 2014 12:14:37 +0000\r
+Message-ID: <m24mt1hxoy.fsf@heart-of-gold.hh.sledj.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 12 Dec 2014 12:15:09 -0000\r
+\r
+On Fri, Dec 12 2014, Lele Gaifax wrote:\r
+> Hi all,\r
+>\r
+> Yesterday I tweaked my Emacs configuration to use "ido-completing-read"\r
+> to select the right address in the minibuffer, and noticed what seems a\r
+> glitch in the related code.\r
+>\r
+> To accomplish the goal, I implemented my own selection function\r
+>\r
+>   (defun esk-notmuch-address-selection-function (prompt addresses first)\r
+>     "Use `ido-completing-read' to select one of the addresses."\r
+>     (ido-completing-read prompt (cons first addresses)\r
+>                          nil nil nil 'notmuch-address-history))\r
+>\r
+> and then assigned it to `notmuch-address-selection-function':\r
+>\r
+>   (setq notmuch-address-selection-function 'esk-notmuch-address-selection=\r
+-function)\r
+>\r
+> As you can see, I had to `cons' the two arguments, because the caller of\r
+> that function does something similar to the following (where `orig' is\r
+> the text entered before TAB-completion):\r
+>\r
+>   (options (notmuch-address-options orig))\r
+>   (num-options (length options))\r
+>   (chosen (funcall notmuch-address-selection-function\r
+>               (format "Address (%s matches): " num-options)\r
+>               (cdr options) (car options)))\r
+>\r
+> and the standard `notmuch-address-selection-function' is defined like:\r
+>\r
+>   (defun notmuch-address-selection-function (prompt collection initial-in=\r
+put)\r
+>     "Call (`completing-read'\r
+>         PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"\r
+>     (completing-read\r
+>      prompt collection nil nil initial-input 'notmuch-address-history))\r
+>\r
+> where that `initial-input' is not what I initially thought, the text\r
+> entered by the user, but rather the first completion candidate.\r
+>\r
+> Wouldn't it be more "correct" to pass the unchanged `options' list and\r
+> the "real" `orig' text as `initial-input' to the customizable function\r
+> instead?\r
+\r
+Would I then have to press TAB twice to get the first result?\r
+\r
+> I understand that it may be undesiderable to break existing\r
+> configurations by rectifying the arguments in that way, and in such case\r
+> could we change the `initial-input' argument name to better reflect the\r
+> fact that it actually contains one possible candidate instead?\r
+\r
+>From the perspective of `notmuch-address-selection-function', it _is_\r
+the `initial-input', as that is what is presented to the user.\r
+\r
+> Thanks in advance for any clarification,\r
+> ciao, lele.\r
+> --=20\r
+> nickname: Lele Gaifax | Quando vivr=C3=B2 di quello che ho pensato ieri\r
+> real: Emanuele Gaifas | comincer=C3=B2 ad aver paura di chi mi copia.\r
+> lele@metapensiero.it  |                 -- Fortunato Depero, 1929.\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r