Skip to content

Commit

Permalink
mu4e: don't strip references for fwd messages
Browse files Browse the repository at this point in the history
Don't remove the references header for forwarded message because there's
no "in-reply-to"
  • Loading branch information
djcb committed Mar 24, 2016
1 parent 1edeee4 commit 975d270
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mu4e/mu4e-compose.el
Expand Up @@ -350,7 +350,8 @@ message-thread by removing the In-Reply-To header."
(add-hook 'message-send-hook
(lambda () ;; mu4e~compose-save-before-sending
;; when in-reply-to was removed, remove references as well.
(mu4e~remove-refs-maybe)
(when (eq mu4e~compose-type 'reply)
(mu4e~remove-refs-maybe))
;; for safety, always save the draft before sending
(set-buffer-modified-p t)
(save-buffer)
Expand All @@ -368,6 +369,9 @@ message-thread by removing the In-Reply-To header."
(defconst mu4e~compose-buffer-max-name-length 30
"Maximum length of the mu4e-send-buffer-name.")

(defvar mu4e~compose-type nil
"Compose-type for this buffer.")

(defun mu4e~compose-set-friendly-buffer-name (&optional compose-type)
"Set some user-friendly buffer name based on the compose type."
(let* ((subj (message-field-value "subject"))
Expand Down Expand Up @@ -429,12 +433,17 @@ tempfile)."
(mu4e~compose-set-friendly-buffer-name compose-type)
(set-buffer-modified-p nil)
;; now jump to some useful positions, and start writing that mail!

(if (member compose-type '(new forward))
(message-goto-to)
(message-goto-body))
;; bind to `mu4e-compose-parent-message' of compose buffer
(set (make-local-variable 'mu4e-compose-parent-message) original-msg)
(put 'mu4e-compose-parent-message 'permanent-local t)
;; remember the compose-type
(set (make-local-variable 'mu4e~compose-type) compose-type)
(put 'mu4e~compose-type 'permanent-local t)

;; hide some headers
(mu4e~compose-hide-headers)
;; switch on the mode
Expand Down Expand Up @@ -508,6 +517,7 @@ buffer."
(let ((buf (find-file-noselect path)))
(when buf
(with-current-buffer buf
(message-narrow-to-headers-or-head)
(let ((in-reply-to (message-fetch-field "in-reply-to"))
(forwarded-from)
(references (message-fetch-field "references")))
Expand Down

0 comments on commit 975d270

Please sign in to comment.