@@ -1481,35 +1481,47 @@ HTML emails."
1481
1481
nil )))
1482
1482
" Additional expressions to highlight in OrgMsg mode." )
1483
1483
1484
+ (defun org-msg--mu4e-fun (name )
1485
+ " Attempt to find the existing mu4e function suffixed with NAME."
1486
+ (let ((funs (mapcar (lambda (prefix ) (intern (concat prefix name)))
1487
+ '(" mu4e~" " mu4e-" " mu4e--" ))))
1488
+ (car (cl-member-if #'fboundp funs))))
1489
+
1490
+ (defun org-msg--mu4e-fun-call (name )
1491
+ " Call the mu4e function suffixed with NAME if any."
1492
+ (when-let ((fun (org-msg--mu4e-fun name)))
1493
+ (funcall fun)))
1494
+
1484
1495
(defun org-msg-edit-mode-mu4e ()
1485
1496
" Setup mu4e faces, addresses completion and run mu4e."
1486
- (mu4e~ compose-remap-faces)
1497
+ (org-msg-- mu4e-fun-call " compose-remap-faces" )
1487
1498
(unless (mu4e-running-p)
1488
- (if ( fboundp # ' mu4e~start ) (mu4e~start) (mu4e-- start) ))
1499
+ (org-msg-- mu4e-fun-call " start" ))
1489
1500
(when mu4e-compose-complete-addresses
1490
- (mu4e~ compose-setup-completion))
1501
+ (org-msg-- mu4e-fun-call " compose-setup-completion" ))
1491
1502
; ; the following code is verbatim from mu4e-compose.el, `mu4e-compose-mode'
1492
1503
; ; this will setup fcc (saving sent messages) and handle flags
1493
1504
; ; (e.g. replied to)
1494
1505
(add-hook 'message-send-hook
1495
- (if ( functionp # ' mu4e~ setup-fcc-message-sent-hook-fn )
1496
- # 'mu4e~setup-fcc-message-sent-hook-fn
1506
+ (if-let ((fun (org-msg-- mu4e-fun " setup-fcc-message-sent-hook-fn" )) )
1507
+ fun
1497
1508
(lambda ()
1498
1509
; ; when in-reply-to was removed, remove references as well.
1499
1510
(when (eq mu4e-compose-type 'reply )
1500
1511
(mu4e~remove-refs-maybe))
1501
1512
(when use-hard-newlines
1502
- (mu4e-send-harden-newlines))
1513
+ (org-msg-- mu4e-fun-call " send-harden-newlines" ))
1503
1514
; ; for safety, always save the draft before sending
1504
1515
(set-buffer-modified-p t )
1505
1516
(save-buffer )
1506
- (mu4e~ compose-setup-fcc-maybe)
1517
+ (org-msg-- mu4e-fun-call " compose-setup-fcc-maybe" )
1507
1518
(widen )))
1508
1519
nil t )
1509
1520
; ; when the message has been sent.
1510
1521
(add-hook 'message-sent-hook
1511
- (if (functionp #'mu4e~set-sent-handler-message-sent-hook-fn )
1512
- #'mu4e~set-sent-handler-message-sent-hook-fn
1522
+ (if-let ((fun (org-msg--mu4e-fun
1523
+ " set-sent-handler-message-sent-hook-fn" )))
1524
+ fun
1513
1525
(lambda ()
1514
1526
(setq mu4e-sent-func 'mu4e-sent-handler )
1515
1527
(mu4e~proc-sent (buffer-file-name ))))
0 commit comments