[PATCH] Fix non internal cases for notmuch-address-command
authorMark Walters <markwalters1009@gmail.com>
Sat, 24 Oct 2015 23:09:36 +0000 (00:09 +0100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:55 +0000 (14:49 -0700)
b0/7f09c5cbccbf69ecad46165a6bd56fda52f4b8 [new file with mode: 0644]

diff --git a/b0/7f09c5cbccbf69ecad46165a6bd56fda52f4b8 b/b0/7f09c5cbccbf69ecad46165a6bd56fda52f4b8
new file mode 100644 (file)
index 0000000..ea3a880
--- /dev/null
@@ -0,0 +1,159 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A46296DE178A\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Oct 2015 16:09:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.084\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.084 tagged_above=-999 required=5 tests=[AWL=0.486,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id x_5opMA7Hvim for <notmuch@notmuchmail.org>;\r
+ Sat, 24 Oct 2015 16:09:45 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+ [209.85.212.173])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 87D1D6DE176A\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Oct 2015 16:09:45 -0700 (PDT)\r
+Received: by wicfx6 with SMTP id fx6so71134821wic.1\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Oct 2015 16:09:43 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=YO6+MEks+JCsrrVgoVPHqq3ReCq/UfIer8VVuEt1dJM=;\r
+ b=x2JnaAuwMwsx++wiGz5vB0xu9NauLXjNjbOBz3jkqoeiXpA1p3ecbcHbqNfYEB/1/8\r
+ PaxCR09ELoK45cjnVIXU3Iu7exHrLZcU4PpjJtNCS6HcAnKsgyXOoVq36zBcF57GIl0y\r
+ yADWsqKbK29wtjqKSLhh6mWG38riXO0KsCXJy01Oq1FBk6ksSOYh6GURMxl5xJtRx1s/\r
+ RN88TaCFm7aXoub+alRkz3V5356C1BKa1N8Ytq2HGMXcdgsIQHBZcLMCq/Pr8g/6KhI4\r
+ B4NCr/FCBiHTsniy8fLYdiaJS4M2nnfysGJxAp6Is+ZZMzjMWfkjM5yhGjI47LtI8475\r
+ tIGw==\r
+X-Received: by 10.180.198.142 with SMTP id jc14mr12176696wic.64.1445728183523;\r
+  Sat, 24 Oct 2015 16:09:43 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by smtp.gmail.com with ESMTPSA id q204sm1199336wmg.4.2015.10.24.16.09.42\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 24 Oct 2015 16:09:42 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] Fix non internal cases for notmuch-address-command\r
+Date: Sun, 25 Oct 2015 00:09:36 +0100\r
+Message-Id: <1445728176-5168-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <87io5wkvb5.fsf@zancas.localnet>\r
+References: <87io5wkvb5.fsf@zancas.localnet>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 24 Oct 2015 23:09:47 -0000\r
+\r
+This makes tab completion do nothing when notmuch-address-command is\r
+nil.\r
+\r
+It also stops company mode from being used when an external command is\r
+specified, which was giving rise to some strange behaviour.\r
+---\r
+\r
+This patch is only really a 3 line patch (if you do a word-diff): the\r
+rest is a whitespace change.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+emacs/notmuch-address.el | 53 ++++++++++++++++++++++++------------------------\r
+ emacs/notmuch-mua.el     |  1 +\r
+ 2 files changed, 28 insertions(+), 26 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+index 2a748ec..d82c2aa 100644\r
+--- a/emacs/notmuch-address.el\r
++++ b/emacs/notmuch-address.el\r
+@@ -98,32 +98,33 @@ (defun notmuch-address-options (original)\r
+     (process-lines notmuch-address-command original))))\r
\r
+ (defun notmuch-address-expand-name ()\r
+-  (let* ((end (point))\r
+-       (beg (save-excursion\r
+-              (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")\r
+-              (goto-char (match-end 0))\r
+-              (point)))\r
+-       (orig (buffer-substring-no-properties beg end))\r
+-       (completion-ignore-case t)\r
+-       (options (with-temp-message "Looking for completion candidates..."\r
+-                  (notmuch-address-options orig)))\r
+-       (num-options (length options))\r
+-       (chosen (cond\r
+-                ((eq num-options 0)\r
+-                 nil)\r
+-                ((eq num-options 1)\r
+-                 (car options))\r
+-                (t\r
+-                 (funcall notmuch-address-selection-function\r
+-                          (format "Address (%s matches): " num-options)\r
+-                          (cdr options) (car options))))))\r
+-    (if chosen\r
+-      (progn\r
+-        (push chosen notmuch-address-history)\r
+-        (delete-region beg end)\r
+-        (insert chosen))\r
+-      (message "No matches.")\r
+-      (ding))))\r
++  (when notmuch-address-command\r
++    (let* ((end (point))\r
++         (beg (save-excursion\r
++                (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*")\r
++                (goto-char (match-end 0))\r
++                (point)))\r
++         (orig (buffer-substring-no-properties beg end))\r
++         (completion-ignore-case t)\r
++         (options (with-temp-message "Looking for completion candidates..."\r
++                    (notmuch-address-options orig)))\r
++         (num-options (length options))\r
++         (chosen (cond\r
++                  ((eq num-options 0)\r
++                   nil)\r
++                  ((eq num-options 1)\r
++                   (car options))\r
++                  (t\r
++                   (funcall notmuch-address-selection-function\r
++                            (format "Address (%s matches): " num-options)\r
++                            (cdr options) (car options))))))\r
++      (if chosen\r
++        (progn\r
++          (push chosen notmuch-address-history)\r
++          (delete-region beg end)\r
++          (insert chosen))\r
++      (message "No matches.")\r
++      (ding)))))\r
\r
+ ;; Copied from `w3m-which-command'.\r
+ (defun notmuch-address-locate-command (command)\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 3feea29..63fc8db 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -280,6 +280,7 @@ (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]"\r
+       (setq message-completion-alist\r
+           (push notmuch-address-message-alist-member message-completion-alist))))\r
+   (when (and notmuch-message-use-company\r
++           (eq notmuch-address-command 'internal)\r
+            (require 'company nil t))\r
+     (notmuch-company-setup)))\r
\r
+-- \r
+2.1.4\r
+\r