(setq hiragana-list (string-to-list "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん")) (defun randomth (l) (nth (random (length l)) l)) (defun random-string (l n) (apply 'string (loop repeat n collect (randomth l)))) (defun kana-check () (interactive) (beginning-of-line) (while (not (eolp)) (let ((ch (save-excursion (previous-line) (char-after (point))))) (if (not (eq ch (char-after (point)))) (put-text-property (point) (+ 1 (point)) 'face 'trailing-whitespace))) (forward-char 1))) (defun kana-ret () (interactive) (kana-check) (insert "\n") (insert (random-string hiragana-list 32) "\n"))