--- /dev/null
+Return-Path: <too@guru-group.fi>\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 72D336DE026C\r
+ for <notmuch@notmuchmail.org>; Sat, 7 May 2016 12:03:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.268\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.268 tagged_above=-999 required=5 tests=[AWL=0.277, \r
+ HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01]\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 7ZdqQH-zzxpg for <notmuch@notmuchmail.org>;\r
+ Sat, 7 May 2016 12:03:18 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 212856DE00EB\r
+ for <notmuch@notmuchmail.org>; Sat, 7 May 2016 12:03:17 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 78216100227; Sat, 7 May 2016 22:03:14 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Cc: tomi.ollila@iki.fi\r
+Subject: notmuch-show-message-resend v3\r
+Date: Sat, 7 May 2016 22:03:10 +0300\r
+Message-Id: <1462647792-25427-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.6.4\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, 07 May 2016 19:03:28 -0000\r
+\r
+V3 of notmuch-show-message-resend feature\r
+\r
+v2: id:1441204482-26509-3-git-send-email-tomi.ollila@iki.fi\r
+\r
+id:87pozza0dw.fsf@qmul.ac.uk has been consulted while doing\r
+these changes (iirc ;)\r
+\r
+I tried to get company mode also work while reading email\r
+addresses from minibuffer -- and got something to function,\r
+but not anything really working. Therefore this currently\r
+uses minibuffer (with tab completion) working.\r
+\r
+The following diff shows what I tried to do to get it working.\r
+In addition to work poorly it breaks "normal" address tab\r
+completion (as it was crafted to work with minibuffer completion\r
+tests only)\r
+\r
+\r
+diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el\r
+index 7defed3..7a8424e 100644\r
+--- a/emacs/notmuch-address.el\r
++++ b/emacs/notmuch-address.el\r
+@@ -256,12 +256,11 @@ (defun notmuch-address-from-minibuffer (prompt)\r
+ ;; "Original" minibuffer keymap is restored just before calling\r
+ ;; notmuch-address-expand-name as it may also use minibuffer-local-map\r
+ ;; (completing-read probably does not but if something else is used there).\r
+- (define-key rmap (kbd "TAB") (lambda ()\r
+- (interactive)\r
+- (let ((enable-recursive-minibuffers t)\r
+- (minibuffer-local-map omap))\r
+- (notmuch-address-expand-name))))\r
+- (let ((minibuffer-local-map rmap))\r
++ (define-key rmap (kbd "TAB") #'company-manual-begin)\r
++\r
++ (let ((minibuffer-local-map rmap)\r
++ (minibuffer-setup-hook minibuffer-setup-hook))\r
++ (add-hook 'minibuffer-setup-hook #'notmuch-company-setup)\r
+ (read-string prompt)))))\r
+ \r
+ ;;\r
+diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el\r
+index add3161..210175a 100644\r
+--- a/emacs/notmuch-company.el\r
++++ b/emacs/notmuch-company.el\r
+@@ -45,7 +45,7 @@ (defvar notmuch-address-completion-headers-regexp)\r
+ \r
+ ;;;###autoload\r
+ (defun notmuch-company-setup ()\r
+- (company-mode)\r
++ (company-mode 1)\r
+ (make-local-variable 'company-backends)\r
+ (setq company-backends '(notmuch-company)))\r
+ \r
+@@ -58,10 +58,7 @@ (defun notmuch-company (command &optional arg &rest _ignore)\r
+ (completion-ignore-case t))\r
+ (case command\r
+ (interactive (company-begin-backend 'notmuch-company))\r
+- (prefix (and (derived-mode-p 'message-mode)\r
+- (looking-back (concat notmuch-address-completion-headers-regexp ".*")\r
+- (line-beginning-position))\r
+- (setq notmuch-company-last-prefix (company-grab "[:,][ \t]*\\(.*\\)" 1 (point-at-bol)))))\r
++ (prefix (setq notmuch-company-last-prefix (company-grab "[:,][ \t]*\\(.*\\)" 1)))\r
+ (candidates (cond\r
+ (notmuch-address-full-harvest-finished\r
+ ;; Update harvested addressed from time to time\r
+@@ -82,5 +79,15 @@ (defun notmuch-company (command &optional arg &rest _ignore)\r
+ 0))\r
+ (no-cache t))))\r
+ \r
++;; (partial) code snipped someone(tm) doing some company-minubuffer stuff\r
++;; (defun company--posn-col-row (posn)\r
++;; (let ((col (car (posn-col-row posn)))\r
++;; ;; `posn-col-row' doesn't work well with lines of different height.\r
++;; ;; `posn-actual-col-row' doesn't handle multiple-width characters.\r
++;; (row (cdr (posn-actual-col-row posn))))\r
++;; (when (and header-line-format (version< emacs-version "24.3.93.3"))\r
++;; ;; http://debbugs.gnu.org/18384\r
++;; (cl-decf row))\r
++;; (cons (+ col (window-hscroll) company-col-offset) (+ row company-row-offset))))\r
+ \r
+ (provide 'notmuch-company)\r
+-- \r
+1.9.3\r
+\r
+\r