--- /dev/null
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 95C386DE00BF\r
+ for <notmuch@notmuchmail.org>; Tue, 17 May 2016 04:53:20 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.649\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.649 tagged_above=-999 required=5 tests=[AWL=0.661,\r
+ RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id O4W7FJ7xVdHP for <notmuch@notmuchmail.org>;\r
+ Tue, 17 May 2016 04:53:12 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+ by arlo.cworth.org (Postfix) with ESMTP id EC2866DE00D3\r
+ for <notmuch@notmuchmail.org>; Tue, 17 May 2016 04:53:11 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.7])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 266215CCEE0;\r
+ Tue, 17 May 2016 13:53:08 +0200 (CEST)\r
+X-Virus-Scanned: IMAP STYX AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+ by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044)\r
+ with ESMTP id b4fRIg0PHohi; Tue, 17 May 2016 13:53:06 +0200 (CEST)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 2FB265CCF41;\r
+ Tue, 17 May 2016 13:53:06 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.87)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1b2dYf-0005M0-2x; Tue, 17 May 2016 13:53:05 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3] emacs: address completion,\r
+ allow sender/recipient and filters\r
+In-Reply-To: <1463384211-13086-1-git-send-email-markwalters1009@gmail.com>\r
+References: <87h9e11vq1.fsf@steelpick.2x.cz>\r
+ <1463384211-13086-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.22+17~ga5b8c02 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 17 May 2016 13:53:04 +0200\r
+Message-ID: <8737pg99zz.fsf@steelpick.2x.cz>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 17 May 2016 11:53:20 -0000\r
+\r
+Hi Mark,\r
+\r
+few minor comments bellow.\r
+\r
+On Mon, May 16 2016, Mark Walters wrote:\r
+> This commit lets the user customize the address completion.\r
+\r
+Add "It makes two changes."\r
+\r
+> The first change controls whether to build the address completion list\r
+> based on messages you have sent or you have received (the latter is\r
+> much faster).\r
+>\r
+> The second change add a possible filter query to limit the messages\r
+> used -- for example, setting this to date:1y.. would limit the\r
+> address completions to addresses used in the last year. This speeds up\r
+> the address harvest and may also make the search less cluttered as old\r
+> addresses may well no longer be valid.\r
+> ---\r
+>\r
+> This version uses the docstrings suggested my Michal (which are much\r
+> better than mine), and renames some variables, as he suggested, to\r
+> make the code clearer.\r
+>\r
+> I wondered about allowing the user to specify completion based on\r
+> message "sent or received", rather than either sent, or received, but\r
+> think that is adding too much mess. We could also allow completion\r
+> based on any messages in the database, which would the include\r
+> completion based on messages received via mailing lists or\r
+> distribution lists.\r
+>\r
+> I also note that if the user enters a bad query into the filter query\r
+> box (eg 6M.. rather than date:6M..) they may get an obscure error as\r
+> notmuch/xapian fails. I don't see a goo way round that so have left\r
+> that as a "don't do that" case.\r
+\r
+Agreed.\r
+\r
+> emacs/notmuch-address.el | 119 ++++++++++++++++++++++++++++++++---------------\r
+> emacs/notmuch-company.el | 2 +-\r
+> 2 files changed, 82 insertions(+), 39 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+> index aafbe5f..3dc5da9 100644\r
+> --- a/emacs/notmuch-address.el\r
+> +++ b/emacs/notmuch-address.el\r
+> @@ -28,15 +28,51 @@\r
+> ;;\r
+> (declare-function company-manual-begin "company")\r
+> \r
+> -(defcustom notmuch-address-command 'internal\r
+> - "The command which generates possible addresses. It must take a\r
+> -single argument and output a list of possible matches, one per\r
+> -line. The default value of `internal' uses built-in address\r
+> -completion."\r
+> +(defvar notmuch-address-last-harvest 0\r
+> + "Time of last address harvest")\r
+> +\r
+> +(defvar notmuch-address-completions (make-hash-table :test 'equal)\r
+> + "Hash of email addresses for completion during email composition.\r
+> + This variable is set by calling `notmuch-address-harvest'.")\r
+> +\r
+> +(defvar notmuch-address-full-harvest-finished nil\r
+> + "t indicates that full completion address harvesting has been\r
+> +finished")\r
+> +\r
+> +(defcustom notmuch-address-command '(sent nil)\r
+> + "Determines how to generate address completion candidates.\r
+> +\r
+> +If it is a string then that string should be an external program\r
+> +which must take a single argument (searched string) and output a\r
+> +list of completion candidates, one per line.\r
+> +\r
+> +Alternatively, it can be a (non-nil) list, in which case internal\r
+> +completion is used; in this case the list should have form\r
+> +'(DIRECTION FILTER), where DIRECTION is either sent or received\r
+> +and specifies whether the candidates are searched in messages\r
+> +sent by the user or received by the user (note received by is\r
+> +much faster), and FILTER is either nil or a filter-string, such\r
+> +as \"date:1y..\" to append to the query.\r
+> +\r
+> +If this variable is nil then address completion is disabled."\r
+> :type '(radio\r
+> - (const :tag "Use internal address completion" internal)\r
+> + (list :tag "Use internal address completion"\r
+> + (radio\r
+> + :tag "Base completion on messages you have"\r
+> + :value sent\r
+> + (const :tag "sent" sent)\r
+> + (const :tag "received" received))\r
+\r
+I think, users will be more happy if they understand the difference\r
+without reading the full doc string.\r
+\r
+ (const :tag "sent (more accurate)" sent)\r
+ (const :tag "received (faster)" received))\r
+\r
+\r
+Thanks.\r
+-Michal\r