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