Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@volh
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volh/11bc5e8c0a31ceebf7d3 to your computer and use it in GitHub Desktop.
Save volh/11bc5e8c0a31ceebf7d3 to your computer and use it in GitHub Desktop.
Capture bookmarks from web browser right to your Org file with proper template
// Integration with Conkeror
// For Firefox, see https://addons.mozilla.org/ru/firefox/addon/org-mode-capture/
function org_capture (url, title, selection, window) {
// Note the 'w' as capture template
var cmd_str = 'emacsclient \"org-protocol://capture:/w/'+url+'/'+title+'/'+selection+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
interactive("org-capture", "Clip url, title, and selection to capture via org-protocol",
function (I) {
org_capture(encodeURIComponent(I.buffer.display_uri_string), encodeURIComponent(I.buffer.document.title), encodeURIComponent(I.buffer.top_frame.getSelection()), I.window);
});
(require 'org-protocol)
(setq org-capture-templates
(quote
(("w"
"Web Bookmark"
entry
(file+headline "~/notes/notes.org" "Bookmarks")
"* %c %u"
:empty-lines 1 :immediate-finish t)
)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment