unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] Fix non internal cases for notmuch-address-command
Date: Sun, 25 Oct 2015 00:09:36 +0100	[thread overview]
Message-ID: <1445728176-5168-1-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <87io5wkvb5.fsf@zancas.localnet>

This makes tab completion do nothing when notmuch-address-command is
nil.

It also stops company mode from being used when an external command is
specified, which was giving rise to some strange behaviour.
---

This patch is only really a 3 line patch (if you do a word-diff): the
rest is a whitespace change.

Best wishes

Mark

emacs/notmuch-address.el | 53 ++++++++++++++++++++++++------------------------
 emacs/notmuch-mua.el     |  1 +
 2 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 2a748ec..d82c2aa 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -98,32 +98,33 @@ (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 (with-temp-message "Looking for completion candidates..."
-		    (notmuch-address-options orig)))
-	 (num-options (length options))
-	 (chosen (cond
-		  ((eq num-options 0)
-		   nil)
-		  ((eq num-options 1)
-		   (car options))
-		  (t
-		   (funcall notmuch-address-selection-function
-			    (format "Address (%s matches): " num-options)
-			    (cdr options) (car options))))))
-    (if chosen
-	(progn
-	  (push chosen notmuch-address-history)
-	  (delete-region beg end)
-	  (insert chosen))
-      (message "No matches.")
-      (ding))))
+  (when notmuch-address-command
+    (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 (with-temp-message "Looking for completion candidates..."
+		      (notmuch-address-options orig)))
+	   (num-options (length options))
+	   (chosen (cond
+		    ((eq num-options 0)
+		     nil)
+		    ((eq num-options 1)
+		     (car options))
+		    (t
+		     (funcall notmuch-address-selection-function
+			      (format "Address (%s matches): " num-options)
+			      (cdr options) (car options))))))
+      (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)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 3feea29..63fc8db 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -280,6 +280,7 @@ (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]"
       (setq message-completion-alist
 	    (push notmuch-address-message-alist-member message-completion-alist))))
   (when (and notmuch-message-use-company
+	     (eq notmuch-address-command 'internal)
 	     (require 'company nil t))
     (notmuch-company-setup)))
 
-- 
2.1.4

  reply	other threads:[~2015-10-24 23:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24  0:20 elisp based address completion, round 5 David Bremner
2015-10-24  0:20 ` [Patch v5 1/3] Emacs: Add address completion mechanism implemented in elisp David Bremner
2015-10-24  0:20 ` [Patch v5 2/3] emacs: convert notmuch-address-harvester to use notmuch-address David Bremner
2015-10-24  8:23   ` Jani Nikula
2015-10-24 10:35   ` Mark Walters
2015-10-24  0:20 ` [Patch v5 3/3] Emacs: Add address completion based on company-mode David Bremner
2015-10-24  0:35   ` David Bremner
2015-10-24 15:53   ` [PATCH] autoload notmuch-company if we have company Mark Walters
2015-10-24 17:41     ` elisp completion patches v6 David Bremner
2015-10-24 17:41       ` [PATCH 1/3] emacs: replace use of notmuch-address-message-insinuate David Bremner
2015-10-24 17:41       ` [PATCH 2/3] Emacs: Add address completion mechanism implemented in elisp David Bremner
2015-10-24 17:41       ` [PATCH 3/3] Emacs: Add address completion based on company-mode David Bremner
2015-10-24 19:49         ` [PATCH] fix compilation on emacs23 Mark Walters
2015-10-24 23:34         ` [PATCH 3/3] Emacs: Add address completion based on company-mode Mark Walters
2015-10-25  9:16           ` [PATCH] Fix clash of company mode and async harvest Mark Walters
2015-10-25 13:02             ` [PATCH] address completion tweaks Mark Walters
2015-10-24 17:53       ` elisp completion patches v6 David Bremner
2015-10-24 23:09         ` Mark Walters [this message]
2015-10-25 21:39       ` Aaron Ecay

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=1445728176-5168-1-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --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).