Closed runekaagaard closed 3 years ago
I think it should go into notmuch-company
as that's where the restriction happens. The code you wrote seems fine for a contribution to that package. As it stands, org-msg and notmuch are working happily together on my system with #49 and there isn't an interference with notmuch address completion.
Guess you are right. I'm on outlook, not google so your solution at #49 does not apply to me.
I should say that my comment in the other thread is just for an address source, and there are other options for notmuch. Have you looked through notmuch-address.el? Perhaps you'll find useful avenues to explore there.
@runekaagaard This is really hacky but I use this to get past this issue:
(defun arvindsv/org-msg-notmuch-company (old-fn &rest args)
;; Cheat and say that this buffer, which should be org-msg-edit-mode, is derived from message-mode.
(cl-letf (((symbol-function 'derived-mode-p) (lambda (mode) (if (eq mode 'message-mode) t (derived-mode-p mode)))))
(apply old-fn args)))
(advice-add 'notmuch-company :around #'arvindsv/org-msg-notmuch-company)
@arvindsv Heh, Thats great, thx!!
@runekaagaard This is really hacky but I use this to get past this issue:
(defun arvindsv/org-msg-notmuch-company (old-fn &rest args) ;; Cheat and say that this buffer, which should be org-msg-edit-mode, is derived from message-mode. (cl-letf (((symbol-function 'derived-mode-p) (lambda (mode) (if (eq mode 'message-mode) t (derived-mode-p mode))))) (apply old-fn args))) (advice-add 'notmuch-company :around #'arvindsv/org-msg-notmuch-company)
With this, I'm getting Company: backend company-capf error "Lisp nesting exceeds ‘max-lisp-eval-depth’" with args (prefix)
Any ideas why that would be?
And perhaps a slightly less hacky version (which has the same issue as above) is to add org-msg-edit-mode to the derived-mode list.
(put 'org-msg-edit-mode 'derived-mode-parent 'message-mode)
But, having said that, it doesn't work :)
@Joshuao95, I suspect that you might have not set notmuch-company
as a backend for org-msg-edit-mode
, not the notmuch-message-mode
, which the the default one. After setting it properly, and with your suggested tweak, I achieved posed desirable behavior. Maybe it is worth to try.
@HyunggyuJang Perfect, thanks a lot, that solves it for me too
@Joshuao95 ;)
This is now patched in notmuch and it'll be in the next release, thanks @runekaagaard! This issue can be closed.
Beautiful!
Hi
Related to GH-49. If you patch notmuch-company.el v0.29.1 with this diff:
Then it's possible to autocomplete email addresses in the
To:
line when you have this in your init.el:I'm pretty bad at elisp, what would be the best way to implement this feature?
Best, Rune