mu4e: Fix failure to start org-msg-edit-mode when editing drafts#195
mu4e: Fix failure to start org-msg-edit-mode when editing drafts#195Ndot wants to merge 1 commit intojeremy-compostella:masterfrom
org-msg-edit-mode when editing drafts#195Conversation
| (remove-hook 'gnus-message-setup-hook 'org-msg-store-mml-buffers) | ||
| (advice-remove 'gnus-icalendar-send-buffer-by-mail 'org-msg-inhibited))) | ||
|
|
||
| (defvar org-msg--mu4e-message-draft-p nil) |
There was a problem hiding this comment.
could it be a buffer local variable ?
There was a problem hiding this comment.
I don't think so, but I checked just to be sure, and it can't be local.
The variable is set either on "mu4e:headers" or "mu4e:view" buffer before mu4e-compose-edit is called, and than we check the variable in org-msg-post-setup by this time we are in the "mu4e:compose" buffer. If we set this variable to local it will always return nil.
| "Returns `t' if the message being processed is a draft." | ||
| org-msg--mu4e-message-draft-p) | ||
|
|
||
| (defun org-msg-clear-message-draft-flag-mu4e () |
There was a problem hiding this comment.
Maybe a lambda function instead ?
There was a problem hiding this comment.
I not sure I understand.
Those two functions are called using org-msg-mua-call like this:
(org-msg-mua-call 'message-draft-p)
(org-msg-mua-call 'clear-message-draft-flag)Not sure how I can use a lambda function with org-msg-mua-call?
I originally had only one function to return the predicate and clear the flag, but for the sake of readability
and to keep matters separated I opted for two function, it makes the purpose of each function clearer.
| (unless (eq major-mode 'org-msg-edit-mode) | ||
| (message-goto-body) | ||
| (let* ((type (cond ((not (org-msg-message-fetch-field "subject")) 'new) | ||
| (let* ((type (cond ((org-msg-mua-call 'message-draft-p (lambda () nil)) 'new) |
There was a problem hiding this comment.
I don't think that you need to pass a default.
There was a problem hiding this comment.
You are correct I misread org-msg-mua-call I thought it would error but it just returns nil.
Updated the branch and removed the default argument.
Editing a draft message with a subject fails. In `org-msg-post-setup` when calling `(org-msg-mua-call 'article-htmlp)` it fails with "No message at point" from `mu4e-message-at-point`. To solve this we advice `mu4e-compose-edit` and set a flag that we can check in `org-msg-post-setup`. This check is setup using a MUA call, although this is only implemented for mu4e. If this is need for other backends they need to implement the predicate and clear draft flag functions.
ebe375f to
b8f509b
Compare
|
Please see if #203 is enough to solve the problem. |
[mu4e] Editing a draft message with a subject fails. In
org-msg-post-setupwhen calling(org-msg-mua-call 'article-htmlp)it fails with "No message at point" frommu4e-message-at-point.To solve this we advice
mu4e-compose-editand set a flag that we can check inorg-msg-post-setup. This check is setup using a MUA call, although this is only implemented for mu4e. If this is need for other backends they need to implement the predicate and clear draft flag functions.