unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Better support for helm in the address completion
@ 2014-09-16 12:47 Sebastian Fischmeister
  2014-09-16 22:26 ` Tomi Ollila
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Fischmeister @ 2014-09-16 12:47 UTC (permalink / raw)
  To: notmuch

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

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

end of thread, other threads:[~2014-09-18 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16 12:47 Better support for helm in the address completion Sebastian Fischmeister
2014-09-16 22:26 ` Tomi Ollila
2014-09-18 13:25   ` Sebastian Fischmeister
2014-09-18 13:33     ` David Bremner

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