From 37a43f6260a3def7f8c85de770bb080eb19c98ab Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Tue, 27 Oct 2015 00:22:47 +0100 Subject: [PATCH] [PATCH v8 1/3] emacs: replace use of notmuch-address-message-insinuate --- 03/9cec3bebb48483ee533fdc44667946373be6fc | 135 ++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 03/9cec3bebb48483ee533fdc44667946373be6fc diff --git a/03/9cec3bebb48483ee533fdc44667946373be6fc b/03/9cec3bebb48483ee533fdc44667946373be6fc new file mode 100644 index 000000000..817d458b5 --- /dev/null +++ b/03/9cec3bebb48483ee533fdc44667946373be6fc @@ -0,0 +1,135 @@ +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 BCA766DE18EF + for ; Mon, 26 Oct 2015 16:30:13 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.258 +X-Spam-Level: +X-Spam-Status: No, score=-0.258 tagged_above=-999 required=5 tests=[AWL=1.848, + RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55, URIBL_SBL=0.644, + URIBL_SBL_A=0.1] 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 oufG01Ow7W4e for ; + Mon, 26 Oct 2015 16:30:11 -0700 (PDT) +Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) + by arlo.cworth.org (Postfix) with ESMTP id E35196DE17DC + for ; Mon, 26 Oct 2015 16:30:08 -0700 (PDT) +Received: from localhost (unknown [192.168.200.7]) + by max.feld.cvut.cz (Postfix) with ESMTP id 48F8619F499F; + Tue, 27 Oct 2015 00:23:05 +0100 (CET) +X-Virus-Scanned: IMAP STYX AMAVIS +Received: from max.feld.cvut.cz ([192.168.200.1]) + by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044) + with ESMTP id stsj_y6TueB0; Tue, 27 Oct 2015 00:23:03 +0100 (CET) +Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) + by max.feld.cvut.cz (Postfix) with ESMTP id 45EDD19F499E; + Tue, 27 Oct 2015 00:23:02 +0100 (CET) +Received: from wsh by steelpick.2x.cz with local (Exim 4.86) + (envelope-from ) + id 1Zqr6S-0007ad-Iw; Tue, 27 Oct 2015 00:23:00 +0100 +From: Michal Sojka +To: notmuch@notmuchmail.org +Subject: [PATCH v8 1/3] emacs: replace use of + notmuch-address-message-insinuate +Date: Tue, 27 Oct 2015 00:22:47 +0100 +Message-Id: <1445901769-29134-2-git-send-email-sojkam1@fel.cvut.cz> +X-Mailer: git-send-email 2.5.3 +In-Reply-To: <1445901769-29134-1-git-send-email-sojkam1@fel.cvut.cz> +References: <1445901769-29134-1-git-send-email-sojkam1@fel.cvut.cz> +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: Mon, 26 Oct 2015 23:30:13 -0000 + +From: David Bremner + +This allows e.g. Gnus users to load this file without changing +message-mode behaviour. + +This will disable completion for those that did not customize the +variable but relied on the existence of a file named "notmuch-addresses" +in their path. In the next commit the default behaviour will change to +use a "workalike" internal completion mechanism. +--- + emacs/notmuch-address.el | 19 ++++++++----------- + emacs/notmuch-mua.el | 4 +++- + 2 files changed, 11 insertions(+), 12 deletions(-) + +diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el +index fde3c1b..e2af879 100644 +--- a/emacs/notmuch-address.el ++++ b/emacs/notmuch-address.el +@@ -23,11 +23,13 @@ + + ;; + +-(defcustom notmuch-address-command "notmuch-addresses" ++(defcustom notmuch-address-command nil + "The command which generates possible addresses. It must take a + single argument and output a list of possible matches, one per +-line." +- :type 'string ++line. The default value of nil disables address completion." ++ :type '(radio ++ (const :tag "Disable address completion" nil) ++ (string :tag "Use external completion command" "notmuch-addresses")) + :group 'notmuch-send + :group 'notmuch-external) + +@@ -55,10 +57,12 @@ to know how address selection is made by default." + (defvar notmuch-address-history nil) + + (defun notmuch-address-message-insinuate () ++ (message "calling notmuch-address-message-insinuate is no longer needed")) ++ ++(defun notmuch-address-setup () + (unless (memq notmuch-address-message-alist-member message-completion-alist) + (setq message-completion-alist + (push notmuch-address-message-alist-member message-completion-alist)))) +- + (defun notmuch-address-options (original) + (process-lines notmuch-address-command original)) + +@@ -109,11 +113,4 @@ to know how address selection is made by default." + (not (file-directory-p bin)))) + (throw 'found-command bin)))))))) + +-;; If we can find the program specified by `notmuch-address-command', +-;; insinuate ourselves into `message-mode'. +-(when (notmuch-address-locate-command notmuch-address-command) +- (notmuch-address-message-insinuate)) +- +-;; +- + (provide 'notmuch-address) +diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +index 57465b2..fd98ea4 100644 +--- a/emacs/notmuch-mua.el ++++ b/emacs/notmuch-mua.el +@@ -269,7 +269,9 @@ Note that these functions use `mail-citation-hook' if that is non-nil." + (set-buffer-modified-p nil)) + + (define-derived-mode notmuch-message-mode message-mode "Message[Notmuch]" +- "Notmuch message composition mode. Mostly like `message-mode'") ++ "Notmuch message composition mode. Mostly like `message-mode'" ++ (when notmuch-address-command ++ (notmuch-address-setup))) + + (define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit) + (define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send) +-- +2.5.3 + -- 2.26.2