nov-mode and bookmarks

This commit is contained in:
Chris Cochrun 2021-09-12 07:27:33 -05:00
parent 689c811bba
commit 58ccd2197c
2 changed files with 85 additions and 59 deletions

View file

@ -604,7 +604,8 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc
:states 'normal
:keymaps 'override
"si" 'consult-imenu
"so" 'consult-org-heading))
"so" 'consult-org-heading
"sm" 'bookmark-jump))
#+end_src
*** MARGINALIA
@ -1209,6 +1210,7 @@ Part of this config includes some special capture templates for my work as a you
"RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view
"ge" 'org-edit-src-code
"gr" 'revert-buffer
"t" 'org-todo)
('insert org-mode-map
"C-i" 'completion-at-point)
@ -1887,7 +1889,16 @@ Let's use pdf-tools for a lot better interaction with pdfs.
(use-package nov
:mode ("\\.epub\\'" . nov-mode)
:config
(add-hook 'nov-mode-hook 'visual-fill-column-mode))
(defun chris/setup-nov-mode
(interactive)
(visual-fill-column-mode)
(display-line-numbers-mode -1)
(variable-pitch-mode +1)
(setq visual-fill-column-width 100
visual-fill-column-center-text t))
(add-hook 'nov-mode-hook 'chris/setup-nov-mode))
#+end_src
** EAF (Emacs Application Framework)
@ -1920,7 +1931,9 @@ interfere with the default `bongo-playlist-buffer'."
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0))
(url (if (string-prefix-p "https://thumbnails" enclosure)
link
enclosure))
(if (string= enclosure nil)
link
enclosure)))
(title (elfeed-entry-title entry))
(bongo-pl chris/elfeed-bongo-playlist)
(buffer (get-buffer-create bongo-pl)))

125
init.el
View file

@ -2,9 +2,9 @@
(defun chris/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(add-hook 'emacs-startup-hook #'chris/display-startup-time)
(setq inhibit-startup-message t)
@ -39,19 +39,19 @@
(defun chris/set-transparency ()
"Set the frame to be transparent on Wayland compositors"
(if (string-search "wayland" x-display-name)
'((set-frame-parameter (selected-frame) 'alpha '(100 . 100))
(set-frame-parameter (selected-frame) 'undecorated t)
(add-to-list 'default-frame-alist '(undecorated . t))
(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(undecorated . t)))))
'((set-frame-parameter (selected-frame) 'alpha '(100 . 100))
(set-frame-parameter (selected-frame) 'undecorated t)
(add-to-list 'default-frame-alist '(undecorated . t))
(add-to-list 'default-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(alpha . (100 . 100)))
(add-to-list 'initial-frame-alist '(undecorated . t)))))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(chris/set-font-faces)))
(chris/set-font-faces)))
(chris/set-font-faces)))
(setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode +1)
@ -67,7 +67,7 @@
;; ...especially on linux
(setq x-gtk-use-system-tooltips nil)
;; Favor vertical splits over horizontal ones. Screens are usually wide.
;; Favor vertical splits over horizontal ones. Screens are usually wide.
(setq split-width-threshold 160
split-height-threshold nil)
@ -101,8 +101,8 @@
(straight-use-package 'use-package)
(setq use-package-verbose t)
(use-package command-log-mode
:commands command-log-mode)
(use-package command-log-mode
:commands command-log-mode)
(use-package all-the-icons)
@ -301,19 +301,19 @@
;; We need to fix selectrums minibuffer handling for Emacs 28
(defun selectrum--set-window-height (window &optional height)
"Set window height of WINDOW to HEIGHT pixel.
"Set window height of WINDOW to HEIGHT pixel.
If HEIGHT is not given WINDOW will be updated to fit its content
vertically."
(let* ((lines (length
(split-string
(overlay-get selectrum--candidates-overlay 'after-string)
"\n" t)))
(dheight (or height
(* lines selectrum--line-height)))
(wheight (window-pixel-height window))
(window-resize-pixelwise t))
(window-resize
window (- dheight wheight) nil nil 'pixelwise)))
(let* ((lines (length
(split-string
(overlay-get selectrum--candidates-overlay 'after-string)
"\n" t)))
(dheight (or height
(* lines selectrum--line-height)))
(wheight (window-pixel-height window))
(window-resize-pixelwise t))
(window-resize
window (- dheight wheight) nil nil 'pixelwise)))
:general
@ -344,7 +344,8 @@ vertically."
:states 'normal
:keymaps 'override
"si" 'consult-imenu
"so" 'consult-org-heading))
"so" 'consult-org-heading
"sm" 'bookmark-jump))
(use-package marginalia
:bind (:map minibuffer-local-map
@ -498,7 +499,7 @@ vertically."
(use-package friar
:straight (:host github :repo "warreq/friar" :branch "master"
:files (:defaults "*.lua" "*.fnl"))
:files (:defaults "*.lua" "*.fnl"))
:after fennel-mode)
(use-package yaml-mode
@ -811,6 +812,7 @@ vertically."
"RET" 'chris/org-dwim-at-point
"gC" 'chris/org-columns-view
"ge" 'org-edit-src-code
"gr" 'revert-buffer
"t" 'org-todo)
('insert org-mode-map
"C-i" 'completion-at-point)
@ -842,17 +844,17 @@ vertically."
:after org
:init
(setq org-super-agenda-groups '((:name "Today"
:time-grid t
:scheduled today)
:time-grid t
:scheduled today)
(:name "Due Today"
:deadline today)
:deadline today)
(:name "Important"
:priority "A")
:priority "A")
(:name "Overdue"
:time-grid t
:scheduled today)
:time-grid t
:scheduled today)
(:name "Due soon"
:deadline future)))
:deadline future)))
:config
(org-super-agenda-mode)
(setq org-super-agenda-header-map nil))
@ -871,7 +873,7 @@ vertically."
org-roam-capture-templates
'(("d" "default" plain "%?"
:if-new (file+head "${slug}.org"
"#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n\nj ")
"#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n\nj ")
:unnarrowed t)
("b" "bible" plain "%?"
:if-new (file+head "${slug}.org"
@ -879,7 +881,7 @@ vertically."
:unnarrowed t)
("l" "TFC Lesson" plain (file ".templates/lessontemplate.org")
:if-new (file+head "lessons/${slug}.org"
"#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n")
"#+TITLE: ${title}\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n")
:unnarrowed t))
org-roam-dailies-capture-templates
'(("d" "daily" plain #'org-roam-capture--get-point ""
@ -1377,18 +1379,18 @@ If on a:
(add-hook 'eshell-mode-hook '(display-line-numbers-mode -1))
(setq eshell-command-aliases-list
'(("q" "exit")
("f" "find-file $1")
("ff" "find-file $1")
("d" "dired $1")
("bd" "eshell-up $1")
("rg" "rg --color=always $*")
("ll" "ls -lah $*")
("gg" "magit-status")
("clear" "clear-scrollback")
("!c" "eshell-previous-input 2")
("yay" "paru $1")
("yeet" "paru -Rns $1")))
'(("q" "exit")
("f" "find-file $1")
("ff" "find-file $1")
("d" "dired $1")
("bd" "eshell-up $1")
("rg" "rg --color=always $*")
("ll" "ls -lah $*")
("gg" "magit-status")
("clear" "clear-scrollback")
("!c" "eshell-previous-input 2")
("yay" "paru $1")
("yeet" "paru -Rns $1")))
:general
(chris/leader-keys
@ -1403,8 +1405,8 @@ If on a:
(use-package pdf-tools
:straight (:host github
:repo "flatwhatson/pdf-tools"
:branch "fix-macros")
:repo "flatwhatson/pdf-tools"
:branch "fix-macros")
:defer 1
:config
(pdf-tools-install)
@ -1414,7 +1416,16 @@ If on a:
(use-package nov
:mode ("\\.epub\\'" . nov-mode)
:config
(add-hook 'nov-mode-hook 'visual-fill-column-mode))
(defun chris/setup-nov-mode
(interactive)
(visual-fill-column-mode)
(display-line-numbers-mode -1)
(variable-pitch-mode +1)
(setq visual-fill-column-width 100
visual-fill-column-center-text t))
(add-hook 'nov-mode-hook 'chris/setup-nov-mode))
(use-package eaf
:straight (:host github :repo "manateelazycat/emacs-application-framework"
@ -1440,7 +1451,9 @@ interfere with the default `bongo-playlist-buffer'."
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0))
(url (if (string-prefix-p "https://thumbnails" enclosure)
link
enclosure))
(if (string= enclosure nil)
link
enclosure)))
(title (elfeed-entry-title entry))
(bongo-pl chris/elfeed-bongo-playlist)
(buffer (get-buffer-create bongo-pl)))
@ -1571,11 +1584,11 @@ interfere with the default `bongo-playlist-buffer'."
transmission-files-mode
transmission-info-mode
transmission-peers-mode)))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"ot" 'transmission))
:general
(chris/leader-keys
:states 'normal
:keymaps 'override
"ot" 'transmission))
(use-package auth-source-pass
:defer 1