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