unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
@ 2010-04-22  9:03 David Edmondson
  2010-04-22 14:47 ` Dirk Hohndel
  2010-04-24  0:49 ` Carl Worth
  0 siblings, 2 replies; 16+ messages in thread
From: David Edmondson @ 2010-04-22  9:03 UTC (permalink / raw)
  To: notmuch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4232 bytes --]

A tool `notmuch-addresses' is required to produce addresses which
match a query string. An example of a suitable script can be found in
the git repository at
    http://jkr.acm.jhu.edu/git/notmuch_addresses.git
There are no doubt others.
---
 emacs/Makefile.local     |    3 +-
 emacs/notmuch-address.el |   91 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 1 deletions(-)
 create mode 100644 emacs/notmuch-address.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index e5013b3..7537c3d 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -8,7 +8,8 @@ emacs_sources := \
 	$(dir)/notmuch-show.el \
 	$(dir)/notmuch-wash.el \
 	$(dir)/notmuch-hello.el \
-	$(dir)/notmuch-mua.el
+	$(dir)/notmuch-mua.el \
+	$(dir)/notmuch-address.el
 
 emacs_images := \
 	$(dir)/notmuch-logo.png
diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
new file mode 100644
index 0000000..69a52a2
--- /dev/null
+++ b/emacs/notmuch-address.el
@@ -0,0 +1,91 @@
+;; notmuch-address.el --- address completion with notmuch
+;;
+;; Copyright © David Edmondson
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;; Authors: David Edmondson <dme@dme.org>
+
+(require 'message)
+
+;;
+
+(defcustom notmuch-address-command "notmuch-addresses"
+  "The command which generates possible addresses. It must take a
+single argument and output a list of possible matches, one per
+line."
+  :type 'string
+  :group 'notmuch)
+
+(defvar notmuch-address-message-alist-member
+  '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
+	      . notmuch-address-expand-name))
+
+(defvar notmuch-address-history nil)
+
+(defun notmuch-address-message-insinuate ()
+  (if (not (memq notmuch-address-message-alist-member message-completion-alist))
+      (setq message-completion-alist
+	    (push notmuch-address-message-alist-member message-completion-alist))))
+
+(defun notmuch-address-options (original)
+  (process-lines notmuch-address-command original))
+
+(defun notmuch-address-expand-name ()
+  (let* ((end (point))
+	 (beg (save-excursion
+		(re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")
+		(goto-char (match-end 0))
+		(point)))
+	 (orig (buffer-substring-no-properties beg end))
+	 (completion-ignore-case t)
+	 (options (notmuch-address-options orig))
+	 (chosen (if (eq (length options) 1)
+		     (car options)
+		   (completing-read "Address: " (cdr options) nil nil (car options)
+				    'notmuch-address-history))))
+    (when chosen
+      (push chosen notmuch-address-history)
+      (delete-region beg end)
+      (insert chosen))))
+
+;; Copied from `w3m-which-command'.
+(defun notmuch-address-locate-command (command)
+  "Return non-nil if `command' is an executable either on
+`exec-path' or an absolute pathname."
+  (when (stringp command)
+    (if (and (file-name-absolute-p command)
+	     (file-executable-p command))
+	command
+      (setq command (file-name-nondirectory command))
+      (catch 'found-command
+	(let (bin)
+	  (dolist (dir exec-path)
+	    (setq bin (expand-file-name command dir))
+	    (when (or (and (file-executable-p bin)
+			   (not (file-directory-p bin)))
+		      (and (file-executable-p (setq bin (concat bin ".exe")))
+			   (not (file-directory-p bin))))
+	      (throw 'found-command bin))))))))
+
+;; If we can find the program specified by `notmuch-address-command',
+;; insinuate ourselves into `message-mode'.
+(when (notmuch-address-locate-command notmuch-address-command)
+  (notmuch-address-message-insinuate))
+
+;;
+
+(provide 'notmuch-address)
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-22  9:03 [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
@ 2010-04-22 14:47 ` Dirk Hohndel
  2010-04-24  0:49 ` Carl Worth
  1 sibling, 0 replies; 16+ messages in thread
From: Dirk Hohndel @ 2010-04-22 14:47 UTC (permalink / raw)
  To: David Edmondson, notmuch

On Thu, 22 Apr 2010 10:03:43 +0100, David Edmondson <dme@dme.org> wrote:
> A tool `notmuch-addresses' is required to produce addresses which
> match a query string. An example of a suitable script can be found in
> the git repository at
>     http://jkr.acm.jhu.edu/git/notmuch_addresses.git
> There are no doubt others.

+1 on getting this into 0.3

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-22  9:03 [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
  2010-04-22 14:47 ` Dirk Hohndel
@ 2010-04-24  0:49 ` Carl Worth
  2010-04-26 10:48   ` [PATCH] emacs: Automatically load "notmuch-address" David Edmondson
  2010-04-26 10:49   ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
  1 sibling, 2 replies; 16+ messages in thread
From: Carl Worth @ 2010-04-24  0:49 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

On Thu, 22 Apr 2010 10:03:43 +0100, David Edmondson <dme@dme.org> wrote:
> A tool `notmuch-addresses' is required to produce addresses which
> match a query string. An example of a suitable script can be found in
> the git repository at
>     http://jkr.acm.jhu.edu/git/notmuch_addresses.git
> There are no doubt others.

I applied this, but I've had some difficulty figuring out how to use it
given just the above instructions.

I did install the above-referenced python script[*] as notmuch-addresses
on my path. And I tested it at the command line and it seemed to act
reasonably.

But hitting TAB in message-mode continued to frobnicate BBDB instead.

I finally hit on doing (require 'notmuch-address) in .emacs. As noted
previously, can we please make (require 'notmuch) pull in all notmuch
functionality rather than having it separated like this?

Finally, though, I haven't figured out how to get more than a single
match from this. If the first match isn't what I want, how do I see and
choose later matches?

In the meantime, I've pushed this already.

-Carl

[*] Which also made me figure out how to install our python bindings. I
found "sudo python ./setup.py install" eventually, but it would be quite
nice if "sudo make install" took care of that.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] emacs: Automatically load "notmuch-address"
  2010-04-24  0:49 ` Carl Worth
@ 2010-04-26 10:48   ` David Edmondson
  2010-04-26 10:49   ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
  1 sibling, 0 replies; 16+ messages in thread
From: David Edmondson @ 2010-04-26 10:48 UTC (permalink / raw)
  To: notmuch

"notmuch-address.el" tries to be careful to insinuate itself into
message mode only if it will do something useful, so it's safe to load
it all of the time.
---
 emacs/notmuch-mua.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index acb7dbf..305275e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -23,6 +23,7 @@
 (require 'message)
 
 (require 'notmuch-lib)
+(require 'notmuch-address)
 
 ;;
 
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-24  0:49 ` Carl Worth
  2010-04-26 10:48   ` [PATCH] emacs: Automatically load "notmuch-address" David Edmondson
@ 2010-04-26 10:49   ` David Edmondson
  2010-04-26 11:29     ` Sebastian Spaeth
  2010-04-26 15:21     ` Carl Worth
  1 sibling, 2 replies; 16+ messages in thread
From: David Edmondson @ 2010-04-26 10:49 UTC (permalink / raw)
  To: Carl Worth, notmuch; +Cc: carl

On Fri, 23 Apr 2010 17:49:38 -0700, Carl Worth <cworth@cworth.org> wrote:
> I finally hit on doing (require 'notmuch-address) in .emacs. As noted
> previously, can we please make (require 'notmuch) pull in all notmuch
> functionality rather than having it separated like this?

Patch sent.

> Finally, though, I haven't figured out how to get more than a single
> match from this. If the first match isn't what I want, how do I see and
> choose later matches?

M-n to move forward in the list, M-p to move backwards (including into
any history you have accrued).

dme.
-- 
David Edmondson, http://dme.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 10:49   ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
@ 2010-04-26 11:29     ` Sebastian Spaeth
  2010-04-26 11:41       ` David Edmondson
  2010-04-26 15:21     ` Carl Worth
  1 sibling, 1 reply; 16+ messages in thread
From: Sebastian Spaeth @ 2010-04-26 11:29 UTC (permalink / raw)
  To: David Edmondson, Carl Worth, notmuch; +Cc: carl

On 2010-04-26, David Edmondson wrote:
> M-n to move forward in the list, M-p to move backwards (including into
> any history you have accrued).

Alternatively, some of us have that weird new invention on their
keyboards called "arrow keys" ;-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 11:29     ` Sebastian Spaeth
@ 2010-04-26 11:41       ` David Edmondson
  0 siblings, 0 replies; 16+ messages in thread
From: David Edmondson @ 2010-04-26 11:41 UTC (permalink / raw)
  To: Sebastian Spaeth, Carl Worth, notmuch

On Mon, 26 Apr 2010 13:29:42 +0200, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> On 2010-04-26, David Edmondson wrote:
> > M-n to move forward in the list, M-p to move backwards (including into
> > any history you have accrued).
> 
> Alternatively, some of us have that weird new invention on their
> keyboards called "arrow keys" ;-)

New-fangled nonsense!

> Cc: carl@ut.hh.sledj.net

Gosh, where did that come from? Looks as though I generated it
(ut.hh.sledj.net is my desktop machine)...

dme.
-- 
David Edmondson, http://dme.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 10:49   ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
  2010-04-26 11:29     ` Sebastian Spaeth
@ 2010-04-26 15:21     ` Carl Worth
  2010-04-26 16:25       ` [PATCH] emacs: Tell the user how many addresses matched when completing dme
                         ` (2 more replies)
  1 sibling, 3 replies; 16+ messages in thread
From: Carl Worth @ 2010-04-26 15:21 UTC (permalink / raw)
  To: David Edmondson, notmuch, dirk; +Cc: carl

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

On Mon, 26 Apr 2010 11:49:46 +0100, David Edmondson <dme@dme.org> wrote:
> On Fri, 23 Apr 2010 17:49:38 -0700, Carl Worth <cworth@cworth.org> wrote:
> > I finally hit on doing (require 'notmuch-address) in .emacs. As noted
> > previously, can we please make (require 'notmuch) pull in all notmuch
> > functionality rather than having it separated like this?
> 
> Patch sent.

Pushed.

> > Finally, though, I haven't figured out how to get more than a single
> > match from this. If the first match isn't what I want, how do I see and
> > choose later matches?
> 
> M-n to move forward in the list, M-p to move backwards (including into
> any history you have accrued).

Ah-hah! Thanks for filling me in. I'm glad to finally have usable
notmuch-based address completion now.

 Perhaps we could add a hint in the minibuffer prompt?

	Address (+6 more): Name Here <address@example.com>

I'd like to come up with something more specific in that hint, but it
gets a little long:

	Address (Use M-n/M-p or arrow keys for 6 more):

:-P

I don't suppose it would be feasible to make Space and DEL navigate
through the list as well would it?

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] emacs: Tell the user how many addresses matched when completing
  2010-04-26 15:21     ` Carl Worth
@ 2010-04-26 16:25       ` dme
  2010-04-26 16:27       ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
  2010-04-26 16:28       ` David Edmondson
  2 siblings, 0 replies; 16+ messages in thread
From: dme @ 2010-04-26 16:25 UTC (permalink / raw)
  To: notmuch

From: David Edmondson <dme@dme.org>

When completing an address, tell the user how many addresses in the
database matched the query.
---
 emacs/notmuch-address.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 69a52a2..a295204 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -53,9 +53,11 @@ line."
 	 (orig (buffer-substring-no-properties beg end))
 	 (completion-ignore-case t)
 	 (options (notmuch-address-options orig))
-	 (chosen (if (eq (length options) 1)
+	 (num-options (length options))
+	 (chosen (if (eq num-options 1)
 		     (car options)
-		   (completing-read "Address: " (cdr options) nil nil (car options)
+		   (completing-read (format "Address (%s matches): " num-options 1)
+				    (cdr options) nil nil (car options)
 				    'notmuch-address-history))))
     (when chosen
       (push chosen notmuch-address-history)
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 15:21     ` Carl Worth
  2010-04-26 16:25       ` [PATCH] emacs: Tell the user how many addresses matched when completing dme
@ 2010-04-26 16:27       ` David Edmondson
  2010-04-26 18:03         ` Carl Worth
  2010-04-26 16:28       ` David Edmondson
  2 siblings, 1 reply; 16+ messages in thread
From: David Edmondson @ 2010-04-26 16:27 UTC (permalink / raw)
  To: Carl Worth, notmuch

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

On Mon, 26 Apr 2010 08:21:51 -0700, Carl Worth <cworth@cworth.org> wrote:
> > > Finally, though, I haven't figured out how to get more than a single
> > > match from this. If the first match isn't what I want, how do I see and
> > > choose later matches?
> > 
> > M-n to move forward in the list, M-p to move backwards (including into
> > any history you have accrued).
> 
> Ah-hah! Thanks for filling me in. I'm glad to finally have usable
> notmuch-based address completion now.
> 
>  Perhaps we could add a hint in the minibuffer prompt?
> 
> 	Address (+6 more): Name Here <address@example.com>

Patch is sent for this, though given that it's not easy to change the
prompt as you step through, it says:

	Address (7 match): Name Here <address@example.com>

> I'd like to come up with something more specific in that hint, but it
> gets a little long:
> 
> 	Address (Use M-n/M-p or arrow keys for 6 more):

Moving through potential completions is pretty standard Emacs UI stuff,
so I'm not sure if it's necessary to explain? (Of course, that you had
to ask suggests otherwise...)

> I don't suppose it would be feasible to make Space and DEL navigate
> through the list as well would it?

Not with `completing-read', but I'll look at it after 0.3.

dme.
-- 
David Edmondson, http://dme.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 15:21     ` Carl Worth
  2010-04-26 16:25       ` [PATCH] emacs: Tell the user how many addresses matched when completing dme
  2010-04-26 16:27       ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
@ 2010-04-26 16:28       ` David Edmondson
  2010-04-26 16:40         ` Dirk Hohndel
  2010-04-26 18:08         ` Carl Worth
  2 siblings, 2 replies; 16+ messages in thread
From: David Edmondson @ 2010-04-26 16:28 UTC (permalink / raw)
  To: Carl Worth, notmuch

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]


   To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org, dirk@yoom.home.cworth.org
   Cc: carl@ut.hh.sledj.net
   Date: Mon, 26 Apr 2010 08:21:51 -0700

Something interesting is happening here :-)

dme.
-- 
David Edmondson, http://dme.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 16:28       ` David Edmondson
@ 2010-04-26 16:40         ` Dirk Hohndel
  2010-04-26 18:08         ` Carl Worth
  1 sibling, 0 replies; 16+ messages in thread
From: Dirk Hohndel @ 2010-04-26 16:40 UTC (permalink / raw)
  To: David Edmondson, Carl Worth, notmuch

On Mon, 26 Apr 2010 17:28:47 +0100, David Edmondson <dme@dme.org> wrote:
> 
>    To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org, dirk@yoom.home.cworth.org

Looks like I now have an account on Carl's machine

>    Cc: carl@ut.hh.sledj.net

Which is only fair, given that he has gotten himself an account
somewhere else as well :-)

> Something interesting is happening here :-)

Looks to me like some mail address line damage - and local domain
expansion with unqualified email addresses

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 16:27       ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
@ 2010-04-26 18:03         ` Carl Worth
  2010-04-26 18:20           ` David Edmondson
  0 siblings, 1 reply; 16+ messages in thread
From: Carl Worth @ 2010-04-26 18:03 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

On Mon, 26 Apr 2010 17:27:38 +0100, David Edmondson <dme@dme.org> wrote:
> Patch is sent for this, though given that it's not easy to change the
> prompt as you step through, it says:
> 
> 	Address (7 match): Name Here <address@example.com>

Thanks. I've pushed this. Bonus points to someone who fixes it to avoid
printing "1 matches".

> Moving through potential completions is pretty standard Emacs UI stuff,
> so I'm not sure if it's necessary to explain? (Of course, that you had
> to ask suggests otherwise...)

It is funny that I've used emacs for all these years without learning
this.

But in general, I have been trying to keep the notmuch interface fairly
self-explanatory. I know that some people that have never used emacs at
all are giving notmuch a try, just to see what it's like. And I'd like
to help them have as positive experience as possible.

> > I don't suppose it would be feasible to make Space and DEL navigate
> > through the list as well would it?
> 
> Not with `completing-read', but I'll look at it after 0.3.

That's what I'd assumed. If we end up doing our own thing here, I'd even
have a few more things on my wishlist. I think I'd like for matching
addresses to start appearing in the minibuffer as I started typing,
(even before hitting TAB).

Of course, for that we're going to need a faster address completer,
which will mean getting the actual addresses into the database. So I'll
add that to my list of the many things I want to fix in the great
database-schema-rewrite that's coming soon.

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 16:28       ` David Edmondson
  2010-04-26 16:40         ` Dirk Hohndel
@ 2010-04-26 18:08         ` Carl Worth
  1 sibling, 0 replies; 16+ messages in thread
From: Carl Worth @ 2010-04-26 18:08 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]

On Mon, 26 Apr 2010 17:28:47 +0100, David Edmondson <dme@dme.org> wrote:
> 
>    To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org, dirk@yoom.home.cworth.org
>    Cc: carl@ut.hh.sledj.net
>    Date: Mon, 26 Apr 2010 08:21:51 -0700
> 
> Something interesting is happening here :-)

Dirk wasn't involved in the original message I was replying to at all.

And I can confirm that "notmuch reply id:87k4ru5vzp.fsf@ut.hh.sledj.net"
isn't inserting "dirk" anywhere.

But this is an address-completion thread, and I did test that
functionality by typing "dirk[TAB]". I would have thought that I had
deleted the results of any expansion, (or left the expanded results).

David, you seem to be having the problem with carl@ut.hh.sledj.net more
frequently, so perhaps you can identify the trigger.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 18:03         ` Carl Worth
@ 2010-04-26 18:20           ` David Edmondson
  2010-04-26 18:40             ` Carl Worth
  0 siblings, 1 reply; 16+ messages in thread
From: David Edmondson @ 2010-04-26 18:20 UTC (permalink / raw)
  To: Carl Worth, notmuch

[-- Attachment #1: Type: text/plain, Size: 564 bytes --]

On Mon, 26 Apr 2010 11:03:36 -0700, Carl Worth <cworth@cworth.org> wrote:
> Thanks. I've pushed this. Bonus points to someone who fixes it to avoid
> printing "1 matches".

It shouldn't do that:

  (let* (...
	 (num-options (length options))
	 (chosen (if (eq num-options 1)
		     (car options)
		   (completing-read (format "Address (%s matches): " num-options)
				    (cdr options) nil nil (car options)
				    'notmuch-address-history))))

Does it?

More interesting is the zero matches case...

dme.
-- 
David Edmondson, http://dme.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] emacs: Add notmuch-address.el for address completion using notmuch
  2010-04-26 18:20           ` David Edmondson
@ 2010-04-26 18:40             ` Carl Worth
  0 siblings, 0 replies; 16+ messages in thread
From: Carl Worth @ 2010-04-26 18:40 UTC (permalink / raw)
  To: David Edmondson, notmuch

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

carl.d.worth@intel.com
On Mon, 26 Apr 2010 19:20:04 +0100, David Edmondson <dme@dme.org> wrote:
> On Mon, 26 Apr 2010 11:03:36 -0700, Carl Worth <cworth@cworth.org> wrote:
> > Thanks. I've pushed this. Bonus points to someone who fixes it to avoid
> > printing "1 matches".
> 
> It shouldn't do that:
...
> Does it?

Bah. My fault for glancing at the code (incorrectly) rather than running
it.

Move along, nothing to see here...

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-04-26 18:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22  9:03 [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
2010-04-22 14:47 ` Dirk Hohndel
2010-04-24  0:49 ` Carl Worth
2010-04-26 10:48   ` [PATCH] emacs: Automatically load "notmuch-address" David Edmondson
2010-04-26 10:49   ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
2010-04-26 11:29     ` Sebastian Spaeth
2010-04-26 11:41       ` David Edmondson
2010-04-26 15:21     ` Carl Worth
2010-04-26 16:25       ` [PATCH] emacs: Tell the user how many addresses matched when completing dme
2010-04-26 16:27       ` [PATCH] emacs: Add notmuch-address.el for address completion using notmuch David Edmondson
2010-04-26 18:03         ` Carl Worth
2010-04-26 18:20           ` David Edmondson
2010-04-26 18:40             ` Carl Worth
2010-04-26 16:28       ` David Edmondson
2010-04-26 16:40         ` Dirk Hohndel
2010-04-26 18:08         ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).