Using inotify to add Plover Clippy suggestions into Emacs

| emacs

I don't have a lot of screen space on my laptop, so I don't usually have the Plover suggestion window open as I type. I came up with a Plover plugin to let me flash the last Plover Clippy suggestion as a temporary notification. It went by too quickly, though, so I wrote something that uses inotify to monitor the clippy.txt log and put it an Emacs buffer instead. It results in text like this:

Clippy -> KHREUP PEU; added -> ATD; have to -> STRO; I have -> SREU; to the -> TOT, TO*T; I had -> H*EU;
(defun my/clippy-last ()
  (let ((value (string-trim (shell-command-to-string "tail -1 ~/.config/plover/clippy.txt | cut -c 23-"))))
    (when (string-match "^\\(.*?\\)[ \t]+|| .*? -> \\(.+\\)" value)
      (cons (match-string 1 value) (match-string 2 value)))))

(defun my/clippy-show (&rest _)
  (interactive)
  (with-selected-window (get-buffer-window (get-buffer-create "*Clippy*"))
    (let ((last (my/clippy-last)))
      (goto-char (point-min))
      (insert (format "%s -> %s; " (car last) (cdr last))))))

(defvar my/clippy-monitor nil)
(defun my/clippy-toggle-monitor ()
  (interactive)
  (if (inotify-valid-p my/clippy-monitor)
      (progn
        (message "Turning off")
        (inotify-rm-watch my/clippy-monitor))
    (message "Turning on")
    (setq my/clippy-monitor
          (inotify-add-watch
           (expand-file-name "~/.config/plover/clippy.txt") 'modify
           #'my/clippy-show))))
This is part of my Emacs configuration.
View or add comments

2021-06-14 Emacs news

| emacs, emacs-news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Hacker News, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar and emacs-devel.

View or add comments

Weekly review: Week ending June 11, 2021

| review, weekly
  • We tweaked the kitchen layout and decluttered a few things.
  • Steno:
    • I practised some more with the metronome. I got a bit faster, but I think I still need to get the hang of hand position.
    • I modified my local version of typey-type to have the metronome running if selected in user settings.
    • I switched my Plover configuration to /dev/serial/by-id/usb-g_Heavy_Industries_Georgi-if02 so that I don't have to keep rescanning it.

Blog posts

Time

Category The other week % Last week % Diff % h/wk Diff h/wk
Unpaid work 3.2 9.3 6.0 15.5 10.1
Business 0.3 2.3 2.1 3.9 3.5
Personal 6.1 7.0 0.9 11.7 1.5
Discretionary - Social 0.0 0.2 0.2 0.3 0.3
Discretionary - Play 0.0 0.1 0.1 0.1 0.1
Discretionary - Productive 8.9 6.7 -2.3 11.2 -3.8
A- 47.0 43.6 -3.4 73.2 -5.7
Sleep 34.5 31.0 -3.6 52.0 -6.0
View or add comments

Monthly review: May 2021

| monthly, review
  • I got my first dose of the COVID-19 vaccine!
  • A- got interested in making friends at the playground. She usually found one or two kids to play with. She also started trying out the splash pad.
  • My Georgi keyboard finally arrived. I can slowly write journal entries on the couch. It will take me a long time before I can get fast enough to keep up with videos and presentations, but hey, a journey of a thousand miles and all that… I've also been learning how to modify Plover and write plugins. Yay Python!
  • The garden is starting to take off. I moved many seedlings outside and started more. We planted flowers, too.
  • We sold A-'s old bikes and bought her a 16" one. She had lots of fun biking with us.
  • I sewed dresses for A-.

Blog posts

Time

Category Previous month % This month % Diff % h/wk Diff h/wk
Discretionary - Productive 9.6 13.3 3.7 23.1 6.2
Unpaid work 3.4 5.4 2.0 9.4 3.4
Personal 5.3 6.6 1.4 11.5 2.3
Discretionary - Social 0.0 0.1 0.1 0.2 0.2
Discretionary - Family 0.0 0.0 0.0 0.1 0.1
Business 1.0 0.7 -0.3 1.1 -0.6
Discretionary - Play 0.7 0.1 -0.6 0.2 -1.0
Sleep 33.3 31.6 -1.7 54.9 -2.8
A- 46.7 42.1 -4.6 73.1 -7.7
View or add comments

2021-06-07 Emacs news

| emacs, emacs-news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Hacker News, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar and emacs-devel.

View or add comments

Weekly review: Week ending June 4, 2021

| review, weekly
  • Stenography:
    • I added letters to Kaoffie's steno font.
    • I figured out how to fix Spectra Lexer so that I can open it multiple times in Plover.
    • I added prefilling translations or outlines to Spectra's HTTP user interface.
  • Other:
    • I thought about helping A- with play skills.
    • I experimented with different bubble recipes. Adding guar gum managed to salvage the other recipe I tried.
    • We invited Tita Joy and her kids over for an outdoor playdate.

Blog posts

Sketches

Time

Category The other week % Last week % Diff % h/wk Diff h/wk
Sleep 30.6 34.5 3.9 58.0 6.6
A- 43.6 47.0 3.3 78.9 5.6
Personal 5.8 6.1 0.3 10.2 0.4
Business 0.4 0.3 -0.1 0.4 -0.2
Unpaid work 4.8 3.2 -1.5 5.4 -2.6
Discretionary - Productive 14.8 8.9 -5.9 15.0 -9.8

I was pretty tired this week because I took A- to playgrounds and played a lot with her and her friends. Good chance to catch up on sleep!

View or add comments

2021-05-31 Emacs news

| emacs, emacs-news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Hacker News, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar and emacs-devel.

View or add comments