* fix mu4e-sent-messages-behavior for 'delete when user hasn't saved draft
This commit is contained in:
@ -139,11 +139,11 @@ the current list of headers."
|
|||||||
(let* ((marker (gethash docid mu4e-msg-map))
|
(let* ((marker (gethash docid mu4e-msg-map))
|
||||||
(pos (and marker (marker-position marker)))
|
(pos (and marker (marker-position marker)))
|
||||||
(docid-at-pos (and pos (mu4e-hdrs-get-docid pos))))
|
(docid-at-pos (and pos (mu4e-hdrs-get-docid pos))))
|
||||||
(unless marker (error "Message %d not found" docid))
|
(when marker
|
||||||
(unless (eq docid docid-at-pos)
|
(unless (eq docid docid-at-pos)
|
||||||
(error "At point %d, expected docid %d, but got %S"
|
(error "At point %d, expected docid %d, but got %S"
|
||||||
pos docid docid-at-pos))
|
pos docid docid-at-pos))
|
||||||
(mu4e-hdrs-remove-header docid pos)))))
|
(mu4e-hdrs-remove-header docid pos))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|||||||
@ -304,9 +304,10 @@ use the new docid. Returns the full path to the new message."
|
|||||||
(lambda() (mu4e-proc-add (buffer-file-name) mu4e-drafts-folder)))
|
(lambda() (mu4e-proc-add (buffer-file-name) mu4e-drafts-folder)))
|
||||||
|
|
||||||
;; notify the backend that a message has been sent. The backend will respond
|
;; notify the backend that a message has been sent. The backend will respond
|
||||||
;; with (:sent ...) sexp, which is handled in .
|
;; with (:sent ...) sexp, which is handled in `mu4e-send-compose-handler'.
|
||||||
(add-hook 'message-sent-hook
|
(add-hook 'message-sent-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
(basic-save-buffer)
|
||||||
(mu4e-proc-sent (buffer-file-name) mu4e-drafts-folder)))
|
(mu4e-proc-sent (buffer-file-name) mu4e-drafts-folder)))
|
||||||
|
|
||||||
;; register the function; this function will be called when the '(:sent...)'
|
;; register the function; this function will be called when the '(:sent...)'
|
||||||
@ -379,9 +380,6 @@ using Gnus' `message-mode'."
|
|||||||
"Handler function, called with DOCID and PATH for the just-sent
|
"Handler function, called with DOCID and PATH for the just-sent
|
||||||
message."
|
message."
|
||||||
(with-current-buffer (find-file-noselect path)
|
(with-current-buffer (find-file-noselect path)
|
||||||
;; make sure this buffer is saved
|
|
||||||
(save-buffer)
|
|
||||||
(message "Mail sent")
|
|
||||||
;; for Forward ('Passed') and Replied messages, try to set the appropriate
|
;; for Forward ('Passed') and Replied messages, try to set the appropriate
|
||||||
;; flag at the message forwarded or replied-to
|
;; flag at the message forwarded or replied-to
|
||||||
(mu4e-send-set-parent-flag docid path)
|
(mu4e-send-set-parent-flag docid path)
|
||||||
@ -398,7 +396,7 @@ depending on the value of `mu4e-sent-messages-behavior'.
|
|||||||
|
|
||||||
Function assumes that it's executed in the context of the message
|
Function assumes that it's executed in the context of the message
|
||||||
buffer."
|
buffer."
|
||||||
;; first, what to do with the draft message in PATH?
|
;; first, what to do with the draft message in PATH?
|
||||||
(if (eq mu4e-sent-messages-behavior 'delete)
|
(if (eq mu4e-sent-messages-behavior 'delete)
|
||||||
(progn
|
(progn
|
||||||
(mu4e-proc-remove-msg docid)) ;; remove it
|
(mu4e-proc-remove-msg docid)) ;; remove it
|
||||||
@ -410,7 +408,7 @@ buffer."
|
|||||||
(if (search-forward-regexp (concat "^" mail-header-separator))
|
(if (search-forward-regexp (concat "^" mail-header-separator))
|
||||||
(replace-match "")
|
(replace-match "")
|
||||||
(error "cannot find mail-header-separator"))
|
(error "cannot find mail-header-separator"))
|
||||||
(save-buffer)
|
(basic-save-buffer)
|
||||||
(message nil)
|
(message nil)
|
||||||
;; ok, all seems well, well move the message to the sent-folder
|
;; ok, all seems well, well move the message to the sent-folder
|
||||||
(if (eq mu4e-sent-messages-behavior 'trash)
|
(if (eq mu4e-sent-messages-behavior 'trash)
|
||||||
@ -438,7 +436,7 @@ buffer.
|
|||||||
"
|
"
|
||||||
(let ((in-reply-to (message-fetch-field "in-reply-to"))
|
(let ((in-reply-to (message-fetch-field "in-reply-to"))
|
||||||
(forwarded-from)
|
(forwarded-from)
|
||||||
(references (message-fetch-field "references")))
|
(references (message-fetch-field "references")))
|
||||||
(unless in-reply-to
|
(unless in-reply-to
|
||||||
(when references
|
(when references
|
||||||
(with-temp-buffer ;; inspired by `message-shorten-references'.
|
(with-temp-buffer ;; inspired by `message-shorten-references'.
|
||||||
|
|||||||
Reference in New Issue
Block a user