feat(tazjin/russian): Echo Russian words when Emacs is idle
This should keep up passive exposure to words, but needs a subsequent function for filtering out things that are definitely known. Since I'm keeping the frequent word list mostly intact the majority of words are very basic, but it's those last 15-20% I'm interested in (not completely imported yet). Change-Id: I7a5684b8dca1fe5301e8b394be2627550a60e3c6
This commit is contained in:
parent
48290298ad
commit
f7c87fd774
2 changed files with 30 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
(require 'cl-macs)
|
||||
(require 'ht)
|
||||
(require 'seq)
|
||||
(require 's)
|
||||
|
||||
;; Type definitions for Russian structures
|
||||
|
||||
|
@ -62,4 +63,28 @@
|
|||
|
||||
'(message "Defined %s unique words." (ht-size russian-words)))
|
||||
|
||||
;; Helpers to train Russian words when Emacs is idling.
|
||||
|
||||
(defun russian--format-word (word)
|
||||
"Format a Russian word suitable for echo display."
|
||||
(apply #'s-concat
|
||||
(-flatten
|
||||
(list (russian-word-word word)
|
||||
" - "
|
||||
(s-join ", " (russian-word-translations word))
|
||||
(when-let ((roots (russian-word-roots word)))
|
||||
(list " [" (s-join ", " roots) "]"))
|
||||
(when-let ((notes (russian-word-notes word)))
|
||||
(list " (" (s-join "; " notes) ")"))))))
|
||||
|
||||
(defvar russian--last-word nil
|
||||
"Last randomly displayed Russian word")
|
||||
|
||||
(defun display-random-russian-word ()
|
||||
(interactive)
|
||||
(message (russian--format-word (seq-random-elt (ht-values russian-words)))))
|
||||
|
||||
(defvar russian--display-timer
|
||||
(run-with-idle-timer 5 t #'display-random-russian-word))
|
||||
|
||||
(provide 'russian)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue