From 5b7fbf4bc65268533e16bde4ad6198537b85ee41 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 7 Sep 2021 08:10:09 -0500 Subject: Change acdw/reading-mode to reading-mode --- lisp/acdw-reading.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ lisp/acdw.el | 41 ----------------------------------------- 2 files changed, 51 insertions(+), 41 deletions(-) create mode 100644 lisp/acdw-reading.el (limited to 'lisp') diff --git a/lisp/acdw-reading.el b/lisp/acdw-reading.el new file mode 100644 index 0000000..e21cff9 --- /dev/null +++ b/lisp/acdw-reading.el @@ -0,0 +1,51 @@ +;;; acdw-reading.el --- minor mode for reading -*- lexical-binding: t -*- + +;; Copyright 2021 Case Duckworth +;; 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 diff --git a/lisp/acdw.el b/lisp/acdw.el index 0039de2..5bb53e2 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -534,47 +534,6 @@ It's called 'require-private' for historical reasons." name)) recentf-list))) - -;;; Minor modes - -(define-minor-mode acdw/reading-mode - "A mode for reading." - :init-value nil - :lighter " Read" - :keymap (let ((map (make-sparse-keymap))) - (when-let ((link-cmd (or (fbound-and-true-p #'ace-link) - (fbound-and-true-p #'link-hint-open-link)))) - (define-key map (kbd ";") link-cmd) - (define-key map (kbd "o") link-cmd)) - map) - (if acdw/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))))) - ;;; Sort setq... ;; https://emacs.stackexchange.com/questions/33039/ -- cgit 1.4.1-21-gabe81