unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/3] emacs: notmuch-address-setup: cosmetics
Date: Mon,  9 Nov 2020 00:11:48 +0100	[thread overview]
Message-ID: <20201108231150.5419-2-jonas@bernoul.li> (raw)
In-Reply-To: <20201108231150.5419-1-jonas@bernoul.li>

---
 emacs/notmuch-address.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 8a6d299c..3518beef 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -21,6 +21,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl-lib))
+
 (require 'message)
 (require 'notmuch-parser)
 (require 'notmuch-lib)
@@ -154,15 +156,12 @@ (defcustom notmuch-address-use-company t
   :group 'notmuch-address)
 
 (defun notmuch-address-setup ()
-  (let* ((setup-company (and notmuch-address-use-company
-			     (require 'company nil t)))
-	 (pair (cons notmuch-address-completion-headers-regexp
-		     #'notmuch-address-expand-name)))
-    (when setup-company
-      (notmuch-company-setup))
-    (unless (member pair message-completion-alist)
-      (setq message-completion-alist
-	    (push pair message-completion-alist)))))
+  (when (and notmuch-address-use-company
+	     (require 'company nil t))
+    (notmuch-company-setup))
+  (cl-pushnew (cons notmuch-address-completion-headers-regexp
+		    #'notmuch-address-expand-name)
+	      message-completion-alist :test #'equal))
 
 (defun notmuch-address-toggle-internal-completion ()
   "Toggle use of internal completion for current buffer.
-- 
2.29.1

  reply	other threads:[~2020-11-08 23:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08 23:11 [PATCH 0/3] emacs: allow opting out of notmuch's address completion Jonas Bernoulli
2020-11-08 23:11 ` Jonas Bernoulli [this message]
2020-11-08 23:11 ` [PATCH 2/3] " Jonas Bernoulli
2020-11-08 23:11 ` [PATCH 3/3] emacs: notmuch-address-expand-name: use the actual initial-input Jonas Bernoulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201108231150.5419-2-jonas@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).