unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: sfischme@uwaterloo.ca, notmuch@notmuchmail.org
Subject: Re: Better support for helm in the address completion
Date: Wed, 17 Sep 2014 01:26:57 +0300	[thread overview]
Message-ID: <m2vbonxkum.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <87vbonhgwe.fsf@uwaterloo.ca>

On Tue, Sep 16 2014, Sebastian Fischmeister <sfischme@uwaterloo.ca> wrote:

> Hi,
>
> I noticed that the completing-read in notmuch-address-selection-function
> was eating the first returned address when using helm. Here's a patch
> that fixes it. The defaults are as they used to be.

If you don't want to provide patch according to 

http://notmuchmail.org/contributing/

(patch format & commit message are important to attract reviewers (who!?;) ))

and additionally explain (to me) why some of those things are changed to
symbols you can just edit

~/.emacs.d/notmuch-config.el

and add

(setq notmuch-address-selection-function
      (lambda (prompt collection initial-input)
        (completing-read prompt (cons initial-input collection) nil t nil 'notmuch-address-history)))

there (or use customize to do that (?)).

If I were smarter when I split this call out from notmuch-address-expand-name
I would not have called it with (car options) (cdr options) but split
it in that selection-function but that is how it is now...(*)

Tomi

(*) Especially as I did that just so that I can do this:

(setq notmuch-address-selection-function
      (lambda (prompt collection initial-input)
        (selection-menu "Send To:" (cons initial-input collection) t)))

;/



> For helm use:
>
> (setq notmuch-address-suggest-initial-match nil)
>
> If you don't want to enter a new address in the selection (with helm)
> use:
>
> (setq notmuch-address-require-match t)
>
>   Sebastian
>
> diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
> index fa65cd5..d9b66cd 100644
> --- a/emacs/notmuch-address.el
> +++ b/emacs/notmuch-address.el
> @@ -42,11 +42,25 @@ to know how address selection is made by default."
>    :group 'notmuch-send
>    :group 'notmuch-external)
>  
> +(defcustom notmuch-address-suggest-initial-match t
> +  "Pass an initial match to the address completing read."
> +  :type 'boolean
> +  :group 'notmuch-send)
> +
> +(defcustom notmuch-address-require-match nil
> +  "Require a match in the address selection in `notmuch-address-selection-function'."
> +  :type 'boolean
> +  :group 'notmuch-send)
> +
>  (defun notmuch-address-selection-function (prompt collection initial-input)
>    "Call (`completing-read'
>        PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
>    (completing-read
> -   prompt collection nil nil initial-input 'notmuch-address-history))
> +   prompt
> +   (if notmuch-address-suggest-initial-match 'collection (list initial-input collection))
> +   nil notmuch-address-require-match
> +   (if notmuch-address-suggest-initial-match 'initial-input nil)
> +   'notmuch-address-history))
>  
>  (defvar notmuch-address-message-alist-member
>    '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2014-09-16 22:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 12:47 Better support for helm in the address completion Sebastian Fischmeister
2014-09-16 22:26 ` Tomi Ollila [this message]
2014-09-18 13:25   ` Sebastian Fischmeister
2014-09-18 13:33     ` 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=m2vbonxkum.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    --cc=sfischme@uwaterloo.ca \
    /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).