#449 ✓bluesky
Mike K

Feature request: use external text editor

Reported by Mike K | September 23rd, 2013 @ 08:08 PM


Comments and changes to this ticket

  • benny

    benny September 24th, 2013 @ 08:45 AM

    • State changed from “new” to “bluesky”
    • Tag changed from editing, formatting to rich text, editing, formatting, html

    Thanks for your detailed feedback on this issue. I am sure you are not alone with respect to having issues with the Markdown-only approach to rich text. My general thoughts about rich text in emails are still pretty well covered in my 2011 blog post. The main difference since then is that inline images are now supported.

    Ideally, what you want (I believe) is an HTML editor in MailMate. It sounds like an easy solution to support an external HTML editor, but it's probably easier than it sounds. The work needed to be done is not really the editor itself (it's a standard OS X component). It is quite likely that it would be easier for me to simply add an HTML editor as an alternative within MailMate. For new messages it might not even be that hard while for replies/forwards (of HTML messages) it could be very tricky (this also often does not work well in other email clients). That said, my own motivation for an HTML editor would be as a fallback for replies/forwards which are not always gracefully handled by MailMate, because of the need to convert to plain text (Markdown). In many cases, it could be handled better by an HTML editor.

    In theory (and quite often in practice), HTML for emails is a broken feature in any email client. In practice, unfortunately, it works well enough to be widely supported. I try to be pragmatic, but it is very difficult to enthusiastically implement something that will never work well in general.

    For you, it might be sufficient with a WYSIWYG editor for Markdown (although colored text would not be supported), but that does not solve the problems related to replying/forwarding HTML messages. The advantage of a WYSIWYG editor for Markdown is that it would still allow me to generate a proper plain text body part alternative.

    Comments are welcome from anyone. I'm open for suggestions and/or the pressure of public demand :-) I'm not religiously against offering an alternative to plain text, but I'm also not currently motivated to put it very high on the list (pushing other items further down). To put it in perspective, we are in the territory of someone buying a $10K license key to change my mind ;-)

    I'll put this ticket in the “bluesky” state which basically means to not expect this to change soon.

  • benny

    benny January 31st, 2014 @ 09:46 AM

    @Januz/Evans: It's something I would consider and it's certainly a much simpler request than HTML support. In theory, all it would require is that MailMate can be told to save the message text to a temporary file, open an external editor, and then watch the file for changes (triggered when it's saved by the external editor). It could even happen automatically when tab'ing into the text field of the composer. But no time frame on this though :-)

  • benny

    benny February 1st, 2014 @ 09:38 PM

    Hold down ⌥ when clicking “Check Now” in the Software Update preferences pane (r3984). Implemented today. Very little testing done. Here is what I wrote in the release notes:

    First shot at supporting external editors. This is how it works:

    • A bundle command can be created with the special key/value pair saveForEditing = 1;.
    • saveForEditing makes MailMate save the current content of the text view of the composer to a file before running the command.
    • The command is given the filepath and it can then launch the editor.
    • MailMate watches the file and updates the text view in the composer when the file changes.

    Some additional notes:

    • An example bundle is included which works for TextMate.
    • The file extension .eml.txt is used to allow the editor to identify it as an email text file (to allow specific settings for this without affecting all .txt files).
    • The example bundle has two commands (⌃⇧O and ⌃⌥⇧O). The difference is that only one of them activates MailMate after closing the document in TextMate. I've included both since this trick might not work for all text editors.

    Experimentally, the following preference can be used to make MailMate auto-open the text editor when using the keyboard to enter the text view in the composer (either by replying or by tab'ing into the text view):

    defaults write com.freron.MailMate MmBundleCommandLaunchedOnTab -string "0CE35D01-7B5D-4112-B379-E7BFC10AC55A"

    The string is the UUID of the bundle command.

    I should add that to make your own bundle for your preferred text editor then you should do something like this:

    1. Copy the TextMate bundle:

      mkdir -p ~/Library/Application\ Support/MailMate/Bundles
      cp /Applications/MailMate.app/Contents/SharedSupport/Bundles/TextMate.mmBundle ~/Library/Application\ Support/MailMate/Bundles/
    2. Rename anything in the bundle to match the name of your text editor.

    3. Replace all UUIDs with new values (use uuidgen in the Terminal).

    4. Look into what is needed to make your text editor open the given file.

    5. Test.

    6. If it works, share. If it doesn't work, ask.

    This might also be a way to allow HTML editing at some point, but I still consider that a bluesky feature and I'll keep the ticket status.

  • benny

    benny February 7th, 2014 @ 08:17 PM

    @Evans: The output goes back to MailMate. In some cases MailMate uses the output to perform certain actions (also undocumented). For example, moving/tagging messages or creating drafts.

    You can debug by redirecting output to a file and then maybe watch that file using tail -f.

    You can also get additional debug output like this:

    defaults write com.freron.MailMate MmDebugCommands -bool YES

    Then launch MailMate from the Terminal:

  • benny

    benny February 8th, 2014 @ 10:58 AM

    A dedicated bundle for MailMate would probably work better (I haven't looked into vim-anywhere). I'm sure someone is going to make that for MacVim eventually ;-)

  • benny

    benny February 13th, 2014 @ 08:23 PM

    Did you change the UUID in the info.plist file as well?

    Do you see the bundle/command in the Command menu?

  • benny

    benny February 13th, 2014 @ 08:30 PM

    Ah, the UUIDs should not be the same. Each item in a bundle must have its own UUID.

  • benny

    benny February 13th, 2014 @ 08:36 PM

    I hope that means it works now :-)

    Any particular reason you call sh instead of `bash? It's a bit paranoid, but I think it's safer to know which shell type is going to execute the script (not important in this one-line script, but if someone else bases their bundle on your bundle)...

  • benny

    benny February 13th, 2014 @ 09:09 PM

    Now you made me read up on it ;-) Although sh can point to any implementation of a shell then it must be a POSIX shell which means it's fine if you write your script POSIX style. On OS X sh appears to simply be bash --posix. So, it's probably a little bit safer with sh, but I'm used to bash :-)

    I assume you'll share your bundle. Maybe even allow me to include it with MailMate (until a better distribution method is available) :-)

  • benny

    benny February 13th, 2014 @ 09:12 PM

    I forgot the ellipsis question. Ellipsis is used when the user is expected to provide more information in a window/panel. This is open for interpretation in this case. Apparently I opted for not adding ellipsis. Apple writes about it here.

  • benny

    benny February 13th, 2014 @ 09:37 PM

    I would like all of these text editor bundles to use the same shortcut. I'm thinking ⌃⇧O. Currently, there is no easy way to disable bundles, but when there is then usually a user would only enable one of these bundles. Until then you can use whatever shortcut you like (but I'll change it or ask you to change it when bundles can be disabled). Just note that it can be tricky to avoid overlapping standard text editor shortcuts :-)

  • benny

    benny February 17th, 2014 @ 12:20 PM

    @Evans: I've included the bundle in the latest test release. Thanks for the contribution! I noticed your script for enabling MacVim as the automatically launched editor, but I'm still a bit unsure how it can/should be generalized to work for all editor bundles. Maybe as a command in a meta-bundle which looks through all bundles for candidates and then shows a popup for selecting an editor :-)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Mac OS X email client.

Shared Ticket Bins

People watching this ticket


Referenced by