*** Algorithm translated from code to english
-Words are split at space, tab and newline characters, and if any of the characters =.!?;= appear in a word, a blank word is appended to the current word.
+Words are split at space, tab, newline, and emdash characters. If any of the characters =.!?;= appear at the end of the word, a blank word is appended to the current word.
-Each word is displayed for (60 / the choosen wpm) seconds, except if the word contains : or , or is greater than 9 characters long, in which case it is displayed for twice as long.
+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.
The accent location is chosen as the nth character in a word, depending on its length, based on the following table
| length | accent position |
(spray-mode -1))
(defun spray--word-at-point ()
- (skip-chars-backward "^\s\t\n")
+ (skip-chars-backward "^\s\t\n—")
(let* ((beg (point))
- (len (skip-chars-forward "^\s\t\n"))
+ (len (+ (skip-chars-forward "^\s\t\n—") (skip-chars-forward "—")))
(end (point))
(accent (+ beg (cl-case len
((1) 1)
(if (looking-at "\n[\s\t\n]") 3 0)
(cl-case (char-before)
((?. ?! ?\? ?\;) 3)
- ((?, ?:) 1)
+ ((?, ?: ?—) 1)
(t 0))))
(move-overlay spray--accent-overlay (1- accent) accent)
(move-overlay spray--base-overlay beg end)
(widen)
(if (eobp)
(spray-mode -1)
- (skip-chars-forward "\s\t\n")
+ (skip-chars-forward "\s\t\n—")
(spray--word-at-point)))))
;; * interactive commands
(interactive)
(spray-stop)
(widen)
- (skip-chars-forward "\s\t\n")
+ (skip-chars-forward "\s\t\n—")
(spray--word-at-point))
(defun spray-backward-word ()
(interactive)
(spray-stop)
(widen)
- (skip-chars-backward "^\s\t\n")
- (skip-chars-backward "\s\t\n")
+ (skip-chars-backward "^\s\t\n—")
+ (skip-chars-backward "\s\t\n—")
(spray--word-at-point))
(defun spray-faster ()