* mu4e: fix some weirdness with editing drafts
This commit is contained in:
@ -340,7 +340,6 @@ tempfile)."
|
|||||||
|
|
||||||
;; this opens (or re-opens) a messages with all the basic headers set.
|
;; this opens (or re-opens) a messages with all the basic headers set.
|
||||||
(mu4e-draft-open compose-type original-msg)
|
(mu4e-draft-open compose-type original-msg)
|
||||||
|
|
||||||
;; insert mail-header-separator, which is needed by message mode to separate
|
;; insert mail-header-separator, which is needed by message mode to separate
|
||||||
;; headers and body. will be removed before saving to disk
|
;; headers and body. will be removed before saving to disk
|
||||||
(mu4e~draft-insert-mail-header-separator)
|
(mu4e~draft-insert-mail-header-separator)
|
||||||
@ -356,9 +355,6 @@ tempfile)."
|
|||||||
;; existing message.
|
;; existing message.
|
||||||
(unless (eq compose-type 'edit)
|
(unless (eq compose-type 'edit)
|
||||||
(message-insert-signature))
|
(message-insert-signature))
|
||||||
;; hide some headers
|
|
||||||
(let ((message-hidden-headers mu4e~compose-hidden-headers))
|
|
||||||
(message-hide-headers))
|
|
||||||
;; buffer is not user-modified yet
|
;; buffer is not user-modified yet
|
||||||
(mu4e~compose-set-friendly-buffer-name compose-type)
|
(mu4e~compose-set-friendly-buffer-name compose-type)
|
||||||
(set-buffer-modified-p nil)
|
(set-buffer-modified-p nil)
|
||||||
@ -369,6 +365,10 @@ tempfile)."
|
|||||||
;; bind to `mu4e-compose-parent-message' of compose buffer
|
;; bind to `mu4e-compose-parent-message' of compose buffer
|
||||||
(set (make-local-variable 'mu4e-compose-parent-message) original-msg)
|
(set (make-local-variable 'mu4e-compose-parent-message) original-msg)
|
||||||
(put 'mu4e-compose-parent-message 'permanent-local t)
|
(put 'mu4e-compose-parent-message 'permanent-local t)
|
||||||
|
|
||||||
|
;; hide some headers
|
||||||
|
(let ((message-hidden-headers mu4e~compose-hidden-headers))
|
||||||
|
(message-hide-headers))
|
||||||
;; switch on the mode
|
;; switch on the mode
|
||||||
(mu4e-compose-mode))
|
(mu4e-compose-mode))
|
||||||
|
|
||||||
|
|||||||
@ -213,25 +213,30 @@ separator is never written to the message file. Also see
|
|||||||
'read-only "Can't touch this"
|
'read-only "Can't touch this"
|
||||||
'rear-nonsticky t
|
'rear-nonsticky t
|
||||||
'font-lock-face 'mu4e-system-face)))
|
'font-lock-face 'mu4e-system-face)))
|
||||||
|
(widen)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
;; search for the first empty line
|
;; search for the first empty line
|
||||||
|
(unless (search-forward sepa nil t)
|
||||||
|
(goto-char (point-min))
|
||||||
(if (search-forward-regexp "^$" nil t)
|
(if (search-forward-regexp "^$" nil t)
|
||||||
(replace-match (concat sepa))
|
(replace-match (concat sepa))
|
||||||
(progn ;; no empty line? then prepend one
|
(progn ;; no empty line? then prepend one
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(insert "\n" sepa))))))
|
(insert "\n" sepa)))))))
|
||||||
|
|
||||||
(defun mu4e~draft-remove-mail-header-separator ()
|
(defun mu4e~draft-remove-mail-header-separator ()
|
||||||
"Remove `mail-header-separator; we do this before saving a
|
"Remove `mail-header-separator; we do this before saving a
|
||||||
file (and restore it afterwards), to ensure that the separator
|
file (and restore it afterwards), to ensure that the separator
|
||||||
never hits the disk. Also see `mu4e~draft-insert-mail-header-separator."
|
never hits the disk. Also see `mu4e~draft-insert-mail-header-separator."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
(widen)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
;; remove the --text follows this line-- separator
|
;; remove the --text follows this line-- separator
|
||||||
(when (search-forward-regexp (concat "^" mail-header-separator))
|
(when (search-forward-regexp (concat "^" mail-header-separator))
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(replace-match "")))))
|
(replace-match "")))))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~draft-user-wants-reply-all (origmsg)
|
(defun mu4e~draft-user-wants-reply-all (origmsg)
|
||||||
"Ask user whether she wants to reply to *all* recipients.
|
"Ask user whether she wants to reply to *all* recipients.
|
||||||
If there is just one recipient of ORIGMSG do nothing."
|
If there is just one recipient of ORIGMSG do nothing."
|
||||||
@ -354,7 +359,7 @@ from either `mu4e~draft-reply-construct', or
|
|||||||
(unless mu4e-maildir (mu4e-error "mu4e-maildir not set"))
|
(unless mu4e-maildir (mu4e-error "mu4e-maildir not set"))
|
||||||
(if (eq compose-type 'edit)
|
(if (eq compose-type 'edit)
|
||||||
;; case-1: re-editing a draft messages. in this case, we do know the full
|
;; case-1: re-editing a draft messages. in this case, we do know the full
|
||||||
;; path, but we cannot really now 'drafts folder'
|
;; path, but we cannot really know 'drafts folder'
|
||||||
(find-file (mu4e-message-field msg :path))
|
(find-file (mu4e-message-field msg :path))
|
||||||
;; case-2: creating a new message; in this case, we can determing
|
;; case-2: creating a new message; in this case, we can determing
|
||||||
;; mu4e-get-drafts-folder
|
;; mu4e-get-drafts-folder
|
||||||
|
|||||||
Reference in New Issue
Block a user