X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=spray.el;h=836cf07ff3137bbef25c568ab0244a492f325c2c;hb=555c855bfb380aae0091cd8e6e698dfa0a40feb4;hp=4155926b6f1a55e89824d782cfc363e08f6af2ab;hpb=2161f109b711d6ec7d3b7f54c22ffaa65bd29270;p=spray diff --git a/spray.el b/spray.el index 4155926..836cf07 100644 --- a/spray.el +++ b/spray.el @@ -35,6 +35,10 @@ ;; ;; For more informations, see Readme.org. +;; Known bugs. +;; repeated words are indistinguishable, for example +;; "going, going, gone" reads like going, gone, with a slight delay. + ;;; Change Log: ;; 0.0.0 test release ;; 0.0.1 add spray-set-margins @@ -49,7 +53,7 @@ (defvar spray-wpm 400 "words/min") (defvar spray-height 400 "height of characters") (defvar spray-margin-top 1 "character margin at top of buffer. Characters are as big as spray text characters.") -(defvar spray-margin-left 0 "character margin at left of buffer. Characters are as big as spray text characters.") +(defvar spray-margin-left 1 "character margin at left of buffer. Characters are as big as spray text characters.") (defvar spray-mode-map (let ((km (make-sparse-keymap))) @@ -91,6 +95,7 @@ (defvar spray--saved-cursor-type nil) (defvar spray--saved-buffer-face nil) (defvar spray--saved-restriction nil) +(defvar spray--saved-smartparens-enabled nil) ;; * utility functions @@ -115,7 +120,15 @@ (cons (point-min) (point-max))) spray--saved-buffer-face (and (boundp 'buffer-face-mode) buffer-face-mode - buffer-face-mode-face)) + buffer-face-mode-face) + spray--saved-smartparens-enabled (and (boundp 'smartparens-mode) + smartparens-mode) + spray--saved-highlight-symbol-enabled (and (boundp 'highlight-symbol-mode) + highlight-symbol-mode)) + ;; smartparens wrapping of all letter binds can cause problems. + ;; for example, it can cause auto-complete to activate + (and spray--saved-smartparens-enabled (smartparens-mode -1)) + (and spray--saved-highlight-symbol-enabled (highlight-symbol-mode -1)) (setq cursor-type nil) (let ((buffer-face-mode-face `(:height ,spray-height))) (buffer-face-mode 1)) @@ -125,6 +138,8 @@ (overlay-put spray--accent-overlay 'face 'spray-accent-face) (spray-start)) (t + (and spray--saved-smartparens-enabled (smartparens-mode 1)) + (and spray--saved-highlight-symbol-enabled (highlight-symbol-mode 1)) (setq cursor-type spray--saved-cursor-type) (if spray--saved-restriction (narrow-to-region (car spray--saved-restriction) @@ -154,6 +169,10 @@ ((6 7 8 9) 3) ((10 11 12 13) 4) (t 5))))) + ;; this fairly obfuscated, using magic numbers to store state + ;; it would be nice to sometime patch this so it is more readable. + ;; for greater than 9 length, we display for twice as long + ;; for some punctuation, we display a blank (setq spray--delay (+ (if (> len 9) 1 0) (if (looking-at "\n[\s\t\n]") 3 0) (cl-case (char-before)