mirror of https://github.com/djcb/mu.git
mu4e (ical): Run message deletion after mu4e-sent-handler
This commit is contained in:
parent
a6efefb622
commit
5ca3254ef9
|
@ -1,4 +1,4 @@
|
||||||
;;; mu4e-icalendar.el --- reply to iCalendar meeting requests (part of mu4e)
|
;;; mu4e-icalendar.el --- reply to iCalendar meeting requests (part of mu4e) -*- lexical-binding: t; -*-
|
||||||
;;
|
;;
|
||||||
;; Copyright (C) 2019- Christophe Troestler
|
;; Copyright (C) 2019- Christophe Troestler
|
||||||
|
|
||||||
|
@ -100,15 +100,23 @@
|
||||||
"Function passed to `mu4e-compose-cite-function' to remove the citation."
|
"Function passed to `mu4e-compose-cite-function' to remove the citation."
|
||||||
(delete-region (point-min) (point-max)))
|
(delete-region (point-min) (point-max)))
|
||||||
|
|
||||||
(defun mu4e~icalendar-trash-message (msg)
|
(defun mu4e~icalendar-trash-message (original-msg)
|
||||||
"Trash the message MSG."
|
"Trash the message ORIGINAL-MSG and move to the next one."
|
||||||
(with-current-buffer mu4e~headers-buffer-name
|
(lambda (docid path)
|
||||||
(let* ((docid (mu4e-message-field msg :docid))
|
"See `mu4e-sent-handler' for DOCID and PATH."
|
||||||
|
(mu4e-sent-handler docid path)
|
||||||
|
(let* ((docid (mu4e-message-field original-msg :docid))
|
||||||
(markdescr (assq 'trash mu4e-marks))
|
(markdescr (assq 'trash mu4e-marks))
|
||||||
(action (plist-get (cdr markdescr) :action))
|
(action (plist-get (cdr markdescr) :action))
|
||||||
(target (mu4e-get-trash-folder msg)))
|
(target (mu4e-get-trash-folder original-msg)))
|
||||||
(run-hook-with-args 'mu4e-mark-execute-pre-hook 'trash msg)
|
(with-current-buffer (mu4e-get-headers-buffer)
|
||||||
(funcall action docid msg target))))
|
(run-hook-with-args 'mu4e-mark-execute-pre-hook 'trash original-msg)
|
||||||
|
(funcall action docid original-msg target))
|
||||||
|
(when (and (mu4e~headers-view-this-message-p docid)
|
||||||
|
(buffer-live-p (mu4e-get-view-buffer)))
|
||||||
|
(switch-to-buffer (mu4e-get-view-buffer))
|
||||||
|
(or (mu4e-view-headers-next)
|
||||||
|
(kill-buffer-and-window))))))
|
||||||
|
|
||||||
(defun mu4e-icalendar-reply-ical (original-msg event status buffer-name)
|
(defun mu4e-icalendar-reply-ical (original-msg event status buffer-name)
|
||||||
"Reply to ORIGINAL-MSG containing invitation EVENT with STATUS.
|
"Reply to ORIGINAL-MSG containing invitation EVENT with STATUS.
|
||||||
|
@ -140,19 +148,13 @@ response in icalendar format."
|
||||||
": " (gnus-icalendar-event:summary event))
|
": " (gnus-icalendar-event:summary event))
|
||||||
(set-buffer-modified-p nil); not yet modified by user
|
(set-buffer-modified-p nil); not yet modified by user
|
||||||
(when mu4e-icalendar-trash-after-reply
|
(when mu4e-icalendar-trash-after-reply
|
||||||
;; `mu4e~switch-back-to-mu4e-buffer' was executed.
|
;; Override `mu4e-sent-handler' set by `mu4e-compose-mode' to
|
||||||
(push
|
;; also trash the message (thus must be appended to hooks).
|
||||||
(lexical-let ((msg original-msg))
|
(add-hook
|
||||||
#'(lambda ()
|
'message-sent-hook
|
||||||
(when (and (not (eq mu4e-split-view 'single-window))
|
#'(lambda () (setq mu4e-sent-func
|
||||||
(buffer-live-p (mu4e-get-view-buffer)))
|
(mu4e~icalendar-trash-message original-msg)))
|
||||||
(switch-to-buffer (mu4e-get-view-buffer))
|
t t))))
|
||||||
(or (mu4e-view-headers-next)
|
|
||||||
(kill-buffer-and-window))
|
|
||||||
(mu4e~icalendar-trash-message msg))))
|
|
||||||
message-send-actions))
|
|
||||||
; (message-send-and-exit)
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~icalendar-insert-diary (event reply-status filename)
|
(defun mu4e~icalendar-insert-diary (event reply-status filename)
|
||||||
|
|
Loading…
Reference in New Issue