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

IMO Notmuch should not override the default completion mechanism by
default, at least not globally. But since users are already used to
this behavior it is probably too late to change it. Do the next best
thing and at least allow users to opt out.
---
 emacs/notmuch-address.el | 48 +++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el
index 3518beef..6e29b99a 100644
--- a/emacs/notmuch-address.el
+++ b/emacs/notmuch-address.el
@@ -52,21 +52,28 @@ (defun notmuch-address--harvest-ready ()
 (defcustom notmuch-address-command 'internal
   "Determines how address completion candidates are generated.
 
-If it is a string then that string should be an external program
-which must take a single argument (searched string) and output a
-list of completion candidates, one per line.
-
-Alternatively, it can be the symbol `internal', in which case
-internal completion is used; the variable
-`notmuch-address-internal-completion' can be used to customize
-this case.
-
-Finally, if this variable is nil then address completion is
-disabled."
+If this is a string, then that string should be an external
+program, which must take a single argument (searched string)
+and output a list of completion candidates, one per line.
+
+If this is the symbol `internal', then an implementation is used
+that relies on the \"notmuch address\" command, but does not use
+any third-party (i.e. \"external\") programs.
+
+If this is the symbol `as-is', then Notmuch does not modify the
+value of `message-completion-alist'. This option has to be set to
+this value before `notmuch' is loaded, otherwise the modification
+to `message-completion-alist' may already have taken place. This
+setting obviously does not prevent `message-completion-alist'
+from being modified at all; the user or some third-party package
+may still modify it.
+
+Finally, if this is nil, then address completion is disabled."
   :type '(radio
-	  (const :tag "Use internal address completion" internal)
-	  (const :tag "Disable address completion" nil)
-	  (string :tag "Use external completion command"))
+	  (const  :tag "Use internal address completion" internal)
+	  (string :tag "Use external completion command")
+	  (const  :tag "Disable address completion" nil)
+	  (const  :tag "Use default or third-party mechanism" as-is))
   :group 'notmuch-send
   :group 'notmuch-address
   :group 'notmuch-external)
@@ -156,12 +163,13 @@ (defcustom notmuch-address-use-company t
   :group 'notmuch-address)
 
 (defun notmuch-address-setup ()
-  (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))
+  (unless (eq notmuch-address-command 'as-is)
+    (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

  parent 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 ` [PATCH 1/3] emacs: notmuch-address-setup: cosmetics Jonas Bernoulli
2020-11-08 23:11 ` Jonas Bernoulli [this message]
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-3-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).