1 Return-Path: <sojkam1@fel.cvut.cz>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 95C386DE00BF
\r
6 for <notmuch@notmuchmail.org>; Tue, 17 May 2016 04:53:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-1.649 tagged_above=-999 required=5 tests=[AWL=0.661,
\r
12 RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id O4W7FJ7xVdHP for <notmuch@notmuchmail.org>;
\r
16 Tue, 17 May 2016 04:53:12 -0700 (PDT)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id EC2866DE00D3
\r
19 for <notmuch@notmuchmail.org>; Tue, 17 May 2016 04:53:11 -0700 (PDT)
\r
20 Received: from localhost (unknown [192.168.200.7])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id 266215CCEE0;
\r
22 Tue, 17 May 2016 13:53:08 +0200 (CEST)
\r
23 X-Virus-Scanned: IMAP STYX AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044)
\r
26 with ESMTP id b4fRIg0PHohi; Tue, 17 May 2016 13:53:06 +0200 (CEST)
\r
27 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
28 by max.feld.cvut.cz (Postfix) with ESMTP id 2FB265CCF41;
\r
29 Tue, 17 May 2016 13:53:06 +0200 (CEST)
\r
30 Received: from wsh by steelpick.2x.cz with local (Exim 4.87)
\r
31 (envelope-from <sojkam1@fel.cvut.cz>)
\r
32 id 1b2dYf-0005M0-2x; Tue, 17 May 2016 13:53:05 +0200
\r
33 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
34 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
35 Subject: Re: [PATCH v3] emacs: address completion,
\r
36 allow sender/recipient and filters
\r
37 In-Reply-To: <1463384211-13086-1-git-send-email-markwalters1009@gmail.com>
\r
38 References: <87h9e11vq1.fsf@steelpick.2x.cz>
\r
39 <1463384211-13086-1-git-send-email-markwalters1009@gmail.com>
\r
40 User-Agent: Notmuch/0.22+17~ga5b8c02 (http://notmuchmail.org) Emacs/24.5.1
\r
41 (x86_64-pc-linux-gnu)
\r
42 Date: Tue, 17 May 2016 13:53:04 +0200
\r
43 Message-ID: <8737pg99zz.fsf@steelpick.2x.cz>
\r
45 Content-Type: text/plain
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.20
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Tue, 17 May 2016 11:53:20 -0000
\r
62 few minor comments bellow.
\r
64 On Mon, May 16 2016, Mark Walters wrote:
\r
65 > This commit lets the user customize the address completion.
\r
67 Add "It makes two changes."
\r
69 > The first change controls whether to build the address completion list
\r
70 > based on messages you have sent or you have received (the latter is
\r
73 > The second change add a possible filter query to limit the messages
\r
74 > used -- for example, setting this to date:1y.. would limit the
\r
75 > address completions to addresses used in the last year. This speeds up
\r
76 > the address harvest and may also make the search less cluttered as old
\r
77 > addresses may well no longer be valid.
\r
80 > This version uses the docstrings suggested my Michal (which are much
\r
81 > better than mine), and renames some variables, as he suggested, to
\r
82 > make the code clearer.
\r
84 > I wondered about allowing the user to specify completion based on
\r
85 > message "sent or received", rather than either sent, or received, but
\r
86 > think that is adding too much mess. We could also allow completion
\r
87 > based on any messages in the database, which would the include
\r
88 > completion based on messages received via mailing lists or
\r
89 > distribution lists.
\r
91 > I also note that if the user enters a bad query into the filter query
\r
92 > box (eg 6M.. rather than date:6M..) they may get an obscure error as
\r
93 > notmuch/xapian fails. I don't see a goo way round that so have left
\r
94 > that as a "don't do that" case.
\r
98 > emacs/notmuch-address.el | 119 ++++++++++++++++++++++++++++++++---------------
\r
99 > emacs/notmuch-company.el | 2 +-
\r
100 > 2 files changed, 82 insertions(+), 39 deletions(-)
\r
102 > diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
\r
103 > index aafbe5f..3dc5da9 100644
\r
104 > --- a/emacs/notmuch-address.el
\r
105 > +++ b/emacs/notmuch-address.el
\r
106 > @@ -28,15 +28,51 @@
\r
108 > (declare-function company-manual-begin "company")
\r
110 > -(defcustom notmuch-address-command 'internal
\r
111 > - "The command which generates possible addresses. It must take a
\r
112 > -single argument and output a list of possible matches, one per
\r
113 > -line. The default value of `internal' uses built-in address
\r
115 > +(defvar notmuch-address-last-harvest 0
\r
116 > + "Time of last address harvest")
\r
118 > +(defvar notmuch-address-completions (make-hash-table :test 'equal)
\r
119 > + "Hash of email addresses for completion during email composition.
\r
120 > + This variable is set by calling `notmuch-address-harvest'.")
\r
122 > +(defvar notmuch-address-full-harvest-finished nil
\r
123 > + "t indicates that full completion address harvesting has been
\r
126 > +(defcustom notmuch-address-command '(sent nil)
\r
127 > + "Determines how to generate address completion candidates.
\r
129 > +If it is a string then that string should be an external program
\r
130 > +which must take a single argument (searched string) and output a
\r
131 > +list of completion candidates, one per line.
\r
133 > +Alternatively, it can be a (non-nil) list, in which case internal
\r
134 > +completion is used; in this case the list should have form
\r
135 > +'(DIRECTION FILTER), where DIRECTION is either sent or received
\r
136 > +and specifies whether the candidates are searched in messages
\r
137 > +sent by the user or received by the user (note received by is
\r
138 > +much faster), and FILTER is either nil or a filter-string, such
\r
139 > +as \"date:1y..\" to append to the query.
\r
141 > +If this variable is nil then address completion is disabled."
\r
143 > - (const :tag "Use internal address completion" internal)
\r
144 > + (list :tag "Use internal address completion"
\r
146 > + :tag "Base completion on messages you have"
\r
148 > + (const :tag "sent" sent)
\r
149 > + (const :tag "received" received))
\r
151 I think, users will be more happy if they understand the difference
\r
152 without reading the full doc string.
\r
154 (const :tag "sent (more accurate)" sent)
\r
155 (const :tag "received (faster)" received))
\r