unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: Don't prompt the user to choose from zero matching addresses.
Date: Wed, 21 Dec 2011 15:20:04 +0200	[thread overview]
Message-ID: <yf6pqfigiyi.fsf@taco2.nixu.fi> (raw)
In-Reply-To: <1324470927-15353-1-git-send-email-dme@dme.org>

On Wed, 21 Dec 2011 12:35:27 +0000, David Edmondson <dme@dme.org> wrote:
> If the address matching function generates no matches, don't prompt
> the user to choose between them (!). Instead, generate a message to
> report that there were no matches.
> ---

LGTM

>  emacs/notmuch-address.el |   21 ++++++++++++++-------
>  1 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index 1a7c577..8eba7a0 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -54,15 +54,22 @@ line."
>  	 (completion-ignore-case t)
>  	 (options (notmuch-address-options orig))
>  	 (num-options (length options))
> -	 (chosen (if (eq num-options 1)
> -		     (car options)
> +	 (chosen (cond
> +		  ((eq num-options 0)
> +		   nil)
> +		  ((eq num-options 1)
> +		   (car options))
> +		  (t
>  		   (completing-read (format "Address (%s matches): " num-options)
>  				    (cdr options) nil nil (car options)
> -				    'notmuch-address-history))))
> -    (when chosen
> -      (push chosen notmuch-address-history)
> -      (delete-region beg end)
> -      (insert chosen))))
> +				    'notmuch-address-history)))))
> +    (if chosen
> +	(progn
> +	  (push chosen notmuch-address-history)
> +	  (delete-region beg end)
> +	  (insert chosen))
> +      (message "No matches.")
> +      (ding))))
>  
>  ;; Copied from `w3m-which-command'.
>  (defun notmuch-address-locate-command (command)
> -- 
> 1.7.7.3

Tomi

  reply	other threads:[~2011-12-21 13:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 12:35 [PATCH] emacs: Don't prompt the user to choose from zero matching addresses David Edmondson
2011-12-21 13:20 ` Tomi Ollila [this message]
2011-12-22 11:25 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yf6pqfigiyi.fsf@taco2.nixu.fi \
    --to=tomi.ollila@iki.fi \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).