Next: Update config for 2.0 (keymap).

master
Pierre Neidhardt 2020-03-31 10:13:04 +02:00
parent 862b5228de
commit 9fd561a442
1 changed files with 13 additions and 11 deletions

View File

@ -18,7 +18,7 @@
(ignore-errors (uiop:run-program
(list "emacsclient" "--eval" s-exps-string)))))
(defvar *my-keymap* (make-keymap)
(defvar *my-keymap* (keymap:make-keymap "my-map")
"Keymap for `my-mode'.")
(define-command org-capture (&optional (buffer (current-buffer)))
@ -32,7 +32,7 @@
:link ,(url buffer)
:description ,(title buffer))))
`(org-capture)))
(define-key :keymap *my-keymap* "C-M-o" #'org-capture)
(define-key *my-keymap* "C-M-o" #'org-capture)
(define-command youtube-dl-current-page (&optional (buffer (current-buffer)))
"Download a video in the currently open buffer."
@ -40,17 +40,18 @@
(if (search "youtu" (url buffer))
`(progn (youtube-dl ,(url buffer)) (youtube-dl-list))
`(ambrevar/youtube-dl-url ,(url buffer)))))
(define-key :keymap *my-keymap* "C-M-c d" 'youtube-dl-current-page)
(define-key *my-keymap* "C-M-c d" #'youtube-dl-current-page)
(define-command play-video-in-current-page (&optional (buffer (current-buffer)))
"Play video in the currently open buffer."
(uiop:run-program (list "mpv" (url buffer))))
(define-key :keymap *my-keymap* "C-M-c v" #'play-video-in-current-page)
(define-key *my-keymap* "C-M-c v" #'play-video-in-current-page)
(define-mode my-mode ()
"Dummy mode for the custom key bindings in `*my-keymap*'."
((keymap-schemes :initform (list :emacs-map *my-keymap*
:vi-normal *my-keymap*))))
((keymap-schemes :initform (keymap:make-scheme
scheme:emacs *my-keymap*
scheme:vi-normal *my-keymap*))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar +youtube-dl-command+ "youtube-dl"
@ -114,20 +115,21 @@ Videos are downloaded with `+youtube-dl-command+'."
my-blocker-mode
proxy-mode)
(get-default 'buffer 'default-modes)))
(load-hook :initform (next-hooks:make-hook-string->string
(load-hook :initform (hooks:make-hook-string->string
:handlers (list #'old-reddit-handler
#'auto-proxy-handler)
:combination #'next-hooks:combine-composed-hook))))
#'auto-proxy-handler
)
:combination #'hooks:combine-composed-hook))))
(defclass my-buffer (buffer)
((default-modes :initform (append
'(my-mode vi-normal-mode
my-blocker-mode
proxy-mode)
(get-default 'buffer 'default-modes)))
(load-hook :initform (next-hooks:make-hook-string->string
(load-hook :initform (hooks:make-hook-string->string
:handlers (list #'old-reddit-handler
#'auto-proxy-handler)
:combination #'next-hooks:combine-composed-hook)))))
:combination #'hooks:combine-composed-hook)))))
(setf *buffer-class* 'my-buffer)