Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function set as the value of mu4e-sent-func is not called when sending a message #2707

Closed
benthamite opened this issue May 14, 2024 · 1 comment

Comments

@benthamite
Copy link

benthamite commented May 14, 2024

Expected or desired behavior

I have defined a function to be called when a message is sent, as follows:

(defun mu4e-extras-mark-sent-as-read (docid _draft-path)
  "Mark the sent message identified by DOCID as read.
When mu4e sends an email with Gmail, Gmail automatically saves a copy in the
\"Sent\" folder, so the local copy is deleted (as specified by
`mu4e-sent-messages-behavior'). However, the saved copy is treated as a new,
unread message when synchronized back to the local client. To handle this
annoyance, this function marks the saved copy as read. It should be set as the
value of `mu4e-sent-func'."
  (mu4e--server-move docid nil "+S-u-N"))

(setq mu4e-sent-func #'mu4e-extras-mark-sent-as-read)

My expectation is that this function will be called after sending a message.

Actual behavior

The function is not called after sending a message.

Steps to reproduce

  1. Evaluate the code above.
  2. M-x debug-on-entry RET mu4e-extras-mark-sent-as-read
  3. M-x compose-new RET.
  4. Compose a test message.
  5. M-x message-send-and-exit RET.
  6. Note that the debugger is not triggered.

Versions of mu, mu4e/emacs, operating system etc.

mu4e 1.12.4
GNU Emacs 29.3 (build 2, aarch64-apple-darwin23.2.0, NS appkit-2487.30 Version 14.2.1 (Build 23C71)) of 2024-04-26
macOS Sonoma 14.4.1

@djcb
Copy link
Owner

djcb commented May 17, 2024

Unfortunately, this is a bit of an unsupported use-case.

mu4e-sent-func is for mu4e's internal plumbing.. well, used to be; it's gone now. There are still a few remnants.
I'd recommend using message-sent-hook instead.

But note that mu4e--server-move is explicitly an internal function.

@djcb djcb closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants