Better support for helm in the address completion

2014-09-18 Thread David Bremner
Sebastian Fischmeister  writes:

>> (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 (?)).
>
> That's perfectly fine as well, and even simpler to use. Maybe adding
> this to the emacstips page [1] under "Address completion when composing"
> would be a good idea.
>
>   Sebastian
>
> PS: http://notmuchmail.org/emacstips/

PPS: http://notmuchmail.org/wikiwriteaccess/

;)

d


Better support for helm in the address completion

2014-09-18 Thread Sebastian Fischmeister
> (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 (?)).

That's perfectly fine as well, and even simpler to use. Maybe adding
this to the emacstips page [1] under "Address completion when composing"
would be a good idea.

  Sebastian

PS: http://notmuchmail.org/emacstips/


Re: Better support for helm in the address completion

2014-09-18 Thread Sebastian Fischmeister
 (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 (?)).

That's perfectly fine as well, and even simpler to use. Maybe adding
this to the emacstips page [1] under Address completion when composing
would be a good idea.

  Sebastian

PS: http://notmuchmail.org/emacstips/
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Better support for helm in the address completion

2014-09-18 Thread David Bremner
Sebastian Fischmeister sfisc...@uwaterloo.ca writes:

 (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 (?)).

 That's perfectly fine as well, and even simpler to use. Maybe adding
 this to the emacstips page [1] under Address completion when composing
 would be a good idea.

   Sebastian

 PS: http://notmuchmail.org/emacstips/

PPS: http://notmuchmail.org/wikiwriteaccess/

;)

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Better support for helm in the address completion

2014-09-17 Thread Tomi Ollila
On Tue, Sep 16 2014, Sebastian Fischmeister  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 at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Better support for helm in the address completion

2014-09-16 Thread Sebastian Fischmeister
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.

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\\):"


Better support for helm in the address completion

2014-09-16 Thread Sebastian Fischmeister
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.

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


Re: Better support for helm in the address completion

2014-09-16 Thread Tomi Ollila
On Tue, Sep 16 2014, Sebastian Fischmeister sfisc...@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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch