From b3bd6392061366d1188771fcb5227597667043d5 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 17 Jun 2015 10:36:20 +0200 Subject: [PATCH] Add org-capture template for Conkeror --- conkeror/.conkerorrc/init.js | 28 ++++++++++++++++++++++++++++ emacs/.emacs.d/site-lisp/org-init.el | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/conkeror/.conkerorrc/init.js b/conkeror/.conkerorrc/init.js index bb6a578..6e4acc6 100644 --- a/conkeror/.conkerorrc/init.js +++ b/conkeror/.conkerorrc/init.js @@ -99,6 +99,34 @@ interactive("org-store-link", + "kill ring", oni_org_store_link); +function org_capture(url, title, body, window, template) { + template = template || ''; + var cmd_str = 'emacsclient "org-protocol://capture:/'+template+'/'+url+'/'+title+'/'+body+'"'; + + 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); + }); +interactive("org-capture-taiga", "Capture a Taiga task via org-protocol", + function(I) { + var title = I.buffer.document.getElementsByClassName('view-subject')[0].childNodes[0].nodeValue, + body = I.buffer.document.getElementsByClassName('markItUpEditor')[0].value; + org_capture(encodeURIComponent(I.buffer.display_uri_string), + encodeURIComponent(title), + encodeURIComponent(body), + I.window, + 'w'); + }); + interactive("find-url-from-history", "Find a page from history in the current buffer", "find-url", diff --git a/emacs/.emacs.d/site-lisp/org-init.el b/emacs/.emacs.d/site-lisp/org-init.el index ba48997..e35af30 100644 --- a/emacs/.emacs.d/site-lisp/org-init.el +++ b/emacs/.emacs.d/site-lisp/org-init.el @@ -153,8 +153,8 @@ predecessor if there is a non-DONE sibling defined before it." ("d" "10 things to do today" entry (file+datetree "~/documents/org/dailies.org") "* %<%R> [0/10]\n\n - [ ] %?\n - [ ] \n - [ ] \n - [ ] \n - [ ] \n - [ ] \n - [ ] \n - [ ] \n - [ ] \n - [ ] " :empty-lines-before 1) - ("w" "Taiga task" entry (file+headline "~/documents/org/tasks" "Inbox") - (function taiga-org-task-template) + ("w" "Org protocol task" entry (file+headline "~/documents/org/tasks" "Inbox") + "* TODO %^{Title|%:description}\n\n Source: %u, %c\n\n %i" :empty-lines-before 1))) (setq org-contacts-files '("~/documents/org/misc/contacts.org")) (setq org-agenda-show-outline-path nil)