--- /dev/null
+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 2CBFD6DE02C4\r
+ for <notmuch@notmuchmail.org>; Fri, 20 May 2016 13:13:34 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.318\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.318 tagged_above=-999 required=5 tests=[AWL=0.252,\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 WJvYFAwtgBYc for <notmuch@notmuchmail.org>;\r
+ Fri, 20 May 2016 13:13:26 -0700 (PDT)\r
+Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com\r
+ [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 849C96DE0173 for\r
+ <notmuch@notmuchmail.org>; Fri, 20 May 2016 13:13:25 -0700 (PDT)\r
+Received: by mail-wm0-f65.google.com with SMTP id q62so3807155wmg.3\r
+ for <notmuch@notmuchmail.org>; Fri, 20 May 2016 13:13:25 -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=UccHfVDFLI7UgDSXQTwrT3d+P9JOFAeOgKElCRfaWNM=;\r
+ b=IDaXfi3js9vqprv9CYTyWX3ZG3pfc2SDAHPGwKYZGRftphhZtRTVU0ULbK/n4IXahJ\r
+ HpYnrP65FS/NvH3nPGW+GDX1x71JcIvNlWqWUtkbK9y95wYxyHZ3CxT4Bq4Hxhvfzcbr\r
+ D5RLN4qzDOC77ewnV/T+p+XTIdG4XImI727h0TRZ7TO6AXw/nik/GB1LkzjijsfnJUq4\r
+ 230dleve1KGSLA9oztpdWrcFbZ9fFdDEWAHmUsKI8lHeIxZz/4AcJOhkOPkiiUMtEaE+\r
+ nbc6dBRisYWX8SpGyY/aQlEXOCobykood4o2N5+ScVrgTOIwG2smwcncSIBGrjRw6KZk\r
+ /Xwg==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=UccHfVDFLI7UgDSXQTwrT3d+P9JOFAeOgKElCRfaWNM=;\r
+ b=XNKzebBW1yrXgr31jfy8jT/nzr/aNUy0uaSCeHxsyzgNx0bcY9H8YFM8fhhHRXbKop\r
+ g4s3VzxQj1qkWjiz/claxjPf9858maj17CrlYKv+VgOkVKljs1HkGkDfqPNq4j+gpLdW\r
+ Pkpw7iw0yjARFEveBSQmB4qkH1UGA3WqwGarF32XYiWb2bZpwa3+l143YEXjevmzcLfE\r
+ Spo/7t5ljwNlAKKgr9zTioyN09Snw1MOkArQKrFINgsRRzFGdnHbGOugB/1GrAkJFJOE\r
+ 6Ehn40CnMUFGaQOB+g5ELXQzCQtSleFIwXqJ2DU45uJUw4i82yBaUvggvOF3RmwsYLSJ\r
+ lLuw==\r
+X-Gm-Message-State:\r
+ AOPr4FXzCxEZ1MfBf8EAftxCeDP/lyvw+nLNy8rvSSo3yzuoOOSmSUs3Y26dhHEAHSE/pA==\r
+X-Received: by 10.194.205.105 with SMTP id lf9mr5040865wjc.25.1463775204205;\r
+ Fri, 20 May 2016 13:13:24 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by smtp.gmail.com with ESMTPSA id 63sm6246571wmz.5.2016.05.20.13.13.23\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Fri, 20 May 2016 13:13:23 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] emacs: address: allow internal completion on an\r
+ individual basis\r
+Date: Fri, 20 May 2016 21:13:03 +0100\r
+Message-Id: <1463775183-16234-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1463775183-16234-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1463775183-16234-1-git-send-email-markwalters1009@gmail.com>\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: Fri, 20 May 2016 20:13:34 -0000\r
+\r
+This commit makes two changes. The first allows the user to override\r
+an external completion method with the internal notmuch address based\r
+completion for an individual buffer.\r
+\r
+Secondly, if the user has company-mode enabled then it sets up company\r
+mode (based on internal completion) but disables the automatic timeout\r
+completion -- the user can still activate it in when desired with\r
+standard company commands such as company-complete.\r
+---\r
+ emacs/notmuch-address.el | 19 ++++++++++++++++---\r
+ emacs/notmuch-company.el | 8 +++++++-\r
+ 2 files changed, 23 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+index 3e7bdab..b5bd151 100644\r
+--- a/emacs/notmuch-address.el\r
++++ b/emacs/notmuch-address.el\r
+@@ -118,17 +118,30 @@ to know how address selection is made by default."\r
+ :group 'notmuch-send)\r
+ \r
+ (defun notmuch-address-setup ()\r
+- (let* ((use-company (and notmuch-address-use-company\r
+- (eq notmuch-address-command 'internal)\r
++ (let* ((setup-company (and notmuch-address-use-company\r
+ (require 'company nil t)))\r
+ (pair (cons notmuch-address-completion-headers-regexp\r
+ #'notmuch-address-expand-name)))\r
+- (when use-company\r
++ (when setup-company\r
+ (notmuch-company-setup))\r
+ (unless (memq pair message-completion-alist)\r
+ (setq message-completion-alist\r
+ (push pair message-completion-alist)))))\r
+ \r
++(defun notmuch-address-toggle-internal-completion ()\r
++ "Toggle use of internal completion for current buffer.\r
++\r
++This overrides the global setting for address completion and\r
++toggles the setting in this buffer."\r
++ (interactive)\r
++ (if (local-variable-p 'notmuch-address-command)\r
++ (kill-local-variable 'notmuch-address-command)\r
++ (setq-local notmuch-address-command 'internal))\r
++ (if (boundp 'company-idle-delay)\r
++ (if (local-variable-p 'company-idle-delay)\r
++ (kill-local-variable 'company-idle-delay)\r
++ (setq-local company-idle-delay nil))))\r
++\r
+ (defun notmuch-address-matching (substring)\r
+ "Returns a list of completion candidates matching SUBSTRING.\r
+ The candidates are taken from `notmuch-address-completions'."\r
+diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el\r
+index dcb59cd..5febc49 100644\r
+--- a/emacs/notmuch-company.el\r
++++ b/emacs/notmuch-company.el\r
+@@ -47,7 +47,13 @@\r
+ (defun notmuch-company-setup ()\r
+ (company-mode)\r
+ (make-local-variable 'company-backends)\r
+- (setq company-backends '(notmuch-company)))\r
++ (setq company-backends '(notmuch-company))\r
++ ;; Disable automatic company completion unless an internal\r
++ ;; completion method is configured. Company completion (using\r
++ ;; internal completion) can still be accessed via standard company\r
++ ;; functions, e.g., company-complete.\r
++ (unless (eq notmuch-address-command 'internal)\r
++ (setq-local company-idle-delay nil)))\r
+ \r
+ ;;;###autoload\r
+ (defun notmuch-company (command &optional arg &rest _ignore)\r
+-- \r
+2.1.4\r
+\r