Skip to content

Commit aee6185

Browse files
committed
Be specific for randomize-flag. Fix speed-type--get-continue-point
1 parent 1ffac67 commit aee6185

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

speed-type.el

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,14 +1573,15 @@ END MIN MAX TOLERANCE IGNORE are supplied to
15731573

15741574
(defun speed-type--get-continue-point ()
15751575
"Get speed-type-orig-pos of the last char in the first typed sequence."
1576-
(let ((continue-point (save-excursion
1577-
(goto-char (point-min))
1578-
(text-property-search-forward 'speed-type-char-status 'nil t)
1579-
(text-property-search-backward 'speed-type-char-status 'nil t)
1580-
(point))))
1581-
(if (= (point-min) continue-point)
1582-
(car (get-text-property continue-point 'speed-type-orig-pos))
1583-
(cdr (get-text-property (1- continue-point) 'speed-type-orig-pos)))))
1576+
(save-excursion
1577+
(goto-char (point-min))
1578+
(or (text-property-search-forward 'speed-type-char-status 'nil t)
1579+
(goto-char (point-max)))
1580+
(text-property-search-backward 'speed-type-char-status 'nil t)
1581+
(if (or (bolp)
1582+
(eq (char-syntax (char-before (point))) ?\s))
1583+
(car (get-text-property (point) 'speed-type-orig-pos))
1584+
(cdr (get-text-property (1- (point)) 'speed-type-orig-pos)))))
15841585

15851586
(defun speed-type--get-continue-fn (end)
15861587
"Return a function when evaled continues where current-speed-type session end.
@@ -1638,6 +1639,7 @@ X is the user-picked limit for the random-function."
16381639
text
16391640
:file-name speed-type--file-name
16401641
:title speed-type--title
1642+
:randomize speed-type--randomize
16411643
:n-words n
16421644
:replay-fn speed-type--replay-fn
16431645
:go-next-fn speed-type--go-next-fn
@@ -1819,6 +1821,7 @@ If `speed-type-default-lang' is set, will pick a random book of that language."
18191821
:file-name fn
18201822
:title title
18211823
:author author
1824+
:randomize t
18221825
:n-words n
18231826
:replay-fn #'speed-type--get-replay-fn
18241827
:go-next-fn go-next-fn
@@ -1894,9 +1897,9 @@ More details see `speed-type-top-x'."
18941897
(speed-type--setup buf
18951898
text
18961899
:file-name fn
1897-
:randomize t
18981900
:title title
18991901
:author (user-full-name)
1902+
:randomize t
19001903
:replay-fn #'speed-type--get-replay-fn
19011904
:syntax-table (with-current-buffer buf (syntax-table))
19021905
:fldf (with-current-buffer buf font-lock-defaults))))
@@ -1928,6 +1931,7 @@ speed-type session with the assembled text."
19281931
text
19291932
:file-name fn
19301933
:title title
1934+
:randomize t
19311935
:n-words n
19321936
:replay-fn #'speed-type--get-replay-fn
19331937
:go-next-fn (lambda () (speed-type--get-next-top-fn x))
@@ -2119,9 +2123,9 @@ If FILE-NAME is nil, will use file-name of CURRENT-BUFFER."
21192123
(speed-type--setup buf
21202124
text
21212125
:file-name fn
2122-
:randomize nil
21232126
:title title
21242127
:author author
2128+
:randomize nil
21252129
:replay-fn #'speed-type--get-replay-fn
21262130
:go-next-fn go-next-fn
21272131
:continue-fn (lambda () (speed-type--get-continue-fn end))
@@ -2155,6 +2159,7 @@ The file-name of the content is a converted form of URL."
21552159
text
21562160
:file-name fn
21572161
:title title
2162+
:randomize t
21582163
:replay-fn #'speed-type--get-replay-fn
21592164
:go-next-fn go-next-fn
21602165
:continue-fn (lambda () (speed-type--get-continue-fn end))
@@ -2200,6 +2205,7 @@ stored content in `speed-type-directory'."
22002205
:file-name fn
22012206
:title title
22022207
:n-words n
2208+
:randomize t
22032209
:replay-fn #'speed-type--get-replay-fn
22042210
:go-next-fn (lambda () (speed-type--get-next-top-fn x))
22052211
:add-extra-word-content-fn add-extra-word-content-fn)))

0 commit comments

Comments
 (0)