From ec876cf254aed379b5758681e20f71d48dbbe001 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 24 Nov 2016 21:40:52 +0100 Subject: Add Emacs org-protocol integration --- conkeror/.conkerorrc/init.org | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'conkeror') diff --git a/conkeror/.conkerorrc/init.org b/conkeror/.conkerorrc/init.org index 40fb299..43ee390 100644 --- a/conkeror/.conkerorrc/init.org +++ b/conkeror/.conkerorrc/init.org @@ -98,3 +98,33 @@ Add the ~site-js/~ directory to the load path. define_key(default_global_keymap, 'p', 'scuttle-post'); define_key(default_global_keymap, 'P', 'scuttle-post-link'); #+END_SRC + +* Emacs integration + + Using org-protocol we can add information from the page. + + #+BEGIN_SRC js + function org_capture(url, title, selection, window) { + var cmd_str = 'emacsclient "org-protocol://capture://b/' + url + '/' + title + '/' + selection + '"'; + + if (window !== null) { + window.minibuffer.message('Issuing ' + cmd_str); + } + + shell_command_blind(cmd_str); + } + + function org_capture_command(I) { + var url = encodeURIComponent(I.buffer.display_uri_string); + var title = encodeURIComponent(I.buffer.document.title); + var selection = encodeURIComponent(I.buffer.top_frame.getSelection()); + + org_capture(url, title, selection, I.window); + } + + interactive("org-capture", + "Clip url, title and selection to capture via org-protocol", + org_capture_command); + + define_key(content_buffer_normal_keymap, "C-c b", "org-capture"); + #+END_SRC -- cgit v1.2.3-54-g00ecf