Kill the correct buffer after sending a message
This commit is contained in:
@@ -326,24 +326,25 @@ This returns a hash table of cid -> path."
|
||||
ARG is passed directly to `message-send'."
|
||||
;; This has to return a non-nil value so that org knows we handled the C-c C-c
|
||||
(interactive "P")
|
||||
(let ((modified (buffer-modified-p))
|
||||
;; we only restore the restriction if the sending below fails
|
||||
(old-rest (cons (point-min) (point-max))))
|
||||
(widen)
|
||||
(let ((save-text (buffer-substring-no-properties (point-min)
|
||||
(point-max))))
|
||||
(condition-case _
|
||||
(progn
|
||||
(when org-mu4e--html-message-p
|
||||
(org-mu4e--htmlize-and-cleanup))
|
||||
(message-send arg)
|
||||
'sent)
|
||||
((or error quit)
|
||||
(erase-buffer)
|
||||
(insert save-text)
|
||||
(narrow-to-region (car old-rest) (cdr old-rest))
|
||||
(restore-buffer-modified-p modified)
|
||||
'failed)))))
|
||||
(save-current-buffer
|
||||
(let ((modified (buffer-modified-p))
|
||||
;; we only restore the restriction if the sending below fails
|
||||
(old-rest (cons (point-min) (point-max))))
|
||||
(widen)
|
||||
(let ((save-text (buffer-substring-no-properties (point-min)
|
||||
(point-max))))
|
||||
(condition-case _
|
||||
(progn
|
||||
(when org-mu4e--html-message-p
|
||||
(org-mu4e--htmlize-and-cleanup))
|
||||
(message-send arg)
|
||||
'sent)
|
||||
((or error quit)
|
||||
(erase-buffer)
|
||||
(insert save-text)
|
||||
(narrow-to-region (car old-rest) (cdr old-rest))
|
||||
(restore-buffer-modified-p modified)
|
||||
'failed))))))
|
||||
|
||||
(defun org-mu4e-send-and-exit (&optional arg)
|
||||
"Call `org-mu4e-send', the save and kill the buffer.
|
||||
|
||||
Reference in New Issue
Block a user