about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-11-28T14·39+0300
committerVincent Ambo <mail@tazj.in>2021-11-28T14·39+0300
commitf7c87fd7748f733271463dd8ac3a30ce469a57d2 (patch)
treea30f41f5c855f0ac3a93b40368a98ab5b4703564 /users
parent48290298ad04d5b794671340bd5bf3bd5383d4fa (diff)
feat(tazjin/russian): Echo Russian words when Emacs is idle r/3104
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
Diffstat (limited to 'users')
-rw-r--r--users/tazjin/russian/russian.el25
-rw-r--r--users/tazjin/russian/words.el11
2 files changed, 30 insertions, 6 deletions
diff --git a/users/tazjin/russian/russian.el b/users/tazjin/russian/russian.el
index 1ef911199f5d..448b240a7063 100644
--- a/users/tazjin/russian/russian.el
+++ b/users/tazjin/russian/russian.el
@@ -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)
diff --git a/users/tazjin/russian/words.el b/users/tazjin/russian/words.el
index f2b51ba71243..9e7fc15da044 100644
--- a/users/tazjin/russian/words.el
+++ b/users/tazjin/russian/words.el
@@ -54,9 +54,9 @@
   ("уже" ("already" "by now"))
   ("для" ("for" "to"))
   ("вот" ("here" "there" "this is" "that's")
-   "calling attention to something")
+   ("calling attention to something"))
   ("кто" ("who" "that" "some"))
-  ("да" ("yes" "but") "affirmation (..., right?)")
+  ("да" ("yes" "but") ("affirmation (..., right?)"))
   ("говорить" ("to say" "to tell" "to speak") nil ("-говор-"))
   ("год" ("year"))
 
@@ -88,14 +88,14 @@
   ("два" ("two"))
   ("там" ("there" "then"))
   ("чем" ("than" "instead of")
-   "чем ..., тем ...")
+   ("чем ..., тем ..."))
   ("глаз" ("eye" "sight"))
   ("жизнь" ("life") nil ("-жи-"))
   ("первый" ("first" "front" "former"))
   ("день" ("day"))
   ("тут" ("here" "now" "then"))
   ("во" ("in" "at")
-   "as particle also: wow, exactly, ...")
+   ("as particle also: wow, exactly, ..."))
   ("ничто" ("nothing"))
   ("потом" ("afterwards" "then"))
   ("очень" ("very"))
@@ -353,7 +353,7 @@
   ("появиться" ("to appear" "to show up"))
   ("воздух" ("air"))
   ("разный" ("different"))
-  ("выходить" ("to go out" "to exit") "MR says 'to nurse'??" ("-ход-"))
+  ("выходить" ("to go out" "to exit") ("MR says 'to nurse'??") ("-ход-"))
   ("просить" ("to ask"))
   ("брат" ("brat"))
   ("собственный" ("one's own"))
@@ -416,5 +416,4 @@
   ("войти" ("to enter" "to come in") nil ("-й-"))
   ("длинный" ("long")))
 
-
 (provide 'russian-words)