jeremy-compostella / org-msg

OrgMsg is a GNU/Emacs global minor mode mixing up Org mode and Message mode to compose and reply to emails in a Outlook HTML friendly style.
GNU General Public License v3.0
275 stars 57 forks source link

Tab does not auto-complete emails in the To: field #166

Open DrWaleedAYousef opened 1 year ago

DrWaleedAYousef commented 1 year ago

I am using spacemacs + gnus layer + gnus + org mode layer + org-msg

Tab never autocomplete emails. I tried several configurations, including those suggested in the help page here on the repo.

Without org-msg Tab does autocomplete but after I open Org-Contacts.

david-alvarez-rosa commented 1 year ago

Plausible reason is that whatever your config is might be assuming message-mode-map when setting up the bindings. For org-msg you must use the equivalent org-msg-edit-mode-map.

DrWaleedAYousef commented 1 year ago

Sorry, could you elaborate? I checked, TAB is already bound to org-msg-tab

david-alvarez-rosa commented 1 year ago

In my particular case I use EDUC and have this binding working correctly (ref):

(bind-key "<M-tab>" 'eudc-expand-inline org-msg-edit-mode-map)
DrWaleedAYousef commented 1 year ago

For more clarification, that TAB works well when I am at the Gcc: field. When I press TAB helm pops up all the groups and I can select. The problem seems to be the org-contacts or something like that not the mode-map.

abougouffa commented 1 year ago

I have the same issue. Auto-completion of emails stopped working two or three weeks ago.

jonathanwilner commented 1 year ago

I use the great Minemacs curated by @abougouffa.

I took the advice of @david-alvarez-rosa above and set the keybinding. In my case, I chose to use notmuch-company.

(define-key org-msg-edit-mode-map [tab] #'notmuch-company)

abougouffa commented 1 year ago

@jonathanwilner I'm using org-msg with mu4e (I guess notmuch-company works with notmuch). Normally, mu4e supports auto-completion out of the box. However, when org-msg-edit-mode is activated, it doesn't work. In MinEmacs, it should be solved now (for mu4e).

@DrWaleedAYousef In my case, after some digging, it turned out that I was overwriting the completion-at-point-functions in modes derived from org-mode. I fixed it and it is working now. To test this, you can evaluate M-: completion-at-point-functions to see its value. If you don't see mu4e~compose-complete-contact in the list, it can be a similar problem. You can drop this in your config for a quick fix, however, it is recommended to search the real cause of the issue (in my case, I was altering completion-at-point-functions when running tempel-mode in modes derived from org-mode).

(add-hook 'org-msg-edit-mode-hook #'mu4e~compose-complete-contact)
DrWaleedAYousef commented 1 year ago

Sorry, I am confused. So what do you suggest for my configurations I mentioned upfront? Thanks.

abougouffa commented 1 year ago

Just drop (add-hook 'org-msg-edit-mode-hook #'mu4e~compose-complete-contact) in your configuration file. I don't know what are the conventions in Spacemacs to do such a thing.

DrWaleedAYousef commented 9 months ago

Just drop (add-hook 'org-msg-edit-mode-hook #'mu4e~compose-complete-contact) in your configuration file. I don't know what are the conventions in Spacemacs to do such a thing.

I am using gnus not mu4e. I tried everything, and did not work!

DrWaleedAYousef commented 9 months ago

@jeremy-compostella could you please help. I see you already use gnus as myself. Do you have any advice?

jeremy-compostella commented 3 months ago

@jeremy-compostella could you please help. I see you already use gnus as myself. Do you have any advice?

I also indeed use gnus and it works fine for me. TAB is bound org-msg-tab and when I am on a recipient field I can complete emails using this key. As you see in the org-msg-tab is a very small function which just call message-tab. I am wondering if it works for you when you disable org-msg, create a new message buffer, go to a recipient field and do a M-x message-tab. If it does not work that's probably what you need to fix and this is not related to org-msg.

cnoceda commented 1 week ago

Hi, I'm having the same trouble. I'm using notmuch. If I disable org-msg-mode works with no problem, but with org-msg-mode active sometimes only work the first time and then no more. It's very estrange because I read the function and it has nothing special. If I call M-x org-msg-tab it doesn't work.

is there a way to debug this kind of behaviour?

Edit org-msg-tab it's working good. The thing it's message-tab doesn't seem to work. Probably completion-at-point

With org-msg-mode disabled, both functions work well. It seems like when the org-msg-mode is enabled completion-at-point stops working.

Edit 2024-06-26 The problem is completion-at-point decide the completion function with this command: `(run-hook-wrapped 'completion-at-point-functions

'completion--capf-wrapper 'all)`

When org-msg-mode is enable it return nil. When is disable returns the correct function and the other params. The var completion-at-point-functions is a special hook to find the completion-function message-completion-function it's first function in the list, if you add org-contacts-message-complete-function to the hook, it works perfect. I try message-completion-function by it self and it seems to work correctly returning the completion function. I notice that the return format of both, org-contacts-message-complete-function and message-completion-function it's different. Could be the problem?