Comments (10)
If you have something ready and stable, please submit a pull request.
from org-msg.
Hi Mark,
I use notmuch to handle email in emacs. I get a "Backend not found" message when I try to run activate org-msg-mode in a message buffer.
This is expected: OrgMsg support is limited to gnus
and mu4e
at the moment. I personally only use gnus
so helping with other Mail User Agent is difficult but I do my best.
Have you tried enabling notmuch?
I don't use notmuch
. If you want to help write the support for notmuch I can help you with it. The backend mechanism in OrgMsg is very simple.
291 (defcustom org-msg-supported-mua '((message-user-agent . "gnus")
292 (mu4e-user-agent . "mu4e"))
293 "Supported Mail User Agents."
294 :type '(alist :value-type string))
295
296 (defun org-msg-mua-call (sym &rest arg)
297 "Call the specific MUA function for SYM with ARG parameters."
298 (let ((mua (assoc-default mail-user-agent org-msg-supported-mua)))
299 (if mua
300 (let ((fun (intern (format "org-msg-%s-%s" sym mua))))
301 (when (functionp fun)
302 (apply fun arg)))
303 (error "Backend not found"))))
You can add the start enabling notmuch support with:
5 modified org-msg.el
6 @@ -289,7 +289,8 @@ Example:
7 :type '(symbol))
8
9 (defcustom org-msg-supported-mua '((message-user-agent . "gnus")
10 - (mu4e-user-agent . "mu4e"))
11 + (mu4e-user-agent . "mu4e")
12 + (notmuch-user-agent . "notmuch"))
13 "Supported Mail User Agents."
14 :type '(alist :value-type string))
15
The org-msg-mua-call
function is called by OrgMsg when an action specific to the Mail User Agent is necessary. For instance, org-msg-mode
calls org-msg-mua-call 'mode
which depending on the mail-user-agent
variable is going to call either org-msg-mode-gnus
or org-msg-mode-mu4e
. As you can these function only set up the right hook. If the function for a particular user agent is not defined it is skipped.
937 (define-minor-mode org-msg-mode
938 "Toggle OrgMsg mode.
939 With a prefix argument ARG, enable Delete Selection mode if ARG
940 is positive, and disable it otherwise. If called from Lisp,
941 enable the mode if ARG is omitted or nil.
942
943 When OrgMsg mode is enabled, the Message mode behavior is
944 modified to make use of Org Mode for mail composition and build
945 HTML emails."
946 :global t
947 (org-msg-mua-call 'mode)
948 (if org-msg-mode
949 (progn
950 [...]
925 (defun org-msg-mode-gnus ()
926 "Setup the hook for gnus mail user agent."
927 (if org-msg-mode
928 (add-hook 'gnus-message-setup-hook 'org-msg-post-setup)
929 (remove-hook 'gnus-message-setup-hook 'org-msg-post-setup)))
930
931 (defun org-msg-mode-mu4e ()
932 "Setup the hook for mu4e mail user agent."
933 (if org-msg-mode
934 (add-hook 'mu4e-compose-mode-hook 'org-msg-post-setup)
935 (remove-hook 'mu4e-compose-mode-hook 'org-msg-post-setup)))
Looking at notmuch
source code, I feel like the following function could be a good start.
(defun org-msg-mode-notmuch ()
"Setup the hook for notmuch mail user agent."
(if org-msg-mode
(add-hook 'notmuch-mua-reply 'org-msg-post-setup)
(remove-hook 'notmuch-mua-reply 'org-msg-post-setup)))
But you'll have to make it work. If you make progress let me know. I am willing to merge patches to support other Mail User Agent.
Thanks!
Regards,
-- Jeremy
One Emacs to rule them all
from org-msg.
Hi Mark,
Did you get a chance to experiment ? Made any progress ?
Regards,
-- Jeremy
One Emacs to rule them all
from org-msg.
from org-msg.
Hi @janesma,
I hacked this up, it kind of works for me but I'm not sure if it breaks any other behavior:
diff --git a/org-msg.el b/org-msg.el
index 05b5168..bf3597f 100644
--- a/org-msg.el
+++ b/org-msg.el
@@ -291,6 +291,7 @@ Example:
(defcustom org-msg-supported-mua '((gnus-user-agent . "gnus")
(message-user-agent . "gnus")
+ (notmuch-user-agent . "notmuch")
(mu4e-user-agent . "mu4e"))
"Supported Mail User Agents."
:type '(alist :value-type string))
@@ -947,6 +948,19 @@ d Delete one attachment, you will be prompted for a file name."))
(add-hook 'mu4e-compose-mode-hook 'org-msg-post-setup)
(remove-hook 'mu4e-compose-mode-hook 'org-msg-post-setup)))
+(defun org-msg-mode-notmuch ()
+ "Setup the hook for notmuch mail user agent."
+ (if org-msg-mode
+ (progn
+ (advice-add 'notmuch-mua-mail :after 'org-msg-post-setup)
+ ;; notmuch seems to be running message-send-hook twice, it breaks
+ ;; the mime wrapping
+ (remove-hook 'notmuch-mua-send-hook 'notmuch-mua-message-send-hook)
+ ;; `notmuch-mua-send-and-exit` sets up fcc
+ (advice-add 'org-msg-ctrl-c-ctrl-c :override 'notmuch-mua-send-and-exit))
+ (advice-remove 'notmuch-mua-mail 'org-msg-post-setup)
+ (advice-remove 'org-msg-ctrl-c-ctrl-c 'notmuch-mua-send-and-exit)))
+
(define-minor-mode org-msg-mode
"Toggle OrgMsg mode.
With a prefix argument ARG, enable Delete Selection mode if ARG
It doesn't work for reply buffers, have that in mind.
from org-msg.
I guess 'notmuch-mua-message-send-hook
should be added in the false branch, to recover old notmuch behavior.
from org-msg.
@ALPHA-60 this is really great, thanks for figuring it out!
from org-msg.
from org-msg.
Good call @ALPHA-60 on the use of advice
, and thanks everyone for a great starting point. I have some steps in the right direction, not polished but figured out the replies issue.
User agent
Need to add the notmuch-user-agent
in org-msg-supported-mua
as others have said
(defcustom org-msg-supported-mua '((gnus-user-agent . "gnus")
(message-user-agent . "gnus")
(mu4e-user-agent . "mu4e")
(notmuch-user-agent . "notmuch"))
"Supported Mail User Agents."
:type '(alist :value-type string))
org-msg-mode-notmuch
I don't have the same issue @ALPHA-60 had with the send action here. This was sufficient:
(defun org-msg-mode-notmuch ()
"Setup the hook for notmuch mail user agent."
(if org-msg-mode
(advice-add 'notmuch-mua-mail :after 'org-msg-post-setup)
(advice-remove 'notmuch-mua-mail 'org-msg-post-setup)))
org-msg-article-htmlp-notmuch
This was the missing link for replies. In org-msg-post-setup
there is the line:
(when (or new (org-msg-mua-call 'article-htmlp))
The last expression there evaluates to the function call (org-msg-article-htmlp-notmuch)
. It didn't exist, and so the when
was only true when the compose was new
. We need to make that function, which figures out if the mail buffer is html mode.
Well, notmuch doesn't seem to try html replies ever. So this is always false. And therefore org-msg will never be used for replies. Since that's not what we want, we can lie to org-msg and add this function:
(defun org-msg-article-htmlp-notmuch ()
"Return t if the current notmuch reply is an HTML article."
;; Technically never but we want to reply with org-msg so t
t)
Remaining problems
The org-msg-separator
is not inserted above the replied message, so the locked part in OrgMsg mode doesn't work. This has other implications, including where links are placed edit: for the plain text version if using multipart-alternative (can be below quoted message) and treating the message you are replying to as Org content.
I believe this is happening because of the connection method to notmuch-mua-mail
---when it finishes, the quoted other message is not yet present. It is put into the buffer after org-msg-post-setup
runs. The solution here could be:
- Advice to a different function that I didn't see
- A more complicated handling of a new message or a reply for notmuch (there are
notmuch-mua-reply
andnotmuch-mua-new-reply
, haven't played with those yet) - Modify the insertion of the org template to have
org-msg-separator
at the bottom even when there isn't text there (yet) - A different solution I'm not thinking about
There are some avenues to explore at any rate.
I also don't get the buffer cleaned up consistently, perhaps that needs polish or perhaps it has to do with my (new, likely imperfect) email setup.
from org-msg.
Addendum: I tried
(advice-add 'notmuch-mua-reply :after 'org-msg-post-setup)
and it worked fine with respect to inserting org-msg-separator
. Is there supposed to be no quoted text in the final email? I suppose that's the case, for the user to copy in and quote as they like. Anyway:
A functioning solution
Same as my last post, except change org-msg-mode-notmuch
to be
(defun org-msg-mode-notmuch ()
"Setup the hook for notmuch mail user agent."
(if org-msg-mode
(progn
(advice-add 'notmuch-mua-reply :after 'org-msg-post-setup)
(advice-add 'notmuch-mua-mail :after 'org-msg-post-setup--if-not-reply))
(progn
(advice-remove 'notmuch-mua-reply 'org-msg-post-setup)
(advice-remove 'notmuch-mua-mail 'org-msg-post-setup--if-not-reply))))
and add this function
(defun org-msg-post-setup--if-not-reply (&rest _args)
(unless (org-msg-message-fetch-field "subject")
(org-msg-post-setup _args)))
There is likely a more elegant solution to this :)
from org-msg.
Related Issues (20)
- Odd Issue with Forwarded Messages, Empty Message at Top
- Tab does not auto-complete emails in the To: field HOT 15
- Wrong cursor position after reply — missing call to `goto-body` HOT 1
- Unwanted *ORG ASCII Export* buffer HOT 5
- Forwarding email with inline image or LaTeX formula fails (reverts to text), but replying works (keeps html) HOT 1
- Customise reply/forward citation lines (currently sometimes shows several authors in From: and duplicate authors in Cc:)
- Temporary reply-to filepaths are not persisted HOT 1
- Proper way to inject css
- Documentation for org-msg-options HOT 1
- `mu` v1.11.23 breaks `org-msg` HOT 3
- inline images in parent message have the wrong content-disposition (attached) when replying HOT 1
- [Feature Request] Addressee tagging generating a mailto link in the message body HOT 2
- How to disable org-msg for org-submit-bug-report?
- `mu 1.12.0` breaks `org-msg` HOT 34
- compose error with mu4e HOT 3
- adding courier font command HOT 4
- when I edit a draft and send -- the email isn't converted to html
- [Feature]: Preview includes the original message when forwarding
- Cannot get proselint to load as checker HOT 1
- org-msg-edit-mode-mu4e: Symbol’s function definition is void: mu4e~compose-remap-faces
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from org-msg.