Last active
October 27, 2020 18:51
-
-
Save dschwilk/01f65013659ef5705b19 to your computer and use it in GitHub Desktop.
Javascript code snippets for mozzilla thunderbird org-mode links. Allows easy insertion of links to thunderbird email messages in org-mode for emacs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Call org-protocol capture from thunderbird and create link using thunderlink | |
============================================================================ | |
This works by setting up a custom button in Thunderbird calling org-protocol:// links | |
and then inserting thunderlink::// links in the org-mode document. | |
Thunderbird setup | |
----------------- | |
1. Install Custom Buttons add-on for Thunderbird | |
http://custombuttons.mozdev.org/ | |
2. Install thunderlink for thunderbird | |
https://addons.mozilla.org/en-us/thunderbird/addon/thunderlink/ | |
3. Setup org-protocol | |
http://orgmode.org/worg/org-contrib/org-protocol.php | |
4. Add this as a custom button: | |
- Use View->Add new button. Copy this file into Code tab and name the button "org capture" | |
- Use View->Toolbar->Customize. Find your new button and drag it onto the toolbar. | |
- Click it! | |
Additional info: | |
Thunderbird API Reference: | |
https://developer.mozilla.org/en/XPCOM_Interface_Reference | |
org-mode / emacs setup | |
---------------------- | |
use emacsclient | |
*/ | |
var messageUri = gFolderDisplay.selectedMessageUris[0]; | |
var emacsLink = ThunderLinkChromeNS.GetThunderlink(); | |
// message subject with "mail: " prefixed. | |
var msgHdr = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); | |
var topicName = "mail: " + msgHdr.mime2DecodedSubject; | |
// open URL | |
var url = 'org-protocol://capture?template=w&url=' + encodeURIComponent(emacsLink) +'&title=' + encodeURIComponent(topicName) + '/' | |
messenger.launchExternalURL (url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Create thunderlink link in org-mode and call org-protocol://store-link | |
====================================================================== | |
This works by setting up a custom button in Thunderbird calling org-protocol:// links | |
and then inserting thunderbird:// links in the org-mode document. | |
Thunderbird setup | |
----------------- | |
1. Install Custom Buttons add-on for Thunderbird | |
http://custombuttons.mozdev.org/ | |
2. Install thunderlink for thunderbird | |
https://addons.mozilla.org/en-us/thunderbird/addon/thunderlink/ | |
3. Setup org-protocol | |
http://orgmode.org/worg/org-contrib/org-protocol.php | |
4. Add this as a custom button: | |
- Use View->Add new button. Copy this file into Code tab and name the button "org link" | |
- Use View->Toolbar->Customize. Find your new button and drag it onto the toolbar. | |
- Click it! | |
Additional info: | |
Thunderbird API Reference: | |
https://developer.mozilla.org/en/XPCOM_Interface_Reference | |
org-mode / emacs setup | |
---------------------- | |
*/ | |
var messageUri = gFolderDisplay.selectedMessageUris[0]; | |
var emacsLink = ThunderLinkChromeNS.GetThunderlink() | |
// message subject with "mail: " prefixed. | |
var msgHdr = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri); | |
var topicName = "mail: " + msgHdr.mime2DecodedSubject; | |
// open URL | |
window.url = 'org-protocol://store-link?url=' + encodeURIComponent(emacsLink) +'&title=' + encodeURIComponent(topicName); | |
messenger.launchExternalURL(window.url); | |
There is a fixed version of the custom buttons extension that works on Thunderbird 47.7+ available here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Javascript code to create keyboard actions and buttons for org-mode links to thunderbird emails
Allows easy insertion of links to thunderbird email messages in org-mode for emacs.
Some javascript to allow a way to quickly make links to thunderbird email messages and either store that link for org-mode or call org-capture.
Sets up a custom button in Thunderbird which calls org-protocol:// links and then inserting thunderlink::// links in the org-mode document.
Thunderbird setup
http://custombuttons.mozdev.org/
As of Thunderbird 51, this add on does not work. You can create a custom button manually, but it is a pain: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Toolbars/Custom_toolbar_button
https://addons.mozilla.org/en-us/thunderbird/addon/thunderlink/
http://orgmode.org/worg/org-contrib/org-protocol.php
Additional info:
Thunderbird API Reference:
https://developer.mozilla.org/en/XPCOM_Interface_Reference
org-mode / emacs setup
use emacsclient