;;; article.el --- a viewing mode for books and novels. -*- lexical-binding: t; -*- ;; Copyright (C) 2019 Robert Rose ;; Author: Robert Rose ;; Keywords: lisp eww novel book ;; Version: 0.0.1 ;; Package-Requires ((emacs "24") (diminish "20170419.1736")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; This package provides a minor mode for viewing books and novels, or anthing meant to be read ;; by humans. You can set line spacing, column width and face from the `article' custom group. ;; I recommend also setting a less annoying cursor color, since I haven't implemented it here. ;;; Code: (require 'diminish) (define-minor-mode article-mode "Format buffer for easy reading." :lighter " Article" (defgroup article nil "Change how article mode looks." :group 'novels) (defcustom article-mode-line-spacing 25 "Line spacing to use when `article-mode' is enabled." :type 'integer :group 'article) (defcustom article-mode-fill-column 120 "Line column width to use when `article-mode' is enabled." :type 'integer :group 'article) (defface article '((() :family "Deja Vu Serif" :height 320)) "Face for easy reading." :group 'article) (defvar-local visual-fill-column-center-text nil) (if article-mode (progn (diminish 'visual-line-mode) (diminish 'buffer-face-mode) (setq-local orig-f fill-column) (setq-local orig-l line-spacing) (setq-local orig-v visual-fill-column-center-text) (buffer-face-set 'article) (visual-line-mode 1) (setq-local fill-column article-mode-fill-column) (setq-local line-spacing article-mode-line-spacing) (setq-local visual-fill-column-center-text t) (visual-fill-column-mode 1)) (progn (buffer-face-mode 0) (visual-line-mode 0) (setq-local fill-column orig-f) (setq-local line-spacing orig-l) (setq-local visual-fill-column-center-text orig-v) (visual-fill-column-mode 0) (diminish-undo 'visual-line-mode) (diminish-undo 'buffer-face-mode)) )) (provide 'article) ;;; article.el ends here