Composing gmail messages in text editor complete with gmail links - emacs

I like to compose messages in Emacs then copy/paste into gmail for sending. I often want to include in the body of the message a link or links to other web sites. In gmail's compose dialog box I can click on the Insert Link button then enter the text to display and the URL for the link. I want to achieve the same effect in Emacs. I thought a standard <a href> link might work, like this:
Google
but gmail doesn't seem to interpret that as it would be here on SO, for example. Obviously, the string http://www.google.com is recognised as a link, but I would like to be able to specify the text.
I have found many posts on the use of mailto link but not on inserting URLs. Maybe I've missed something obvious, but is there any way to achieve this? Some kind of markup that works?

gmail-message-mode was designed for exactly this use case:
gmail-message-mode is an emacs major-mode for editing Gmail messages using markdown syntax, it is meant for use with browser plugins which allow you to edit text fields with external applications (in this case, emacs).
Install an appropriate editor plugin for your browser:
Plugins
Google-Chrome or Chromium - Edit with emacs
Conkeror - Spawn Helper (built-in)
Firefox - Used to work with It's all text. See this thread for a hacky workaround.
Others - Tried it in another browser? let me know!
There will also be some Emacs configuration, depending on the plugin you choose. For instance, to get Edit with Emacs working, I have edit-server installed, and make sure to enable it on startup with (edit-server-start).
Install gmail-message-mode from MELPA or MELPA stable.
ham-mode ("HTML as Markdown") takes care of the Markdown / HTML translation for gmail-message-mode, so you will also have to configure ham-mode's ham-mode-markdown-command to something appropriate.
I usually have Pandoc installed, and use something like this:
(setf ham-mode-markdown-command
'("/usr/bin/pandoc" "--from" "markdown" "--to" "html" "--standalone" file))
Open up a Gmail editing window and trigger the Emacs plugin. For Edit with Emacs, I right-click the message section and select "Edit with Emacs".
Switch to Emacs and edit your message in Markdown format. When you're done, C-x #.
A short test message might look like this:
Test **message** *using* [gmail-message-mode](https://github.com/Bruce-Connor/gmail-mode).
Which renders, correctly, like this in Gmail:
Test message using gmail-message-mode.
This might seem like a lot of work, but if you've alredy got a plugin configured to edit textareas in Emacs like I had, it's really not much of a change.

Use org-mime.
You can enter the links in org-mode format like this:
[[http://stackoverflow.com/questions/26046646/composing-gmail-messages-in-text-editor-complete-with-gmail-links][Composing gmail messages in text editor]]
Then use the org-mime function org-mime-htmlize to convert the message to HTML, including the links.

Related

Get browse-url-at-point to behave like browse-url in Emacs / Org Mode links

I'm trying to work out how to get org mode to open (as clickable links) URLs which link to another piece of software called ConnectedText. ConnectedText allows other applications to link to its files via URLs that look like the following: ct://Welcome/Welcome
If I invoke browse-url via M-x browse-url, and then paste one of these links, then the links open as they should do. But if I add them as clickable links in org mode they don't work (I get the 'no match- create this as a new heading?' dialogue).
According to the org-mode manual, clickable links are handled by the browse-url-at-point function. When I try to use browse-url-at-point to open one of these URLs (via M-x browse-url-at-point), it also doesn't work, and instead tries to open the link in my web browser.
So I'm trying to figure out how to get browse-url-at-point to behave in the same way as browse-url in relation to these URLs.
Browse-url, if invoked when the point is on one of these URLs, defaults to the URL (as per the documentation; "If point is located near a plausible URL, that URL is used as the default.") However, when it does this, it inserts http:// so the resulting URL looks like the following: http://ct://Welcome/Welcome. I assume this is the reason things aren't working.
Is there a way I can get browse-url-at-point to not insert this http:// prefix?
Or am I going about this the wrong way?
Thanks for any suggestions!
David
The Emacs developers provided me with a solution to this issue. If ct:// is added to thing-at-point, then browse-url-at-point works in the same way as M-x browse-url in the scenario described in the question. The following added to the init file does this:
(require 'thingatpt)
(push "ct://" thing-at-point-uri-schemes)

What is PHP text editor plugin like Stackoverflow's? (WYSWYG)

I want to set my textarea in my php project with texteditor like Stackoverflow's. So I can input Text Code in special format display. Is there any plugin like that in PHP?
Creating text with some markup syntax is usally done on the client-side and not server-side, which is why I would recommend you look for a javascript-wysiwyg-editor.
Check out this link for an overview.
Check out this Blog Post for info on how WMD Markdown Editor is used on Stack Exchange (as answered in this Meta question).

Customize wordpress media uploader button text

I've been working on a simple little plugin and needed an image loader. I wanted to use the default Wordpress one so it could access the library, that was all pretty simple. All I need is the ability to select an image, nothing else is wanted.
I've managed to remove the unwanted inputs using the attachment_fields_to_edit filter, and the unwanted gallery tab with the media_upload_tabs filter, but what I can't seem to be able to remove is the other stuff on the page, Specifically I'm talking about the "Use as featured image" link and the "Save all changes" button. I'd also really like to change the button text from "Insert into Post" to something more appropriate to what the plugin is actually doing.
I've googled and dug through the WP files but didn't see anything that would let me actually change that (while I'd prefer something gracefull I'd take a simple html filter before it sends the uploader output to the browser and use regular expressions to get the job done at this rate). Best I've been able to do is remove the "Inser into Post" line of options, which isn't very helpful as then there is no wat to actually select the image.
Has anybody done this before? I'm surprised theres not a simple hook that lets you change those (or that I couldn't find a hook if there is one).
Have a look at http://shibashake.com/wordpress-theme/how-to-hook-into-the-media-upload-popup-interface and section "4. Set Our Own Action". That seems to be exactly what you're after.

Preventing inline images from loading in emacs notmuch

I am using notmuch as my email client and using its default interface, the emacs mode. I'm trying to figure out how to prevent it from displaying images in email - since I'm using it for my professional email, the images are pretty much always unwelcome (I also am an enemy of those 1-pixel tracking tags that some anti-social services poke into HTML email).
I'm coming up empty on Google searches and consulting the notmuch mode documentation and M-x customize options. I assume, though, that there's some elisp value I can twiddle to make this work, and it's simply not obvious to me.
How can I tell notmuch to ignore images, or alternatively, to display only the text part of emails by default, ignoring MIME/HTML content?
Adding the following line to ~/.emacs seemed to do it for me:
(gnus-inhibit-images t)

Email Editor Similar to Campaign Monitor or Mailchimp's editor?

I looking for either an open source (or otherwise) php script/library/code that will provide me with a similar email composer that Mailchimp and Campaign Monitor have.
I've played around with lots of wysiwyg editors (eg: tinymce, ckeditor) but, they don't work very well for allowing users to compose emails.
Mosaico Editor is the first open source email template builder of this kind (AFAIK).
You can find a free to use deployment (working also as live demo) at http://mosaico.io and you can get sources at https://github.com/voidlabs/mosaico
I choose blocks from a set defined by the "master template", then you fill you contents and change their styles in a WYSIWYG style. If you're on a large window you can also have live preview for the mobile version.
The master template defines what are the blocks, what you can edit and what you can style and it contains any html trick to make it compatible with most clients: this means you can change the editor behaviour a lot by simply writing a new master template.
It is 99% javascript (IE10+, and any other modern browser) and depends on server-side functions only to do "final inlining" and "image upload/resizing"
Next generation tool for building templates without coding
Grapejs official site
GrapesJS is an open-source, multi-purpose, Web Builder Framework which combines different tools and features with the goal to help you (or users of your application) to build HTML templates without any knowledge of coding. It's a perfect solution to replace the common WYSIWYG editors, which are good for content editing but inappropriate for creating HTML structures. You can see it in action with the official demos, but using its API you're able to build your own editors.
I'm in the process of building one but as a designer it is a work in progress! I'd suggest looking at PHP template engines. They have a similar functionality. Most however will use php variables inside the html page instead of tags.
Another oprion is to check out Perch it is officially a CMS, but is really lightweight and might get the job done for you.
Hope that helps even though it is a year after you posted the question...
EDIT: Actually just stumbled across this thread which links to the new CKEditor - looks pretty cool.