1

I'm experimenting with mutt (actually neomutt) and would like to take advantage of org-mode features while composing mail.

I have mutt configured so that I compose my messages in emacs. I'd like to open these messages in org-mode. Is this possible?

Mutt seems to open a tmp file /tmp/neomutt-whoami-xxxxxxxxxxxx. Maybe there is a way to write a hook so that files of the form /tmp/neomutt-whoami* are always opened in org-mode?

2 Answers 2

1

For your specific case:

(add-to-list
 'auto-mode-alist '("\\`/tmp/neomutt-whoami" . org-mode))

The initial \\` in front of /tmp/... is necessary to avoid matching paths such as /foobar/tmp/neomutt-whoami-xxxx.

Briefly, auto-mode-alist is a list of the form:

((REGEXP1 . MODEFUNCTION1)
 (REGEXP2 . MODEFUNCTION2)
 ...
)

where the REGEXPs are to match the full file name and path (imagined to begin with a ` and end with a ') and the MODEFUNCTIONs are functions to be executed if a match is found. Emacs's inbuilt help (C-h v RET auto-mode-alist RETdescribe-variable auto-mode-alist) will give you a more extensive description (and find its current value).

Even more details can be found with M-x elisp-index-search RET auto-mode-alist and M-x emacs-index-search RET auto-mode-alist (searching the Emacs info manuals).

0

How are you going to send the messages? Org-mode does not have any facilities for that. You probably want to compose them in message-mode but have some org-mode facilities available (e.g. tables). If that is the case, look into orgtbl-mode, a minor mode that allows you to manipulate org-tables in other modes, and orgstruct-mode or orgstruct++-mode (see their doc strings for information) - although I'm under the impression that the latter two are deprecated and are going to disappear (but I'm not at all sure about that: I just remember a conversation on the mailing list, but my memory is not what it used to be. I'll fix this answer if my memory is indeed playing tricks on me).

1
  • Presumably sending is handled by mutt , upon closing of the external editor (emacs or emacsclient in this case). OTOH, using message-mode for better handling of quotes and the like, is still a good idea.
    – aplaice
    Commented Jan 28, 2018 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.