From 22c70eaaa66630b4fb923150ee5c207eb6e45c7f Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Mon, 21 Oct 2024 04:56:01 -0700 Subject: [PATCH] Make reply work with org-mu4e-mode --- elisp/org-mu4e-compose.el | 26 ++++++++++++++++++++++++++ init.el | 6 ++++++ 2 files changed, 32 insertions(+) diff --git a/elisp/org-mu4e-compose.el b/elisp/org-mu4e-compose.el index 1725dec..bbf544f 100644 --- a/elisp/org-mu4e-compose.el +++ b/elisp/org-mu4e-compose.el @@ -219,6 +219,32 @@ passed to it." (cl-letf (((symbol-function 'mu4e-compose-mode) 'org-mu4e-compose-mode)) (apply 'mu4e-compose-new r)))) +;;;###autoload +(defun org-mu4e-compose-reply-to (&optional to wide) + "This is like `mu4e-compose-reply-to', but utilizes `org-mu4e-compose-mode'. +TO and WIDE are the same as `mu4e-compose-reply-to'." + (interactive) + ;; Save local variables set by `mu4e-compose-reply-to' + (let ((html-part-p (seq-find (lambda (handle) + (equal (mm-handle-media-type (cdr handle)) + "text/html")) + gnus-article-mime-handle-alist)) + (org-mu4e--internal-message-mode-function + (symbol-function 'mu4e-compose-mode))) + (cl-letf (((symbol-function 'mu4e-compose-mode) 'org-mu4e-compose-mode)) + (let ((buf (mu4e-compose-reply-to to wide))) + (with-current-buffer buf + (setq org-mu4e--html-message-p + ;; make the variable look nicer by not having random data in it + (not (not html-part-p)))))))) + +;;;###autoload +(defun org-mu4e-compose-reply (&optional wide) + "This is like `mu4e-compose-reply', but utilizes `org-mu4e-compose-mode'. +WIDE is the same as `mu4e-compose-reply'." + (interactive "P") + (org-mu4e-compose-reply-to nil wide)) + ;;;###autoload (defvar-keymap org-mu4e-compose-mode-map :parent org-mode-map diff --git a/init.el b/init.el index 04bde9a..c63ac48 100644 --- a/init.el +++ b/init.el @@ -2127,6 +2127,12 @@ The name is compared with the field name using TESTFN (defaults to `equal')." "ZD" #'message-dont-send "ZQ" #'message-kill-buffer "ZF" #'mml-attach-file) +(evil-define-key 'normal mu4e-view-mode-map + "R" 'org-mu4e-compose-reply + "cr" 'org-mu4e-compose-reply) +(evil-define-key 'normal mu4e-headers-mode-map + "R" 'org-mu4e-compose-reply + "cr" 'org-mu4e-compose-reply) (defun my/-setup-org-mu4e-compose-mode () "Setup up stuff in `org-mu4e-compose' buffers." (setq-local ltex-eglot-variable-save-method 'file)