Merge branch 'master' of gitlab.com:chriscochrun/dotemacs

This commit is contained in:
Chris Cochrun 2021-03-10 14:08:40 -06:00
commit 784f8413d2
2 changed files with 236 additions and 66 deletions

View file

@ -273,30 +273,32 @@ This evil-collection package includes a lot of other evil based things.
:keymaps '(normal visual emacs)
:prefix "SPC")
(chris/leader-keys
"b" '(:ignore t :which-key "buffer")
"t" '(:ignore t :which-key "toggle")
"f" '(:ignore t :which-key "file")
"w" '(:ignore t :which-key "window")
"s" '(:ignore t :which-key "search")
"o" '(:ignore t :which-key "open")
"h" '(:ignore t :which-key "help")
"n" '(:ignore t :which-key "notes")
"bs" '(consult-buffer :which-key "buffer search")
"bd" '(kill-this-buffer :which-key "kill buffer")
"bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file")
"fb" '((find-file ~/org/bibles/) :which-key "find bible book")
"fr" '(consult-recent-file :which-key "recent file")
"fs" '(save-buffer :which-key "save")
"hf" '(helpful-callable :which-key "describe-function")
"hv" '(helpful-variable :which-key "describe-variable")
"hk" '(helpful-key :which-key "describe-key")
"hi" '(info :which-key "info manual")
"ss" '(consult-line :which-key "consult search")
"ww" '(other-window :which-key "other window")
"wd" '(delete-window :which-key "other window")
)
:states 'normal
:keymaps 'override
"b" '(:ignore t :which-key "buffer")
"t" '(:ignore t :which-key "toggle")
"f" '(:ignore t :which-key "file")
"w" '(:ignore t :which-key "window")
"s" '(:ignore t :which-key "search")
"o" '(:ignore t :which-key "open")
"h" '(:ignore t :which-key "help")
"n" '(:ignore t :which-key "notes")
"bs" '(consult-buffer :which-key "buffer search")
"bd" '(kill-this-buffer :which-key "kill buffer")
"bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file")
"fb" '((find-file ~/org/bibles/) :which-key "find bible book")
"fr" '(consult-recent-file :which-key "recent file")
"fs" '(save-buffer :which-key "save")
"hf" '(helpful-callable :which-key "describe-function")
"hv" '(helpful-variable :which-key "describe-variable")
"hk" '(helpful-key :which-key "describe-key")
"hi" '(info :which-key "info manual")
"ss" '(consult-line :which-key "consult search")
"ww" '(other-window :which-key "other window")
"wd" '(delete-window :which-key "other window")
)
(general-def 'minibuffer-local-map
"C-v" 'evil-paste-after))
#+end_src
@ -464,6 +466,8 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc
(setq consult-narrow-key "<")
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"si" 'consult-imenu
"so" 'consult-outline))
#+end_src
@ -539,6 +543,8 @@ I do a lot of docker management so having yaml is necessary
:straight nil
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"od" '(dired-jump :which-key "open dired here"))
(general-def 'normal dired-mode-map
"q" 'kill-this-buffer))
@ -719,6 +725,8 @@ Part of this config includes some special capture templates for my work as a you
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"o a" 'org-agenda
"c" 'org-capture)
('normal org-agenda-mode-map
@ -831,6 +839,8 @@ We also need to setup some capture templates to use some specific setups with my
:head "#+TITLE: %<%Y-%m-%d> - Biblical\n#+AUTHOR: Chris Cochrun")))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"nf" '(org-roam-find-file :which-key "org roam ff")
"nr" 'org-roam))
@ -1154,6 +1164,8 @@ If on a:
(mu4e t)
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"om" 'mu4e))
(use-package org-mime
@ -1189,6 +1201,8 @@ Let's add org-msg to write emails in org-mode
)))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"oc" 'chris/calfw-calendar-open)
(general-def cfw:calendar-mode-map
"q" 'kill-this-buffer
@ -1217,7 +1231,10 @@ Use magit, because why wouldn't you? duh!
(use-package magit
:commands (magit-status magit-get-current-branch)
:general
(chris/leader-keys "g g" 'magit-status)
(chris/leader-keys
:states 'normal
:keymaps 'override
"g g" 'magit-status)
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
#+end_src
@ -1307,6 +1324,8 @@ Let's add our own eshell prompt. and set the password cache to a significantly h
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"oe" 'eshell)
(general-def '(normal insert) eshell-mode-map
"C-d" 'kill-this-buffer))
@ -1338,32 +1357,95 @@ Let's use pdf-tools for a lot better interaction with pdfs.
'(("\\*e?shell\\*"
(display-buffer-in-side-window)
(window-width . 0.4)
(side . right))))
(side . right))
("*Bongo-Elfeed Queue*"
(display-buffer-in-side-window)
(window-height . 0.25)
(side . bottom))))
#+end_src
** Elfeed
#+begin_src emacs-lisp
(use-package elfeed
:commands (elfeed)
:config
(defvar chris/elfeed-bongo-playlist "*Bongo-Elfeed Queue*"
"Name of the Elfeed+Bongo multimedia playlist.")
(defun chris/elfeed-bongo-insert-item ()
"Insert `elfeed' multimedia links in `bongo' playlist buffer.
The playlist buffer has a unique name so that it will never
interfere with the default `bongo-playlist-buffer'."
(interactive)
(let* ((entry (elfeed-search-selected :ignore-region))
(link (elfeed-entry-link entry))
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0))
(url (if (string-prefix-p "https://thumbnails" enclosure)
link
enclosure))
(title (elfeed-entry-title entry))
(bongo-pl chris/elfeed-bongo-playlist)
(buffer (get-buffer-create bongo-pl)))
(message "link is %s" link)
(message "enclosure is %s" enclosure)
(message "url is %s" url)
(message "title is %s" title)
(elfeed-search-untag-all-unread)
(unless (bongo-playlist-buffer)
(bongo-playlist-buffer))
(display-buffer buffer)
(with-current-buffer buffer
(when (not (bongo-playlist-buffer-p))
(bongo-playlist-mode)
(setq-local bongo-library-buffer (get-buffer "*elfeed-search*"))
(setq-local bongo-enabled-backends '(mpv))
(bongo-progressive-playback-mode))
(goto-char (point-max))
(bongo-insert-uri url (format "%s ==> %s" title url))
(let ((inhibit-read-only t))
(delete-duplicate-lines (point-min) (point-max)))
(bongo-recenter))
(message "Enqueued %s “%s” in %s"
(if enclosure "podcast" "video")
(propertize title 'face 'italic)
(propertize bongo-pl 'face 'bold))))
(defun chris/elfeed-bongo-switch-to-playlist ()
(interactive)
(let* ((bongo-pl chris/elfeed-bongo-playlist)
(buffer (get-buffer bongo-pl)))
(if buffer
(switch-to-buffer buffer)
(message "No `bongo' playlist is associated with `elfeed'."))))
:general
(chris/leader-keys
"of" 'elfeed))
:states 'normal
:keymaps 'override
"of" 'elfeed)
(general-def 'normal elfeed-search-mode-map
"v" 'chris/elfeed-bongo-insert-item
"h" 'chris/elfeed-bongo-switch-to-playlist))
#+end_src
#+begin_src emacs-lisp
(use-package elfeed-org
:after elfeed
:config
(setq rmh-elfeed-org-files (list "~/org/elfeed.org")))
(setq rmh-elfeed-org-files (list "~/org/elfeed.org"))
(elfeed-org)
(elfeed-update))
#+end_src
** Bongo
#+begin_src emacs-lisp
(use-package bongo
:commands (bongo)
:commands (bongo bongo-playlist-buffer)
:config
(define-bongo-backend mpv
;; :constructor 'bongo-start-mpv-player
:program-name 'mpv
:constructor 'bongo-start-mpv-player
:extra-program-arguments '("--input-ipc-server=/tmp/mpvsocket")
@ -1377,7 +1459,7 @@ Let's use pdf-tools for a lot better interaction with pdfs.
:matcher '(("http:" "https:" "lbry:") . t))
(setq bongo-enabled-backends '(mpv)
bongo-track-mark-icon-file-name "sun-solid.png")
bongo-track-mark-icon-file-name "track-mark-icon.png")
(defun chris/bongo-mark-line-forward ()
(interactive)
@ -1391,10 +1473,12 @@ Let's use pdf-tools for a lot better interaction with pdfs.
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"ob" 'bongo)
(general-def 'normal bongo-playlist-mode-map
"RET" 'bongo-dwim
"d" 'bongo-kill
"RET" 'bongo-play
"d" 'bongo-kill-line
"u" 'bongo-unmark-region
"p" 'bongo-pause/resume
"H" 'bongo-switch-buffers
@ -1406,6 +1490,7 @@ Let's use pdf-tools for a lot better interaction with pdfs.
We set the =gc-cons-threshold= variable to really high, now lets set it back low to make sure emacs performs properly.
#+begin_src emacs-lisp
(setq gc-cons-threshold 2000000)
(setq garbage-collection-messages nil)
#+end_src
* Early Init

151
init.el
View file

@ -164,30 +164,32 @@
:keymaps '(normal visual emacs)
:prefix "SPC")
(chris/leader-keys
"b" '(:ignore t :which-key "buffer")
"t" '(:ignore t :which-key "toggle")
"f" '(:ignore t :which-key "file")
"w" '(:ignore t :which-key "window")
"s" '(:ignore t :which-key "search")
"o" '(:ignore t :which-key "open")
"h" '(:ignore t :which-key "help")
"n" '(:ignore t :which-key "notes")
"bs" '(consult-buffer :which-key "buffer search")
"bd" '(kill-this-buffer :which-key "kill buffer")
"bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file")
"fb" '((find-file ~/org/bibles/) :which-key "find bible book")
"fr" '(consult-recent-file :which-key "recent file")
"fs" '(save-buffer :which-key "save")
"hf" '(helpful-callable :which-key "describe-function")
"hv" '(helpful-variable :which-key "describe-variable")
"hk" '(helpful-key :which-key "describe-key")
"hi" '(info :which-key "info manual")
"ss" '(consult-line :which-key "consult search")
"ww" '(other-window :which-key "other window")
"wd" '(delete-window :which-key "other window")
)
:states 'normal
:keymaps 'override
"b" '(:ignore t :which-key "buffer")
"t" '(:ignore t :which-key "toggle")
"f" '(:ignore t :which-key "file")
"w" '(:ignore t :which-key "window")
"s" '(:ignore t :which-key "search")
"o" '(:ignore t :which-key "open")
"h" '(:ignore t :which-key "help")
"n" '(:ignore t :which-key "notes")
"bs" '(consult-buffer :which-key "buffer search")
"bd" '(kill-this-buffer :which-key "kill buffer")
"bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file")
"fb" '((find-file ~/org/bibles/) :which-key "find bible book")
"fr" '(consult-recent-file :which-key "recent file")
"fs" '(save-buffer :which-key "save")
"hf" '(helpful-callable :which-key "describe-function")
"hv" '(helpful-variable :which-key "describe-variable")
"hk" '(helpful-key :which-key "describe-key")
"hi" '(info :which-key "info manual")
"ss" '(consult-line :which-key "consult search")
"ww" '(other-window :which-key "other window")
"wd" '(delete-window :which-key "other window")
)
(general-def 'minibuffer-local-map
"C-v" 'evil-paste-after))
@ -268,6 +270,8 @@ vertically."
(setq consult-narrow-key "<")
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"si" 'consult-imenu
"so" 'consult-outline))
@ -313,6 +317,8 @@ vertically."
:straight nil
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"od" '(dired-jump :which-key "open dired here"))
(general-def 'normal dired-mode-map
"q" 'kill-this-buffer))
@ -467,6 +473,8 @@ vertically."
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"o a" 'org-agenda
"c" 'org-capture)
('normal org-agenda-mode-map
@ -557,6 +565,8 @@ vertically."
:head "#+TITLE: %<%Y-%m-%d> - Biblical\n#+AUTHOR: Chris Cochrun")))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"nf" '(org-roam-find-file :which-key "org roam ff")
"nr" 'org-roam))
@ -866,6 +876,8 @@ If on a:
(mu4e t)
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"om" 'mu4e))
(use-package org-mime
@ -896,6 +908,8 @@ If on a:
)))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"oc" 'chris/calfw-calendar-open)
(general-def cfw:calendar-mode-map
"q" 'kill-this-buffer
@ -912,7 +926,10 @@ If on a:
(use-package magit
:commands (magit-status magit-get-current-branch)
:general
(chris/leader-keys "g g" 'magit-status)
(chris/leader-keys
:states 'normal
:keymaps 'override
"g g" 'magit-status)
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
@ -998,6 +1015,8 @@ If on a:
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"oe" 'eshell)
(general-def '(normal insert) eshell-mode-map
"C-d" 'kill-this-buffer))
@ -1019,24 +1038,87 @@ If on a:
'(("\\*e?shell\\*"
(display-buffer-in-side-window)
(window-width . 0.4)
(side . right))))
(side . right))
("*Bongo-Elfeed Queue*"
(display-buffer-in-side-window)
(window-height . 0.25)
(side . bottom))))
(use-package elfeed
:commands (elfeed)
:config
(defvar chris/elfeed-bongo-playlist "*Bongo-Elfeed Queue*"
"Name of the Elfeed+Bongo multimedia playlist.")
(defun chris/elfeed-bongo-insert-item ()
"Insert `elfeed' multimedia links in `bongo' playlist buffer.
The playlist buffer has a unique name so that it will never
interfere with the default `bongo-playlist-buffer'."
(interactive)
(let* ((entry (elfeed-search-selected :ignore-region))
(link (elfeed-entry-link entry))
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0))
(url (if (string-prefix-p "https://thumbnails" enclosure)
link
enclosure))
(title (elfeed-entry-title entry))
(bongo-pl chris/elfeed-bongo-playlist)
(buffer (get-buffer-create bongo-pl)))
(message "link is %s" link)
(message "enclosure is %s" enclosure)
(message "url is %s" url)
(message "title is %s" title)
(elfeed-search-untag-all-unread)
(unless (bongo-playlist-buffer)
(bongo-playlist-buffer))
(display-buffer buffer)
(with-current-buffer buffer
(when (not (bongo-playlist-buffer-p))
(bongo-playlist-mode)
(setq-local bongo-library-buffer (get-buffer "*elfeed-search*"))
(setq-local bongo-enabled-backends '(mpv))
(bongo-progressive-playback-mode))
(goto-char (point-max))
(bongo-insert-uri url (format "%s ==> %s" title url))
(let ((inhibit-read-only t))
(delete-duplicate-lines (point-min) (point-max)))
(bongo-recenter))
(message "Enqueued %s “%s” in %s"
(if enclosure "podcast" "video")
(propertize title 'face 'italic)
(propertize bongo-pl 'face 'bold))))
(defun chris/elfeed-bongo-switch-to-playlist ()
(interactive)
(let* ((bongo-pl chris/elfeed-bongo-playlist)
(buffer (get-buffer bongo-pl)))
(if buffer
(switch-to-buffer buffer)
(message "No `bongo' playlist is associated with `elfeed'."))))
:general
(chris/leader-keys
"of" 'elfeed))
:states 'normal
:keymaps 'override
"of" 'elfeed)
(general-def 'normal elfeed-search-mode-map
"v" 'chris/elfeed-bongo-insert-item
"h" 'chris/elfeed-bongo-switch-to-playlist))
(use-package elfeed-org
:after elfeed
:config
(setq rmh-elfeed-org-files (list "~/org/elfeed.org")))
(setq rmh-elfeed-org-files (list "~/org/elfeed.org"))
(elfeed-org)
(elfeed-update))
(use-package bongo
:commands (bongo)
:commands (bongo bongo-playlist-buffer)
:config
(define-bongo-backend mpv
;; :constructor 'bongo-start-mpv-player
:program-name 'mpv
:constructor 'bongo-start-mpv-player
:extra-program-arguments '("--input-ipc-server=/tmp/mpvsocket")
@ -1050,7 +1132,7 @@ If on a:
:matcher '(("http:" "https:" "lbry:") . t))
(setq bongo-enabled-backends '(mpv)
bongo-track-mark-icon-file-name "sun-solid.png")
bongo-track-mark-icon-file-name "track-mark-icon.png")
(defun chris/bongo-mark-line-forward ()
(interactive)
@ -1064,13 +1146,16 @@ If on a:
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"ob" 'bongo)
(general-def 'normal bongo-playlist-mode-map
"RET" 'bongo-dwim
"d" 'bongo-kill
"RET" 'bongo-play
"d" 'bongo-kill-line
"u" 'bongo-unmark-region
"p" 'bongo-pause/resume
"H" 'bongo-switch-buffers
"m" 'chris/bongo-mark-line-forward))
(setq gc-cons-threshold 2000000)
(setq garbage-collection-messages nil)