From 04fbf30e8d8899e5cf8ba7541eb096f52a761723 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 27 Sep 2021 23:08:41 -0500 Subject: Don't blink cursor in reading-mode --- lisp/acdw-reading.el | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'lisp') diff --git a/lisp/acdw-reading.el b/lisp/acdw-reading.el index 26ee5e8..e0a7f74 100644 --- a/lisp/acdw-reading.el +++ b/lisp/acdw-reading.el @@ -11,8 +11,17 @@ ;; - Don't hurt yourself. ;; - Make good choices. +;;; Commentary: + +;; here is my attempt at a reading mode. + ;;; Code: +(require 'olivetti) + +(defvar-local //indicate-empty-lines nil) +(defvar-local //indicate-buffer-boundaries nil) + ;;;###autoload (define-minor-mode reading-mode "A mode for reading." @@ -22,30 +31,37 @@ (if reading-mode (progn ;; turn on ;; settings - (setq-local orig-indicate-empty-lines indicate-empty-lines + (setq-local //indicate-empty-lines indicate-empty-lines indicate-empty-lines nil - orig-indicate-buffer-boundaries indicate-buffer-boundaries + //indicate-buffer-boundaries indicate-buffer-boundaries indicate-buffer-boundaries nil) ;; disable modes - (dolist (mode '(display-fill-column-indicator-mode)) + (dolist (mode '(display-fill-column-indicator-mode + blink-cursor-mode)) (when (fboundp mode) + (set (make-local-variable + (intern (format "//%s" mode))) + (symbol-value mode)) (funcall mode -1))) ;; enable modes (dolist (mode '(olivetti-mode)) (when (fboundp mode) + (set (make-local-variable + (intern (format "//%s" mode))) + (symbol-value 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)) + ;; restore settings + (setq-local indicate-empty-lines //indicate-empty-lines + indicate-buffer-boundaries //indicate-buffer-boundaries) + ;; restore modes + (dolist (mode '(display-fill-column-indicator-mode + olivetti-mode + blink-cursor-mode)) (when (fboundp mode) - (funcall mode -1))))) + (funcall mode (if (symbol-value (intern (format "//%s" mode))) + +1 + -1)))))) (provide 'acdw-reading) ;;; acdw-reading.el ends here -- cgit 1.4.1-21-gabe81