X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-company.el;h=91c4804f4a086c95a1f755e10b43eaf4fd421929;hp=add3161b790d6a490c7994ad0c1aad2632d803e8;hb=343534d82dc8882b3f0e2a847ee9d10ba5392809;hpb=4acbc1f7d36060ff1678e576495f8122f4d4cbb3 diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index add3161b..91c4804f 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -1,4 +1,4 @@ -;; notmuch-company.el --- Mail address completion for notmuch via company-mode -*- lexical-binding: t -*- +;;; notmuch-company.el --- Mail address completion for notmuch via company-mode -*- lexical-binding: t -*- ;; Authors: Trevor Jim ;; Michal Sojka @@ -16,7 +16,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with this program. If not, see . ;;; Commentary: @@ -47,7 +47,13 @@ (defun notmuch-company-setup () (company-mode) (make-local-variable 'company-backends) - (setq company-backends '(notmuch-company))) + (setq company-backends '(notmuch-company)) + ;; Disable automatic company completion unless an internal + ;; completion method is configured. Company completion (using + ;; internal completion) can still be accessed via standard company + ;; functions, e.g., company-complete. + (unless (eq notmuch-address-command 'internal) + (setq-local company-idle-delay nil))) ;;;###autoload (defun notmuch-company (command &optional arg &rest _ignore) @@ -72,7 +78,7 @@ (lambda (callback) ;; First run quick asynchronous harvest based on what the user entered so far (notmuch-address-harvest - (format "to:%s*" arg) nil + arg nil (lambda (_proc _event) (funcall callback (notmuch-address-matching arg)) ;; Then start the (potentially long-running) full asynchronous harvest if necessary @@ -80,7 +86,10 @@ (match (if (string-match notmuch-company-last-prefix arg) (match-end 0) 0)) + (post-completion (run-hook-with-args 'notmuch-address-completion-hook arg)) (no-cache t)))) (provide 'notmuch-company) + +;;; notmuch-company.el ends here