- [Variable] spray-height
- [Variable] spray-margin-top
- [Variable] spray-margin-left
+- [Variable] spray-ramp
- [Keymap] spray-mode-map
- [Face] spray-base-face
- [Face] spray-accent-face
Each word is displayed for (60 / the choosen wpm) seconds, except if the word ends with ,:ā or is greater than 9 characters long, in which case it is displayed for twice as long.
+When started, an added delay is optionally added, based on the spray-ramp variable. See it's documentation for details.
+
The accent location is chosen as the nth character in a word, depending on its length, based on the following table
| length | accent position |
| 1 | 1 |
;; Known bugs.
;; repeated words are indistinguishable, for example
;; "going, going, gone" reads like going, gone, with a slight delay.
+;;
+;; sentences (like this) should trigger a pause for ( and )
;;; Change Log:
;; 0.0.0 test release
(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 1 "character margin at left of buffer. Characters are as big as spray text characters.")
+(defvar spray-ramp 2
+ "Ramp up to full speed. Pause for this multiple of wpm on the first word,
+decreasing by one for each subsequent word.")
(defvar spray-mode-map
(let ((km (make-sparse-keymap)))
(defvar spray--base-overlay nil)
(defvar spray--accent-overlay nil)
(defvar spray--running nil)
+(defvar spray--first-words 0)
+(defvar spray--initial-delay 0)
(defvar spray--delay 0)
(defvar spray--saved-cursor-type nil)
(defvar spray--saved-buffer-face nil)
(make-string (- 5 (- accent beg)) ?\s)))
(narrow-to-region beg end)))
+
(defun spray--update ()
- (cond ((not (zerop spray--delay))
+ (cond ((not (zerop spray--initial-delay))
+ (setq spray--initial-delay (1- spray--initial-delay)))
+ ((not (zerop spray--delay))
(setq spray--delay (1- spray--delay))
(when (= spray--delay 2)
(narrow-to-region (point) (point))))
(widen)
(if (eobp)
(spray-mode -1)
+ (when (not (zerop spray--first-words))
+ (setq spray--initial-delay spray--first-words)
+ (setq spray--first-words (1- spray--first-words)))
(skip-chars-forward "\s\t\nā")
(spray--word-at-point)))))
(defun spray-start ()
"Start / resume spray."
(interactive)
+ (setq spray--first-words spray-ramp)
(setq spray--running
(run-with-timer 0 (/ 60.0 spray-wpm) 'spray--update)))