ambevar-dotfiles/.config/next/init.lisp

55 lines
2.0 KiB
Common Lisp
Raw Normal View History

2018-12-02 20:32:28 +01:00
(in-package :next)
2018-12-10 12:53:58 +01:00
;; Use development platform port.
(setf *gtk-webkit-command*
(format nil "~a/common-lisp/next/ports/gtk-webkit/next-gtk-webkit"
(uiop:getenv "HOME")))
2018-12-02 20:32:28 +01:00
(define-key *global-map* (key "C-M-b") #'switch-buffer)
(define-key *global-map* (key "C-M-w") #'make-window)
(define-key *global-map* (key "C-M-d") #'delete-buffer)
(define-key *global-map* (key "C-;") #'execute-extended-command)
2018-12-10 12:54:47 +01:00
(define-key *global-map* (key "M-g") #'go-anchor-new-buffer)
(define-key *global-map* (key "C-M-C") #'kill)
2018-12-10 12:54:56 +01:00
(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)
2018-12-10 13:43:52 +01:00
(define-command youtube-dl-current-page ()
"Download a video in the currently open buffer."
(with-result (url (buffer-get-url))
(uiop:run-program
(list "emacsclient" "--eval"
(format nil
(if (search "youtu" url)
"(progn (youtube-dl \"~a\") (youtube-dl-list))"
"(ambrevar/youtube-dl-at-point \"~a\")")
url)))))
(define-key *global-map* (key "C-M-c d") 'youtube-dl-current-page)