Next: Add org-capture

master
Pierre Neidhardt 2018-12-10 12:54:56 +01:00
parent 8cb6fd5317
commit 968c266373
1 changed files with 29 additions and 0 deletions

View File

@ -11,3 +11,32 @@
(define-key *global-map* (key "C-;") #'execute-extended-command)
(define-key *global-map* (key "M-g") #'go-anchor-new-buffer)
(define-key *global-map* (key "C-M-C") #'kill)
(define-command org-capture ()
"Org-capture current page."
(buffer-evaluate-javascript
*interface* (active-buffer *interface*)
(ps:ps (+ (ps:chain window location href)
" "
(ps:chain document title)))
(lambda (url-and-title)
(let* ((separation (position #\Space url-and-title))
(title-position (or (and separation (1+ separation)) (length url-and-title)))
(url (subseq url-and-title 0 (or separation (length url-and-title))))
(title (subseq url-and-title title-position)))
(uiop:launch-program (list
"emacsclient"
"--eval"
(format nil "
(progn
(org-link-set-parameters
\"next\"
:store (lambda ()
(org-store-link-props
:type \"next\"
:link \"~a\"
:description \"~a\")))
(org-capture))"
url title)))))))
(define-key *global-map* (key "C-M-o") #'org-capture)