Add proper justification to epub in #emacs

This commit is contained in:
Colin Powell
2019-11-06 16:20:46 -05:00
parent 12059b734b
commit c9e8196eb6
3 changed files with 35 additions and 3 deletions

View File

@ -0,0 +1,28 @@
;;; ~/.dotfiles/emacs/.config/doom/+nov.el -*- lexical-binding: t; -*-
(require 'justify-kp)
(setq nov-text-width t)
(defun my-nov-window-configuration-change-hook ()
(my-nov-post-html-render-hook)
(remove-hook 'window-configuration-change-hook
'my-nov-window-configuration-change-hook
t))
(defun my-nov-post-html-render-hook ()
(if (get-buffer-window)
(let ((max-width (pj-line-width))
buffer-read-only)
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(when (not (looking-at "^[[:space:]]*$"))
(goto-char (line-end-position))
(when (> (shr-pixel-column) max-width)
(goto-char (line-beginning-position))
(pj-justify)))
(forward-line 1))))
(add-hook 'window-configuration-change-hook
'my-nov-window-configuration-change-hook
nil t)))
(add-hook 'nov-post-html-render-hook 'my-nov-post-html-render-hook)

View File

@ -15,7 +15,6 @@
(if (display-graphic-p)
(setq doom-theme 'doom-peacock))
;; Fonts
(setq doom-font (font-spec :family "IBM Plex Mono" :size 14))
(setq doom-big-font (font-spec :family "IBM Plex Mono" :size 21))
@ -170,12 +169,13 @@
(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . planetuml-mode))
(load! "+ui.el")
(load! "+org") ;; Org mode stuff like todos and rebindings
(load! "+org") ;; Org mode stuff like todos and rebindings
(load! "+org-cal")
;(load! "+elfeed")
(load! "+nov") ;; nov.el epub mode settings
(load! "+mail") ;; Mail stuff
(load! "+ranger")
(load! "+wttrin") ;; Weather config
(load! "+wttrin") ;; Weather config
(defun mpdel-playlist-play ()
"Start playing the song at point."

View File

@ -16,6 +16,10 @@
:recipe (:host github
:repo "redguardtoo/evil-matchit"))
(package! justify-kp
:recipe (:host github
:repo "Fuco1/justify-kp"))
;; eglot instead of lsp
(package! eglot)