Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / c6 / 35a6679808aac965e62b5d605c43f8dd3ccee5
1 Return-Path: <markwalters1009@gmail.com>\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 2117B6DE1766\r
6  for <notmuch@notmuchmail.org>; Sun, 25 Oct 2015 06:02:22 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.11\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.11 tagged_above=-999 required=5 tests=[AWL=0.460, \r
12  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13  FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\r
14  RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
15  RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled\r
16 Received: from arlo.cworth.org ([127.0.0.1])\r
17  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
18  with ESMTP id Sj4MSccq9ouh for <notmuch@notmuchmail.org>;\r
19  Sun, 25 Oct 2015 06:02:20 -0700 (PDT)\r
20 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
21  [209.85.212.181])\r
22  by arlo.cworth.org (Postfix) with ESMTPS id C9D8B6DE1472\r
23  for <notmuch@notmuchmail.org>; Sun, 25 Oct 2015 06:02:19 -0700 (PDT)\r
24 Received: by wijp11 with SMTP id p11so131538585wij.0\r
25  for <notmuch@notmuchmail.org>; Sun, 25 Oct 2015 06:02:17 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27  h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
28  bh=pZjHvBriRr3V8fxgQ3KnQsbNnP/1ZzjhmoKN2xVA47E=;\r
29  b=sBEvwLYX3l0X1kJC2dMuWiWKhlQ7d/8U0UsLngBuDyTRfiFgzRXuKoNdTCPvJ+LJup\r
30  ssKPNNJu/yMpqp3kW+0Mfrhc1Y9pkghnCVvirmlvIBu94G+csPVh8udb9mKZqttw3YjW\r
31  ppH0PEVf8pc6P0CeIvGoVUDduLgp0C0zgi2tFYDQ5CSiFc3DxP8d66GZInljsO+pYkY9\r
32  IPAEaaIp7BH9VfqvH/xnSly+NuvkByITB5oDPbCZLWVjEnB75GOVIZF1v+clyYhbvrFA\r
33  RDgQ+vsrhNICEwfoGzNNYNW9PIun84GBPa1Ma24AJ4iEBPGtbqPhjHzErqogvi+T75ud\r
34  Pqig==\r
35 X-Received: by 10.194.81.74 with SMTP id y10mr14172505wjx.110.1445778137719;\r
36  Sun, 25 Oct 2015 06:02:17 -0700 (PDT)\r
37 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
38  by smtp.gmail.com with ESMTPSA id ka10sm33472047wjc.30.2015.10.25.06.02.14\r
39  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
40  Sun, 25 Oct 2015 06:02:14 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH] address completion tweaks\r
44 Date: Sun, 25 Oct 2015 13:02:11 +0000\r
45 Message-Id: <1445778131-3004-1-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 2.1.4\r
47 In-Reply-To: <1445764618-29250-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1445764618-29250-1-git-send-email-markwalters1009@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.20\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53  <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
55  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
60  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sun, 25 Oct 2015 13:02:22 -0000\r
62 \r
63 If the user has company installed and notmuch is configured to use it,\r
64 then use it for all the completions. In particular, pressing tab now\r
65 forces company to run immediately.\r
66 \r
67 In addition this patch fixes a semi-bug where address completion was\r
68 used for more headers than company mode was. With the change above\r
69 this became important. Thus make company mode work for all headers\r
70 that address completion does.\r
71 ---\r
72 \r
73 I think this is an improvement: without pressing tab quickly brings up\r
74 the normal mini-buffer completion mode, but waiting a second means\r
75 company has started and then tab doesn't bring up the mini-buffer.\r
76 \r
77 The change in notmuch-mua is just so that company-setup runs before we\r
78 setup the message-completion-alist.\r
79 \r
80 Best wishes\r
81 \r
82 Mark\r
83 \r
84 \r
85 \r
86 emacs/notmuch-address.el |  7 ++++---\r
87  emacs/notmuch-company.el |  5 +++--\r
88  emacs/notmuch-mua.el     | 10 +++++-----\r
89  3 files changed, 12 insertions(+), 10 deletions(-)\r
90 \r
91 diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
92 index 228135e..0a73ddf 100644\r
93 --- a/emacs/notmuch-address.el\r
94 +++ b/emacs/notmuch-address.el\r
95 @@ -64,9 +64,11 @@ (defun notmuch-address-selection-function (prompt collection initial-input)\r
96    (completing-read\r
97     prompt collection nil nil initial-input 'notmuch-address-history))\r
98  \r
99 +(defvar notmuch-address-completion-headers-regexp\r
100 +  "^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):")\r
101 +\r
102  (defvar notmuch-address-message-alist-member\r
103 -  '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"\r
104 -             . notmuch-address-expand-name))\r
105 +  (cons notmuch-address-completion-headers-regexp 'notmuch-address-expand-name))\r
106  \r
107  (defvar notmuch-address-history nil)\r
108  \r
109 @@ -221,7 +223,6 @@ (defun notmuch-address-harvest-trigger ()\r
110                                  (if (string= event "finished\n")\r
111                                      (setq notmuch-address-full-harvest-finished t)\r
112                                    (setq notmuch-address-last-harvest 0)))))))\r
113 -\r
114  ;;\r
115  \r
116  (provide 'notmuch-address)\r
117 diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el\r
118 index 9e57914..3157ed7 100644\r
119 --- a/emacs/notmuch-company.el\r
120 +++ b/emacs/notmuch-company.el\r
121 @@ -41,6 +41,8 @@ (defvar company-backends)\r
122  ;;;###autoload\r
123  (defun notmuch-company-setup ()\r
124    (company-mode)\r
125 +  (setq notmuch-address-message-alist-member\r
126 +       (cons notmuch-address-completion-headers-regexp 'company-manual-begin))\r
127    (make-local-variable 'company-backends)\r
128    (setq company-backends '(notmuch-company)))\r
129  \r
130 @@ -54,7 +56,7 @@ (defun notmuch-company (command &optional arg &rest _ignore)\r
131      (case command\r
132        (interactive (company-begin-backend 'notmuch-company))\r
133        (prefix (and (derived-mode-p 'message-mode)\r
134 -                  (looking-back "^\\(To\\|Cc\\|Bcc\\):.*"\r
135 +                  (looking-back (concat notmuch-address-completion-headers-regexp ".*")\r
136                                  (line-beginning-position))\r
137                    (setq notmuch-company-last-prefix (company-grab "[:,][ \t]*\\(.*\\)" 1 (point-at-bol)))))\r
138        (candidates (cond\r
139 @@ -77,5 +79,4 @@ (defun notmuch-company (command &optional arg &rest _ignore)\r
140                0))\r
141        (no-cache t))))\r
142  \r
143 -\r
144  (provide 'notmuch-company)\r
145 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
146 index 63fc8db..8cbf38c 100644\r
147 --- a/emacs/notmuch-mua.el\r
148 +++ b/emacs/notmuch-mua.el\r
149 @@ -276,13 +276,13 @@ (defcustom notmuch-message-use-company t\r
150  (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]"\r
151    "Notmuch message composition mode. Mostly like `message-mode'"\r
152    (when notmuch-address-command\r
153 +    (when (and notmuch-message-use-company\r
154 +              (eq notmuch-address-command 'internal)\r
155 +              (require 'company nil t))\r
156 +      (notmuch-company-setup))\r
157      (unless (memq notmuch-address-message-alist-member message-completion-alist)\r
158        (setq message-completion-alist\r
159 -           (push notmuch-address-message-alist-member message-completion-alist))))\r
160 -  (when (and notmuch-message-use-company\r
161 -            (eq notmuch-address-command 'internal)\r
162 -            (require 'company nil t))\r
163 -    (notmuch-company-setup)))\r
164 +           (push notmuch-address-message-alist-member message-completion-alist)))))\r
165  \r
166  (define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)\r
167  (define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send)\r
168 -- \r
169 2.1.4\r
170 \r