;; custom
-(defvar spray-freq (/ 60.0 300) "60.0 / WPM")
+(defvar spray-freq (/ 60.0 400) "60.0 / WPM")
(defvar spray-text-scale 5)
(defvar spray-orp-face 'error)
(defun turn-off-spray-mode () (interactive) (spray-mode -1))
(defun spray-next ()
- (if (not (zerop spray--delay))
- (setq spray--delay (1- spray--delay))
- (widen)
- (if (eobp)
- (turn-off-spray-mode)
- (skip-chars-forward "\s\t\n")
- (let* ((beg (point))
- (len (skip-chars-forward "^\s\t\n"))
- (end (point))
- (orp (+ beg (cl-case len
- ((1) 1)
- ((2 3 4 5) 2)
- ((6 7 8 9) 3)
- ((10 11 12 13) 4)
- (t 5)))))
- (setq spray--delay (+ (if (> len 8) 1 0) (cl-case (char-before)
- ((?. ?! ?\? ?\;) 3)
- ((?, ?:) 1)
- (t 0))))
- (overlay-put spray--padding-overlay
- 'before-string (make-string (- 5 (- orp beg)) ?\s))
- (move-overlay spray--padding-overlay beg (1+ beg))
- (move-overlay spray--orp-overlay (1- orp) orp)
- (narrow-to-region beg end)))))
+ (cond ((not (zerop spray--delay))
+ (setq spray--delay (1- spray--delay))
+ (when (and (<= spray--delay 2)
+ (= (char-before) ?.))
+ (narrow-to-region (point) (point))))
+ (t
+ (widen)
+ (if (eobp)
+ (turn-off-spray-mode)
+ (skip-chars-forward "\s\t\n")
+ (let* ((beg (point))
+ (len (skip-chars-forward "^\s\t\n"))
+ (end (point))
+ (orp (+ beg (cl-case len
+ ((1) 1)
+ ((2 3 4 5) 2)
+ ((6 7 8 9) 3)
+ ((10 11 12 13) 4)
+ (t 5)))))
+ (setq spray--delay (+ (if (> len 8) 1 0) (cl-case (char-before)
+ ((?. ?! ?\? ?\;) 3)
+ ((?, ?:) 1)
+ (t 0))))
+ (overlay-put spray--padding-overlay
+ 'before-string (make-string (- 5 (- orp beg)) ?\s))
+ (move-overlay spray--padding-overlay beg (1+ beg))
+ (move-overlay spray--orp-overlay (1- orp) orp)
+ (narrow-to-region beg end))))))
(provide 'spray)