emacs/lisp/acdw-reading.el

52 lines
1.6 KiB
EmacsLisp

;;; acdw-reading.el --- minor mode for reading -*- lexical-binding: t -*-
;; Copyright 2021 Case Duckworth <acdw@acdw.net>
;; This file is NOT part of GNU Emacs.
;;; License:
;; Everyone is permitted to do whatever with this software, without
;; limitation. This software comes without any warranty whatsoever,
;; but with two pieces of advice:
;; - Don't hurt yourself.
;; - Make good choices.
;;; Code:
;;;###autoload
(define-minor-mode reading-mode
"A mode for reading."
:init-value nil
:lighter " Read"
:keymap (make-sparse-keymap)
(if reading-mode
(progn ;; turn on
;; settings
(setq-local orig-indicate-empty-lines indicate-empty-lines
indicate-empty-lines nil
orig-indicate-buffer-boundaries indicate-buffer-boundaries
indicate-buffer-boundaries nil)
;; disable modes
(dolist (mode '(display-fill-column-indicator-mode))
(when (fboundp mode)
(funcall mode -1)))
;; enable modes
(dolist (mode '(olivetti-mode))
(when (fboundp mode)
(funcall mode +1))))
;; turn off
;; settings
(setq-local indicate-empty-lines orig-indicate-empty-lines
indicate-buffer-boundaries orig-indicate-buffer-boundaries)
;; enable modes
(dolist (mode '(display-fill-column-indicator-mode))
(when (fboundp mode)
(funcall mode +1)))
;; disable modes
(dolist (mode '(olivetti-mode))
(when (fboundp mode)
(funcall mode -1)))))
(provide 'acdw-reading)
;;; acdw-reading.el ends here