Categories: sharing

RSS - Atom - Subscribe via email

Reading more blogs; Emacs Lisp: Listing blogs based on an OPML file

| emacs, blogging

Nudged by Dave Winer's post about old-school bloggers and my now-nicely-synchronizing setup of NetNewsWire (iOS) and FreshRSS (web), I gave Claude AI this prompt to list bloggers (with the addition of "Please include URLs and short bios.") and had fun going through the list it produced. A number of people were no longer blogging (unreachable sites or inactive blogs), but I found a few that I wanted to add to my feed reader.

Here is my people.opml at the moment (slightly redacted, as I read my husband's blog as well). This list has some non-old-school bloggers as well and some sketchnoters, but that's fine. It's a very tiny slice of the awesomeness of the Internet out there, definitely not exhaustive, just a start. I've been adding more by trawling through indieblog.page and the occasional interesting post on news.ycombinator.com.

It makes sense to make an HTML version to make it easier for people to explore, like those old-fashioned blog rolls. Ooh, maybe some kind of table like indieblog.page, listing a recent item from each blog. (I am totally not surprised about my tendency to self-nerd-snipe with some kind of Emacs thing.) This uses my-opml-table and my-rss-get-entries, which I have just added to my Emacs configuration.

my-opml-table
(defun my-opml-table (xml)
  (sort
   (mapcar
    (lambda (o)
      (let ((latest (car (condition-case nil (my-rss-get-entries (dom-attr o 'xmlUrl))
                           (error nil)))))
        (list
         (if latest
             (format-time-string "%Y-%m-%d" (plist-get latest :date))
           "")
         (org-link-make-string
          (or (dom-attr o 'htmlUrl)
              (dom-attr o 'xmlUrl))
          (replace-regexp-in-string " *|" "" (dom-attr o 'text)))
         (if latest
             (org-link-make-string
              (plist-get latest :url)
              (or (plist-get latest :title) "(untitled)"))
           ""))))
    (dom-search
     xml
     (lambda (o)
       (and
        (eq (dom-tag o) 'outline)
        (dom-attr o 'xmlUrl)
        (dom-attr o 'text)))))
   :key #'car
   :reverse t))

my-rss-get-entries: Return a list of the form ((:title … :url … :date …) …).
(defun my-rss-get-entries (url)
  "Return a list of the form ((:title ... :url ... :date ...) ...)."
  (with-current-buffer (url-retrieve-synchronously url)
    (set-buffer-multibyte t)
    (goto-char (point-min))
    (when (re-search-forward "<\\?xml\\|<rss" nil t)
      (goto-char (match-beginning 0))
      (sort
       (let* ((feed (xml-parse-region (point) (point-max)))
              (is-rss (> (length (xml-get-children (car feed) 'entry)) 0)))
         (if is-rss
             (mapcar
              (lambda (entry)
                (list
                 :url
                 (or
                  (xml-get-attribute
                   (car
                    (or
                     (seq-filter (lambda (x) (string= (xml-get-attribute x 'rel) "alternate"))
                                 (xml-get-children entry 'link))
                     (xml-get-children entry 'link)))
                   'href)
                  (dom-text (dom-by-tag entry 'guid)))
                 :title
                 (elt (car (xml-get-children entry 'title)) 2)
                 :date
                 (date-to-time (elt (car (xml-get-children entry 'updated)) 2))))
              (xml-get-children (car feed) 'entry))
           (mapcar (lambda (entry)
                     (list
                      :url
                      (or (caddr (car (xml-get-children entry 'link)))
                          (dom-text (dom-by-tag entry 'guid)))
                      :title
                      (caddr (car (xml-get-children entry 'title)))
                      :date
                      (date-to-time (elt (car (xml-get-children entry 'pubDate)) 2))))
                   (xml-get-children (car (xml-get-children (car feed) 'channel)) 'item))))
       :key (lambda (o) (plist-get o :date))
       :lessp #'time-less-p
       :reverse t))))

(my-opml-table (xml-parse-file "~/Downloads/people.opml"))
2025-03-19 Flutterby! Bug replicators
2025-03-19 kottke.org A History Professor Answers Questions About Dictators
2025-03-19 Dan's Daily Posting ahead
2025-03-19 Dave Winer (untitled)
2025-03-19 Doc Searls Come from Everywhere
2025-03-19 Jack Baty Fixing the terrible scrolling behavior with Logitech MX Master on macOS
2025-03-19 Jeremy Friesen Crocus
2025-03-19 Matt Maldre Does the word ‘fascinating’ come from ‘facet’?
2025-03-19 Matt Webb An appreciation for the Useless Machine
2025-03-19 Wil Wheaton I made a thing!
2025-03-19 Sketchy Ideas 10 Lessons from The Psychology of Money in Visuals
2025-03-18 Ava cool links VIII: open access and AI, oppression, euro cloud
2025-03-18 Jessica Smith Big Ideas for Little Philosophers
2025-03-18 Maria Popova How to Get Out of Your Own Way: John Berryman on Defeating the Three Demons of Creative Work
2025-03-18 Om Malik Goodbye Torque. Hello TeraFLOPS!
2025-03-18 Tim Bray Long Links
2025-03-18 Warren Ellis status, week of 18mar25
2025-03-18 Sketchnote Lab Real-World Sketching Workshop with Mike Rohde, coming Saturday, April 26, 2025!
2025-03-17 Matthew Haughey A marathon trip
2025-03-17 Michael Lopp The Product Engineer
2025-03-17 Pete Prodoehl Editing a Bear Theme
2025-03-17 Protesilaos Stavrou On the Stoic harmony with nature
2025-03-16 Abhijit's Sketchnotes Second jobs, pay cuts, glass bottles and Oscars
2025-03-16 Illustrated Life Loving a Bent Nib
2025-03-16 QAspire Consulting - Tanmay Vora Thriving in the Age of AI: Head, Hands, and Heart
2025-03-16 The Visual Drawer Motivation Isn't Magic: It's Structure!
2025-03-15 genehack.blog Weeknote #25 (20250309-20250315)
2025-03-15 Jeffrey Zeldman Your opt-innie wants to talk to your opt-outtie.
2025-03-15 oylenshpeegul Ruth
2025-03-15 Mike Monteiro How to hide a painting
2025-03-14 Henrik Karlsson King of the sea snakes
2025-03-14 Kevin Kelly Best Thing Since Sliced Bread?
2025-03-14 Andy Draws Planting Seeds of Kindness
2025-03-13 Chris Hannah I Challenged Myself to Build a Website Using Cursor
2025-03-13 Marie K. Ekeberg Pi Day 2025 - Let’s have fun with numbers!
2025-03-13 David’s Substack Sources For Graphic Nonfiction Online
2025-03-11 Manuel Uberti A sense of belonging
2025-03-10 Nicholas Carr Strong Men and Strong Machines
2025-03-09 kupajo Start With the End in Mind
2025-03-09 Penelope Trunk I hate having to earn money, but I like knowing what makes me valuable
2025-03-06 Clarity Canvas Weekly by Tanmay Vora Thriving in the Age of AI: Head, Hands, and Heart
2025-03-04 LetSketchin’s Newsletter #84 - What's your motivation to join this newsletter
2025-03-03 Keep the Creative Juices Flowing Have you ever had an UN-IDEA?
2025-03-02 but she's a girl… ZSA Voyager
2025-02-25 Rhys Lindmark 2025 Update
2025-02-24 Derek Sivers Why did I move to New Zealand?
2025-02-23 Scott McCloud New for Spring: The Cartoonists Club!
2025-02-07 James Endres Howell What can one person do?
2025-01-03 Anil Dash Understanding DOGE as Procurement Capture
2024-12-21 Arne Bahlo My favorite things of 2024
2024-12-11 The Sketchy Anthropologist Getting Started with Sketchnotes [2]: Eva Lotta-Lamm - Domestika Sketchnoting Course
2024-11-21 Avdi Grimm You’re not selling a solution
2024-11-08 Joi Ito Morning Thick Tea and Yuen
2024-01-15 Blaine Mooers Track daily writing progress by project in 2024 and 2025
2022-11-13 Howard Rheingold Compendium of Podcasts Featuring Howard

I'm rebuilding my feed list from scratch. I want to read more. I read the aggregated feeds at planet.emacslife.com every week as part of preparing Emacs News. Maybe I'll go over the list of blogs I aggregate there, widen it to include all posts instead of just Emacs-specific ones, and see what resonates. Emacs people tend to be interesting. Here is an incomplete list based on people who've posted in the past two years or so, based on this work-in-progress planetemacslife-expanded.opml. (I haven't tweaked all the URLs yet. I stopped at around 2023 and made the rest of the elements xoutline instead of outline so that my code would skip them.)

(my-opml-table (xml-parse-file "~/Downloads/planetemacslife-expanded.opml"))
2025-03-19 Irreal The Power Of Isearch
2025-03-19 James Dyer Ollama-Buddy 0.9.8: Transient Menu, Model Managing, GGUF Import, fabric Prompts and History Editing
2025-03-19 Emacs Redux Relative Line Numbers
2025-03-19 Jeremy Friesen Crocus
2025-03-19 Michal Sapka I stopped writing alt-text to most images here
2025-03-18 Lars Ingebrigtsen WoRdPrEsS ReWrItEs My PoStS
2025-03-18 William Denton Art is the imposition of form on experience
2025-03-18 Will Schenk Knowledge Navigator
2025-03-17 Listful Andrew Hash tables look better in Emacs 30
2025-03-17 Sacha Chua Org Mode: Merge top-level items in an item list
2025-03-17 Protesilaos Stavrou On the Stoic harmony with nature
2025-03-17 Marcin Borkowski Bash script and passwords
2025-03-17 Christian Tietze NSPopover in NSTextView With Links Is Broken: Accessibility Hierarchy Slowdown
2025-03-17 TAONAW Mode (untitled)
2025-03-17 John D. Cook Lessons Learned With the Z3 SAT/SMT Solver
2025-03-16 Grant Rettke Interesting new gptel v0.9.8 features and commits since v0.9.7
2025-03-16 Magnus Using lens-aeson to implement FromJSON
2025-03-16 200ok Atomize: A Simple CLI Tool for Managing Atom Feeds
2025-03-16 Aimé Bertrand Raycast - Activate Entra Role via PIM with Graph
2025-03-15 Tim Heaney Ruth
2025-03-15 Susam Pal MathB 1.3.0
2025-03-14 Bozhidar Batsov Updating my toolbox: Ghostty and Fish
2025-03-14 Matt Maguire Japanese Electronic Dictionary (Casio XD-G9850)
2025-03-13 Alvaro Ramirez Journelly open for beta
2025-03-13 Charles Choi Announcing Casual Make
2025-03-13 Marie K. Ekeberg Pi Day 2025 - Let’s have fun with numbers!
2025-03-11 Eric MacAdie 2025-03 Austin Emacs Meetup
2025-03-11 Manuel Uberti A sense of belonging
2025-03-10 Norm XML Resolver updates
2025-03-09 Andrey Listopadov Dynamic font-lock for Fennel
2025-03-08 Arthur A. Gleckler Backup Sampling
2025-03-08 Alex Popescu TIL Succinct Data Structures
2025-03-07 Kisaragi Hiu Plasma: Avoiding having to type the login password again when first using Git / GPG
2025-03-07 The Emacs Cat Using Emacs Org Mode for Reproducibility Testing
2025-03-06 Mickey Petersen Replacing tmux and GNU screen with Emacs
2025-03-05 Amit Patel Emacs Tree-sitter custom highlighting, part 3
2025-03-05 Kris Carta My Delivery Sheet
2025-03-05 Ben Simon G's Baltimore Adventure - The USS Torsk
2025-03-02 Thanos Apollo Emacs Note Taking & Journaling using org-gnosis [Video]​
2025-03-02 But She's a Girl ZSA Voyager
2025-02-28 Mario Jason Braganza 2025
2025-02-28 Gijs Hillenius The bathwater of our 21st century
2025-02-25 James Cherti Toggling symbol highlighting in Emacs with unique colors for each symbol using built-in functions
2025-02-24 Peter J. Jones Automatic Theme Switching in Emacs
2025-02-24 Benjamin Slade C-c-c-conjecturing, and dealing with recursion in Emacs (more excursus)
2025-02-23 Ruslan Bekenev Emacs: glasses-mode
2025-02-23 J.e.r.e.m.y B.r.y.a.n.t Emacs 30.1 released including which-key
2025-02-23 Vineet Naik Premature automation
2025-02-22 Rahul Juliato Compiling Emacs 30.1 from the source on Debian
2025-02-22 Mark Tomczak Running Sandstorm From a Raid 1 Drive Array
2025-02-22 whatacold Rewrite of a Flask Web App in Clojure
2025-02-22 localauthor Ežerų Dugne
2025-02-18 Peter Povinec Speed Dialing Your Favorite Files
2025-02-18 Rodrigo Morales Compile zathura 0.5.11 in Ubuntu 24.04 LTS
2025-02-17 William Gallard Hatch Don't Ossify Defaults
2025-02-13 Anand Tamariya Emacs Font is wider
2025-02-13 yuri tricys Etymology: From Cupidity to Romance And Roses
2025-02-12 Erik L. Arneson maybe: A command-line tool that succeeds sometimes
2025-02-12 Luke Plant Christ the True and Better Frodo
2025-02-12 Unwound Stack Peppering Passwords in Rust
2025-02-08 Tory Anderson snippets that defy orgmode tangling
2025-02-08 Chris Maiorana From Emacs To Microsoft Word (And Beyond, Really)
2025-02-08 Anything goes PiZero OTG: Host or Peripheral
2025-02-03 Meta Redux Projectile Introduces Significant Caching Improvements
2025-02-02 Gene Goykhman Quickly summing up the whole stack in Emacs Calc
2025-02-02 Bz01 Using spritely hoot on nixos
2025-02-01 Jack Baty FYI: I have a new blog and RSS feed
2025-01-29 Tony Zorman Speeding up LaTeX compilation
2025-01-26 Arialdo Martini Emacs: a peek under Imenu’s hood
2025-01-25 Yi Tang Setup ssh-agent Systemd Service for Emacs
2025-01-23 punchagan Some useful Git configuration for Windows
2025-01-14 Srijan Choudhary 2025-01-15-001
2025-01-10 Isa Mert Gurbuz .emacs.d/.init.el
2025-01-07 Stefan van der Walt Pomodoros with org-timer
2025-01-03 Wai Hon Distinguish Repeated Tasks in Org Agenda
2025-01-01 Karthik Chikmagalur Tool use with gptel: looking for testers!
2024-12-21 Arne Bahlo My favorite things of 2024
2024-12-18 Maryanne Wachter Why is multithreading Selenium lousy on MacOS?
2024-12-13 Lambda Land What's New in Emacs: Last Decade Edition
2024-12-06 Jean-Christophe Helary Building "vanilla" emacs on macOS, with MacPorts, and more…
2024-11-21 JD Gonzales Kamal Tip - Private Network only Database Server
2024-11-15 Jonathan Lamothe Organizing My Life with org-mode
2024-11-14 Hristos N. Triantafillou Void Linux On A Framework Laptop: Two Years Later
2024-11-14 Hanno git-annex: Managing my most ancient data
2024-11-07 Ryan Rix Two Updates: Org+Nix dev streams, and my new DNS resolver
2024-11-03 Emacs Notes Enable completions for `Font Family’ field in `M-x customize-face RET’
2024-11-02 Ben Whitley Denote Project Tasks
2024-10-27 Andrea A useful function to contribute to Scala Metals lsp server with Emacs
2024-10-24 Summer Emacs ERC Flipping Buffers
2024-10-03 Jiewawa Useful Emacs commands for reading
2024-09-11 Sanel Zukan evil-mode in terminal without Alt/Meta
2024-09-08 Troy Hinckley What is the best pointer tagging method?
2024-08-16 Wiktor Gołgowski Org-roam: custom linking during capture
2024-08-14 Jonas Bernoulli Forge 0.4.0 and 0.4.1 released
2024-08-11 Nicolas Martyanoff Controlling link opening in Emacs
2024-07-31 T. V. Raman Emacspeak — A Speech Odyssey
2024-07-30 jao eww to org
2024-07-27 Peter Tillemans Refactoring Emacs Config using Org
2024-07-07 Timo Geusch If you get this error from Time Machine on Samba, check available disk space
2024-06-23 Peter Vágner Emacs A11y Tip #3: Emacs with speechd-el running on Termux for Android
2024-06-05 Zachary Kanfer Less: a Survival Guide
2024-05-23 Jürgen Hötzel Gnome Search Provider: Emacs Integration
2024-05-22 Gretzuni B/logroll
2024-05-14 Bryan Murdock How To Retroactively Annex Files Already in a Git Repo
2024-05-02 Evan Moses Home Assistant: using target in blueprints
2024-04-11 Emacs TIL The Night Before A Coding Interview
2024-03-26 M. Rincón Eat Evil
2024-02-12 Cameron Desautels Chinese Zodiac Time for Emacs
2024-01-19 Corwin Brust Emacs 29.2 Windows Binaries
2023-12-10 Alex Bennée A Systems Programmer's Perspectives on Generative AI
2023-12-09 Peter Prevos Writing Prose with Emacs
2023-12-05 Thomas Fitzsimmons Product Idea: CRT-alike OLED driver
2023-10-21 What the .emacs.d!? buffers.el-01
2023-08-16 Murilo Pereira I just made my first $1 on the internet!
2023-08-07 Phil Newton Updated Pocket highlights bookmarklet
2023-08-06 Shae Erisson How to use Private Storage on Android
2023-07-18 Phil Jackson Using Djblue's portal for tap in Babashka
2023-06-29 Jiacai Liu Embed git commit in Zig programs
2023-05-21 Fritz Grabo Introducing elfeed-webkit
2023-05-01 Tyler Smith Posts

Making this table was fun. It's nice to see a lot of people also writing and learning out loud. This reminded me a little of EmacsConf - 2020 - talks - Sharing blogs (and more) with org-webring. TODO: Could be fun to have a blogroll page again.

I notice I tend to like:

  • posts about adapting technology to personal interests, more than posts about the industry or generalizations
  • detailed posts about things I'm currently interested in (Emacs, personal knowledge management, some Javascript), more than detailed tech posts about things I've decided not to get into at the moment
  • "I" posts more than "You" posts: personal reflections rather than didactic advice
  • curiosity, fun, experimentation

Looking forward to discovering more!

Related:

See discussion on Mastodon

View org source for this post

Playing with sketching again

| art, drawing

After our first informal field trip to the Art Gallery of Ontario, I got my own 13" iPad Air so that I can play with digital painting beside A+. Using the same apps might make it easier for her to pick up ideas from me and for me to pick up ideas from her. We mostly draw in Procreate, and I'm starting to get the hang of its brushes and features.

It's been nice doing moments from daily life again. It's been a while since I got to play with colour this easily.

A+ and I are both interested in piano, singing, and drawing, so we're experimenting with the Simply family subscription (CAD 46.49+tax/month). A+ likes to draw in the evening as a way of postponing bedtime. I could probably find lots of free drawing tutorials like the ones that Simply Draw has, but it's nice that it's already set up with the video in a corner and it pauses at the appropriate steps, so A+ can independently do it. She's starting to see shapes and shade a bit better now, although she doesn't yet have the patience to blend things slowly. I'm developing that patience, yay me. I wish I could zoom in on the reference image, though.

Here are some drawings I made following the Simply Draw tutorials.

One of the things I like about digital drawing and painting is that I can sneak up on blending by using different opacity settings and colours instead of either accurately controlling the pressure in my hand or switching between pencil and eraser. I also love the way I can use layers to build up an image gradually, how I can erase or undo, and how I can just use whatever colour I want without having to hunt for the right colour pencils or put things away afterwards. I haven't really played around with drawing with art supplies, although the watercolour tutorials that cross my feed seem fascinating. Maybe someday.

There's a glimmer here of how this might become a relaxing thing to do, different from untangling a thought or condensing a book into a sketchnote. I'm slowly getting to the point where, when I notice I'm starting to get anxious or when I'm tempted to nag A+ about procrastination, I can tell myself that I'm going on an art/music break instead and that usually keeps me busy enough until the urge passes. I think this might be useful for our sanity, especially if A+ picks up the idea too. When I'm on a music break, she often gets inspired to kick me off the piano and do her own music lessons, so that's a win. Art is something we can do side by side, and I can always make a drawing more elaborate since A+ likes to stay at roughly the same stage as I am.

I remember enjoying art enough as a kid to have fun at a summer camp where we did things like sand art and papier mache. I think I worked on an illustration of a sparrow that made it into a book of poetry or something like that. By the time we got to drafting classes in high school, I was feeling a bit more meh about art. I got back into art again with the Colors app on the Nintendo DS and then ended up getting into drawing and sketchnoting. I'd like to play around more with colour, and maybe I'll do more doodles and more drawing just because. I like drawing nature, and I'd like to get better at drawing characters too. I'll put the sketches on my blog and in my online sketches, and it'll fun to see how I grow over time.

View org source for this post

Sketching practice: Beaver, goose, squirrel, sparrow, flower, sheepdog and sheep

| drawing, art

A+'s class is working through a variety of assignments while reading through The Wild Robot. They've done chapter 1-11 so far. One of the assignments is to visualize things from the book, like sketching 6 things Roz has seen in nature so far. I figured I'd practise drawing too.

References:

A+ thought that Roz encountered a beaver, but I think she might have mixed it up with the otters. It was fun to draw a beaver anyway. I'm getting the hang of blocking out the shapes with a highlighter and then going over it with the pen.

The sheepdog wasn't from the story. It's from another reflection that I've been noodling on about how A+'s teacher often tries to herd 17 kids to be on the same literal page during virtual class. It's a hard job.

Learning about sheepdogs sent me on this fun tangent

A tangent on herding dogs: heelers (Heelers! Like Bluey!) nip at the heels; headers stare down the animals with a strong eye; some breeds use both methods and also run along the backs of the sheep; some are moderate to loose-eyed; some use barks; some are tending dogs who fence the sheep in. Fascinating. This Reddit thread is interesting too. And sheepdog training tips sound surprisingly relevant, like the importance of figuring out what distance the dog is ready to work at (which is not always the same as the distance the dog thinks they are ready to work at). Sometimes I'm the shepherd, sometimes I'm the sheepdog, sometimes I'm the sheep I want to herd.

As for A+ and art, she still gets very frustrated. "I can't do it!" she wails. But she's starting to be able to say things like "I see there's a circle here." I think it might be helpful for me to borrow a bunch of drawing books that emphasize sketching on top of basic shapes, instead of those drawing videos that just tell you the lines and curves to draw. Maybe Ed Emberley's drawing books. It might also be interesting to look through some digital art tutorials and tips, like this thread on the Procreate forum (oooh, monsters with eyes). Getting even more tempted to get an iPad for myself so that we can learn side by side. I've tried drawing on Android tablets/phablets before and Medibang Paint was pretty nice, but one of my goals is making it easier to bounce ideas and discoveries off each other.

Could be fun.

View org source for this post

Through blogging, we discover our thoughts and other people

| connecting, blogging, writing
Text and links from sketch

Through blogging, we discover our thoughts and other people.

Henrik Karlsson's "Advice for a friend who wants to start a blog" nudged me to explore two threads of thought:

Writing helps you refine your thoughts:

  • This reminds me of Sonke Ahrens's How to Take Smart Notes and David Bessis's Mathematica.
    • Everything drives toward writing; writing is how to clarify your thoughts
    • Writing helps you improve your intuition, which feeds your writing.
  • I want to understand:
    • What's possible?
    • What's easier? what's harder (for now?)
    • How can we make things. easier? How can we make more things doable?
  • and also:
    • What am I thinking?
    • what do I want to try?
  • I want to get better at this through practice.

Writing helps you find your tribe:

  • Definitely - and the more idiosyncratic my posts are, the more amazing it is when someone resonates with it, even years later.
  • (I was amused to see him trace his tweet's flow through Stian Håklev, who reached out for a conversation in 2010 about peer-to-peer education because he read my blog.)
  • I deliberately boost my tribe's information flow:
  • I want to get better at this by
    • following my curiosity
    • improving search and serendipity
    • connecting people & ideas with community infrastructure and resources

Both sides: Because it's fun and leads to more awesomeness.

View org source for this post

Hyperlinking SVGs

| drawing, supernote, emacs
Text and links from sketch

Hyperlinking SVGs - 2025-01-17-01

I like drawing my notes. I can jump around, draw connections, doodle for fun.

A sketch can only fit so much, though. (even if I write really small)

Idea: Links: They can be signposts for other trails.

Process:

I want to make maps for myself and other people.

This is easy to do because:

  • SVGs are XML, a text format
  • Emacs has code for XML and SVG manipulation, display
  • You can use Emacs to build a simple user interface.
  • Ideas
  • TO-DO: update sketch viewer
    • prioritize SVG
    • display Org

SuperNote also has its own hyperlinks, but:

  • typing long URLS on on-screen keyboards is not fun
  • I can't figure out how to convert those links to SVG
  • Rects are more compact

Preprocessing the image

This isn't the focus of this blog post, but I thought I'd include the code anyway in case someone might find it useful.

The fastest way to get a single file off the Supernote is to enable Browse & Access by swiping down from the top. It's the icon that looks like a two-way arrow between waves.

2025-01-21_10-28-16.png
Figure 1: Browse and Access

I have some Emacs Lisp code for downloading the latest exported file using the Supernote's web server.

my-supernote-get-exported-files
(defvar my-supernote-ip-address "192.168.1.221")
(defun my-supernote-get-exported-files ()
  (condition-case nil
      (let ((data (plz 'get (format "http://%s:8089/EXPORT" my-supernote-ip-address)))
            (list))
        (when (string-match "const json = '\\(.*\\)'" data)
          (sort
           (alist-get 'fileList (json-parse-string (match-string 1 data) :object-type 'alist :array-type 'list))
           :key (lambda (o) (alist-get 'date o))
           :lessp 'string<
           :reverse t)))
    (error nil)))

my-supernote-download-latest-exported-file: Save exported file in downloads dir.
(defun my-sketch-insert-latest-doodle ()
  (interactive)
  (let* ((file (my-latest-sketch)))
    (insert
     (format
      "#+begin_right-doodle
#+ATTR_HTML: :title
%s
#+end_right-doodle"
      (org-link-make-string (concat "file:" file))))))

(defun my-supernote-download-latest-exported-file ()
  "Save exported file in downloads dir."
  (interactive)
  (let* ((info (car (my-supernote-get-exported-files)))
         (dest-dir my-download-dir)
         (new-file (and info (expand-file-name (file-name-nondirectory (alist-get 'name info)) dest-dir)))
         renamed)
    (when info
      (copy-file
       (plz 'get (format "http://%s:8089%s" my-supernote-ip-address
                         (alist-get 'uri info))
         :as 'file)
       new-file
       t)
      new-file)))

Once I've downloaded the file, I process it:

  1. my-image-recognize: use Google Cloud Vision to recognize the text, rename it based on the ID
  2. my-sketch-rename: rename the file based on the ID if I've written one on the sketch
  3. my-sketch-convert-pdf: convert to SVG, copying over the links from the previous SVG if one exists
  4. my-sketch-clean: remove any images or templates
  5. my-sketch-color-to-hex: change the hex values for easier replacement and tinkering
  6. my-sketch-add-bg: add a plain white background rectangle
  7. my-sketch-change-fill-to-style: make the attributes more consistent
  8. my-sketch-recolor: change the highlight colour from gray to light yellow
  9. my-image-store: store it in either my private-sketches directory or my sketches directory, depending on the tags in the filename; leave untitled sketches in the same directory

my-supernote-process-sketch
(defun my-supernote-process-sketch (file)
  (interactive "FFile: ")
  (my-image-recognize file)
  (setq file (my-sketch-rename file))
  (pcase (file-name-extension file)
    ((or "svg" "pdf")
     (setq file
           (my-image-store
            (my-sketch-svg-prepare file))))
    ((or "png" "jpg" "jpeg")
     (setq file
           (my-image-store
            (my-image-autorotate
             (my-image-autocrop
              (my-sketch-recolor-png
               file)))))))
  file)

my-sketch-svg-prepare: Clean up SVG for publishing.
(defvar my-debug-buffer (get-buffer-create "*temp*"))
(defun my-sketch-convert-pdf (pdf-file)
  "Returns the SVG filename."
  (interactive "FPDF: ")
  (if-let ((links (and (file-exists-p (concat (file-name-sans-extension pdf-file) ".svg"))
                       (dom-by-tag
                        (car (xml-parse-file (concat (file-name-sans-extension pdf-file) ".svg")))
                        'a))))
      ;; copy links over
      (let ((temp-file (concat (make-temp-name "svg-conversion") ".svg"))
            new-file)
        (unwind-protect
            (progn
              (call-process "pdftocairo" nil my-debug-buffer nil "-svg" (expand-file-name pdf-file)
                            temp-file)
              (setq new-file (car (xml-parse-file temp-file)))
              (dolist (link links)
                (dom-append-child new-file link))
              (with-temp-file (file-exists-p (concat (file-name-sans-extension pdf-file) ".svg"))
                (svg-print new-file)))
          (error
           (delete-file temp-file))))
    (delete-file (concat (file-name-sans-extension pdf-file) ".svg"))
    (call-process "pdftocairo" nil my-debug-buffer nil "-svg" (expand-file-name pdf-file)
                  (expand-file-name (concat (file-name-sans-extension pdf-file) ".svg"))))
  (concat (file-name-sans-extension pdf-file) ".svg"))

(defun my-sketch-change-fill-to-style (dom)
  "Inkscape handles these better when we split paths."
  (dolist (path (dom-by-tag dom 'path))
    (when (dom-attr path 'fill)
      (dom-set-attribute
       path 'style
       (if (dom-attr path 'style)
           (concat (dom-attr path 'style) ";fill:" (dom-attr path 'fill))
         (concat "fill:" (dom-attr path 'fill))))
      (dom-remove-attribute path 'fill)))
  dom)

(defun my-sketch-recolor (dom color-map &optional selector)
  "Colors are specified as ((\"#input\" . \"#output\") ...)."
  (if (symbolp color-map)
      (setq color-map
            (assoc-default color-map my-sketch-color-map)))
  (let ((map-re (regexp-opt (mapcar 'car color-map))))
    (dolist (path (if selector (dom-search dom selector)
                    (dom-by-tag dom 'path)))
      (dolist (attr '(style fill))
        (when (and (dom-attr path attr)
                   (string-match map-re (dom-attr path attr)))
          (dom-set-attribute
           path attr
           (replace-regexp-in-string
            map-re
            (lambda (match)
              (assoc-default match color-map))
            (or (dom-attr path attr) "")))))))
  dom)

(defun my-sketch-add-bg (dom)
  ;; add background rectangle
  (unless (dom-search dom (lambda (elem) (and (dom-attr elem 'class) (string-match "\\<background\\>" (dom-attr elem 'class)))))
    (let* ((view-box (mapcar 'string-to-number (split-string (dom-attr dom 'viewBox))))
           (bg-node (dom-node 'rect `((x . 0)
                                      (y . 0)
                                      (class . "background")
                                      (width . ,(elt view-box 2))
                                      (height . ,(elt view-box 3))
                                      (fill . "#ffffff")))))
      (if (dom-by-id dom "surface1")
          (push bg-node (cddr (car (dom-by-id dom "surface1"))))
        (push bg-node (cddr (car dom))))))
  dom)

(defun my-sketch-clean (dom)
  "Remove USE and IMAGE tags."
  (dolist (use (dom-by-tag dom 'use))
    (dom-remove-node dom use))
  (dolist (use (dom-by-tag dom 'image))
    (dom-remove-node dom use))
  dom)

(defun my-sketch-rotate (dom)
  (let* ((old-width (dom-attr dom 'width))
         (old-height (dom-attr dom 'height))
         (view-box (mapcar 'string-to-number (split-string (dom-attr dom 'viewBox))))
         (rotate (format "rotate(90) translate(0 %s)" (- (elt view-box 3)))))
    (dom-set-attribute dom 'width old-height)
    (dom-set-attribute dom 'height old-width)
    (dom-set-attribute dom 'viewBox (format "0 0 %d %d" (elt view-box 3) (elt view-box 2)))
    (dolist (g (dom-by-tag dom 'g))
      (dom-set-attribute g 'transform rotate)))
  dom)

(defun my-sketch-mix-blend-mode-darken (dom &optional selector)
  (dolist (p (if (functionp selector) (dom-search dom selector) (or selector (dom-by-tag dom 'path))))
    (when (and (dom-attr p 'style)
               (not (string-match "mix-blend-mode" (dom-attr p 'style))))
      (dom-set-attribute
       p 'style
       (replace-regexp-in-string ";;\\|^;" ""
                                 (concat
                                  (or (dom-attr p 'style) "")
                                  ";mix-blend-mode:darken")))))
  dom)

(defun my-sketch-color-to-hex (dom &optional selector)
  (dolist (p (if (functionp selector) (dom-search dom selector)
               (or selector (dom-search dom
                                        (lambda (p) (or (dom-attr p 'style)
                                                        (dom-attr p 'fill)))))))
    (dolist (attr '(style fill))
      (when (dom-attr p attr)
        (dom-set-attribute
         p attr
         (replace-regexp-in-string
          "rgb(\\([0-9\\.]+\\)%, *\\([0-9\\.%]+\\)%, *\\([0-9\\.]+\\)%)"
          (lambda (s)
            (color-rgb-to-hex
             (* 0.01 (string-to-number (match-string 1 s)))
             (* 0.01 (string-to-number (match-string 2 s)))
             (* 0.01 (string-to-number (match-string 3 s)))
             2))
          (dom-attr p attr))))))
  dom)

;; default for now, but will support more colour schemes someday
(defvar my-sketch-color-map
  '((blue
     ("#9d9d9d" . "#2b64a9")
     ("#9c9c9c" . "#2b64a9")
     ("#c9c9c9" . "#b3e3f1")
     ("#c8c8c8" . "#b3e3f1")
     ("#cacaca" . "#b3e3f1")
     ("#a6d2ff" . "#ffffff"))
    (t
     ("#9d9d9d" . "#888888")
     ("#9c9c9c" . "#888888")
     ("#cacaca" . "#f6f396")
     ("#c8c8c8" . "#f6f396")
     ("#a6d2ff" . "#ffffff")
     ("#c9c9c9" . "#f6f396"))))

(cl-defun my-sketch-svg-prepare (file &key color-map color-scheme new-file)
  "Clean up SVG for publishing."
  (when (string= (file-name-extension file) "pdf")
    (setq file (my-sketch-convert-pdf file)))
  (let ((dom (xml-parse-file file)))
    (setq dom (my-sketch-clean dom))
    (setq dom (my-sketch-color-to-hex dom))
    (setq dom (my-sketch-add-bg dom))
    (setq dom (my-sketch-change-fill-to-style dom))
    (setq dom (my-sketch-recolor dom
                                 (or color-map
                                     color-scheme
                                     t)))
    (with-temp-file (or new-file file) (svg-print (car dom)))
    (or new-file file)))

Editing and linking text

I've started keeping the text of the sketch in the same directory so that I can someday have full-text search for images. I have a keyboard shortcut for jumping to the text file. I like to open it in Org Mode.

my-org-sketch-open-text-file
(defun my-org-sketch-open-text-file (sketch)
  (interactive (list (my-complete-sketch-filename)))
  (find-file (concat (file-name-sans-extension sketch) ".txt"))
  (with-current-buffer (find-file-noselect sketch)
    (display-buffer-in-side-window
     (current-buffer)
     '((window-width . 0.5)
       (side . right)))))

The raw text from Google Cloud Vision is reasonably accurate but jumbled. I can move lines around with M-S-up and M-S-down in Org (org-shiftmetaup and org-shiftmetadown), which drag lines around. Once I add newlines, I can reorganize paragraphs with M-up and M-down (org-metaup and org-metadown). I can move list elements with M-S-right and M-S-left. (Idea: Avy probably has some awesome line-management functions I could get the hang of using.)

Once I've reorganized and cleaned up the text, I add links. Between my consult-omni shortcut and the new bookmarks I'm trying out (I should make a post about that), it's pretty easy.

Prompting for rectangles

Then it's a quick trip to Inkscape to draw rectangles over the things I want to link. It's easy to see where to draw the links because Org Mode highlights the links in the text. The style of the rectangles doesn't matter. After I save the SVG, I hop back into Emacs to turn them into links. This is the fun new part I just added.

Linkify rects

I like this because I got to reuse some code I'd written before to identify and reorder paths for easier animation of SVG topic maps. Using the links I defined in the previous step, all I needed to do was go through the rects (excluding the background rectangle) and offer completing-read on the titles and URLs. Then I createed the link elements and restyled the rectangles.

my-svg-linkify-rects
(defun my-svg-display (buffer-name svg &optional highlight-id full-window)
  "HIGHLIGHT-ID is a string ID or a node."
  (with-current-buffer (get-buffer-create buffer-name)
    (when highlight-id
      ;; make a copy
      (setq svg (with-temp-buffer (svg-print svg) (car (xml-parse-region (point-min) (point-max)))))
      (if-let* ((path (if (stringp highlight-id) (dom-by-id svg highlight-id) highlight-id))
                (view-box (split-string (dom-attr svg 'viewBox)))
                (box (my-svg-bounding-box path))
                (parent (car path)))
          (progn
            ;; find parents for possible rotation
            (while (and parent (not (dom-attr parent 'transform)))
              (setq parent (dom-parent svg parent)))
            (dom-set-attribute path 'style
                               (concat (dom-attr path 'style) "; stroke: 1px red; fill: #ff0000 !important"))
            ;; add a crosshair
            (dom-append-child
             (or parent svg)
             (dom-node 'path
                       `((d .
                            ,(format "M %f,0 V %s M %f,0 V %s M 0,%f H %s M 0,%f H %s"
                                     (elt box 0)
                                     (elt view-box 3)
                                     (elt box 2)
                                     (elt view-box 3)
                                     (elt box 1)
                                     (elt view-box 2)
                                     (elt box 3)
                                     (elt view-box 2)))
                         (stroke-dasharray . "5,5")
                         (style . "fill:none;stroke:gray;stroke-width:3px")))))
        (error "Could not find %s" highlight-id)))
    (let* ((inhibit-read-only t)
           (image (svg-image svg))
           (edges (window-inside-pixel-edges (get-buffer-window))))
      (erase-buffer)
      (if full-window
          (progn
            (delete-other-windows)
            (switch-to-buffer (current-buffer)))
        (display-buffer (current-buffer)))
      (insert-image (append image
                            (list :max-width
                                  (floor (* 0.8 (- (nth 2 edges) (nth 0 edges))))
                                  :max-height
                                  (floor (* 0.8 (- (nth 3 edges) (nth 1 edges)))) )))
      ;; (my-svg-resize-with-window (selected-window))
      ;; (add-hook 'window-state-change-functions #'my-svg-resize-with-window t)
      (current-buffer))))

(cl-defun my-svg-identify-paths (filename &key selector node-func dom)
  "Prompt for IDs for each path in FILENAME."
  (interactive (list (read-file-name "SVG: " nil nil
                                     (lambda (f)
                                       (or (string-match "\\.svg$" f)
                                           (file-directory-p f))))))
  (let* ((dom (or dom (car (xml-parse-file filename))))
         (paths (if (functionp selector)
                    (dom-search dom selector)
                  (or selector
                      (dom-by-tag dom 'path))))
         (vertico-count 3)
         (ids (seq-keep (lambda (path)
                          (and (dom-attr path 'id)
                               (unless (string-match "\\(path\\|rect\\)[0-9]+"
                                                     (or (dom-attr path 'id) "path0"))
                                 (dom-attr path 'id))))
                        paths))
         (edges (window-inside-pixel-edges (get-buffer-window)))
         id)
    (my-svg-display "*image*" dom nil t)
    (dolist (path paths)
      ;; display the image with an outline
      (unwind-protect
          (progn
            (my-svg-display "*image*" dom (dom-attr path 'id) t)
            (if (functionp node-func)
                (funcall node-func path dom)
              (setq id (completing-read
                        (format "ID (%s): " (dom-attr path 'id))
                        ids))
              ;; already exists, merge with existing element
              (if-let* ((old (dom-by-id dom id)))
                  (progn
                    (dom-set-attribute
                     old
                     'd
                     (concat (dom-attr (dom-by-id dom id) 'd)
                             " "
                             ;; change relative to absolute
                             (replace-regexp-in-string "^m" "M"
                                                       (dom-attr path 'd))))
                    (dom-remove-node dom path)
                    (setq id nil))
                (dom-set-attribute path 'id id)
                (add-to-list 'ids id)))))
      ;; save the image just in case we get interrupted halfway through
      (with-temp-file filename
        (svg-print dom)))))

(defun my-svg-identify-rects (filename)
  (interactive (list (read-file-name "SVG: " nil nil
                                     (lambda (f)
                                       (or (string-match "\\.svg$" f)
                                           (file-directory-p f))))))
  (my-svg-identify-paths
   filename
   :selector
   (lambda (elem)
     (and (eq (dom-tag elem) 'rect)
          (not (and (dom-attr elem 'class)
                    (string-match "\\<background\\>" (dom-attr elem 'class))))))))

(defun my-org-links-from-file (filename)
  "Return a list of (description . link) of the Org links in FILENAME."
  (when (file-exists-p filename)
    (let (results)
      (with-temp-buffer
        (insert-file-contents filename)
        (goto-char (point-min))
        (while (re-search-forward org-link-any-re nil t)
          (push (cons (match-string-no-properties 3)
                      (or (match-string-no-properties 2)
                          (match-string-no-properties 0)))
                results)))
      (reverse results))))

(defun my-svg-linkify-rects (filename)
  (interactive (list (read-file-name "SVG: " nil nil
                                     (lambda (f)
                                       (or (string-match "\\.svg$" f)
                                           (file-directory-p f))))))
  (let ((dom (car (xml-parse-file filename)))
        (links-from-text (my-org-links-from-file (concat (file-name-sans-extension filename) ".txt"))))
    (my-svg-identify-paths
     filename
     :dom
     dom
     :selector
     (append
      ;; not yet linked
      (dom-search dom
                  (lambda (elem)
                    (and (eq (dom-tag elem) 'rect)
                         (not (and (dom-attr elem 'class)
                                   (string-match "\\<background\\|link-rect\\>" (dom-attr elem 'class)))))))
      ;; linked
      (dom-search dom
                  (lambda (elem)
                    (and (eq (dom-tag elem) 'rect)
                         (string-match "\\<link-rect\\>" (or (dom-attr elem 'class) ""))))))

     :node-func
     (lambda (elem dom)
       (let* ((current-link-node (my-dom-closest dom elem 'a))
              (current-title-node (or (dom-by-tag elem 'title)
                                      (dom-by-tag current-link-node 'title)))
              (title (string-trim
                      (completing-read
                      "Title: "
                      (mapcar 'car links-from-text)
                      nil nil
                      (dom-text current-title-node))))
              (link (string-trim
                     (read-string
                       "URL: "
                       (or (dom-attr current-link-node 'href)
                           (assoc-default title links-from-text 'string=)))
                     )))
         (cond
          ((and current-link-node (not (string= link "")))
           (dom-set-attribute elem
                              'style
                              "stroke: blue; stroke-dasharray: 4; fill: #006fff; fill-opacity: 0.25")
           (dom-set-attribute current-link-node 'href link))
          ((and current-link-node (string= link ""))
           (dom-add-child-before
            (dom-parent dom current-link-node)
            elem)
           (dom-remove-node current-link-node))
          ((and (null current-link-node) (not (string= link "")))
           (setq current-link-node (dom-node
                                    'a
                                    `((href . ,link)
                                      (class . "link"))))
           (dom-add-child-before (dom-parent dom elem) current-link-node elem)
           (dom-remove-node dom elem)
           (dom-append-child current-link-node elem)
           (dom-remove-attribute elem 'fill)
           (dom-set-attribute elem
                              'style
                              "stroke: blue; stroke-dasharray: 4; fill: #006fff; fill-opacity: 0.25")
           (dom-set-attribute
            elem
            'class
            (if (dom-attr elem 'class)
                (concat (dom-attr elem 'class) " link-rect")
              "link-rect"))))
         (cond
          ((and (string= title "") current-title-node)
           (dom-remove-node current-title-node))
          ((and (not (string= title "")) (not current-title-node))
           (dom-append-child current-link-node (dom-node 'title nil title)))
          ((and (not (string= title "")) current-title-node)
           (setf (car (dom-children current-title-node))
                 title))))))))

(defun my-svg-update-links-from-text (filename)
  (interactive (list (read-file-name
                      "SVG: " nil
                      (if (file-exists-p (concat (file-name-sans-extension (buffer-file-name)) ".svg"))
                          (concat (file-name-sans-extension (buffer-file-name)) ".svg")
                        (cdr (my-embark-image)))
                      (lambda (f)
                        (or (string-match "\\.svg$" f)
                            (file-directory-p f))))))
  (let ((dom (car (xml-parse-file filename)))
        (links-from-text (my-org-links-from-file (concat (file-name-sans-extension filename) ".txt"))))
    (dolist (link (dom-by-tag dom 'a))
      (when (and
             (assoc-default (dom-text (dom-by-tag link 'title))
                            links-from-text)
             (not (string=
                   (dom-attr link 'href)
                   (assoc-default (dom-text (dom-by-tag link 'title))
                                  links-from-text))))
        (dom-set-attribute
         link
         'href
         (assoc-default (dom-text (dom-by-tag link 'title))
                        links-from-text))))
    (with-temp-file filename
      (svg-print dom))))



Writing about the sketch

I tweaked my function for drafting a blog post about a sketch. I added panning and zooming capabilities using Javascript, included the sketch text, and added any sections that I referred to using anchors. (TODO: Come to think of it, I should rewrite those to be absolute links using the permalink so that they'll still make sense even if people bookmark them from the main page of my blog.)

my-write-about-sketch
(defun my-insert-sketch-and-text (sketch)
  (interactive (list (my-complete-sketch-filename)))
  (insert
   (if (string= (file-name-extension sketch) "svg")
       (format
        "#+begin_panzoom\n%s\n#+end_panzoom\n\n"
        (org-link-make-string (concat "file:" sketch)))
     (concat (org-link-make-string (concat "sketchFull:" (file-name-base sketch))) "\n\n")))
  (let ((links (my-org-links-from-file (concat (file-name-sans-extension sketch) ".txt")))
        (subheading-level (1+ (org-current-level))))
    (insert (if links
                "#+begin_my_details Text and links from sketch\n"
              "#+begin_my_details Text from sketch\n"))
    (my-sketch-insert-text sketch)
    (unless (bolp) (insert "\n"))
    (insert "#+end_my_details")
    (dolist (section (seq-filter (lambda (entry) (string-match "^#" (cdr entry)))
                                 links))
      (org-end-of-subtree)
      (insert "\n\n")
      (org-insert-heading nil nil subheading-level)
      (insert (car section))
      (org-entry-put (point) "CUSTOM_ID" (substring (cdr section) 1)))))

(defun my-write-about-sketch (sketch)
  (interactive (list (my-complete-sketch-filename)))
  ;(shell-command "make-sketch-thumbnails")
  (find-file "~/sync/orgzly/posts.org")
  (goto-char (point-min))
  (unless (org-at-heading-p) (outline-next-heading))
  (org-insert-heading nil nil t)
  (insert (file-name-base sketch) "\n\n")
  (my-insert-sketch-and-text sketch)
  (insert "\nFeel free to use this under the [[https://creativecommons.org/licenses/by/4.0/][Creative Commons Attribution License]].\n")
  (delete-other-windows)
  (save-excursion
    (with-selected-window (split-window-horizontally)
      (find-file sketch))))

And then I can export the image as an inline SVGs in Org Mode HTML and Markdown exports, yay!

Other functions not included above are probably somewhere in my Emacs config.

Using an SVG as a sticky table of contents

… and now I can make the image a sticky table of contents as you scroll down, by wrapping it in something like this:

#+begin_sticky-toc-after-scrolling
#+begin_panzoom
file:/home/sacha/sync/sketches/2025-01-17-01 Hyperlinking SVGs -- drawing supernote inkscape svg.svg
#+end_panzoom
#+end_sticky-toc-after-scrolling

Mwahahaha! (Now I just need to make it highlight different sections as we scroll…)

Here's the snippet from my misc.js:

Sticky table of contents after scrolling
function stickyTocAfterScrolling() {
  const elements = document.querySelectorAll('.sticky-toc-after-scrolling');
  let lastScroll = window.scrollY;
  const cloneMap = new WeakMap();

  elements.forEach(element => {
    const clone = element.cloneNode(true);
    clone.setAttribute('class', 'sticky-toc');
    cloneMap.set(element, clone);
    element.parentNode.insertBefore(clone, element.nextSibling);
    const zoom = panZoom = svgPanZoom(clone.querySelector('svg'));
    zoom.resetZoom();
  });

  const observer = new IntersectionObserver(
    (entries) => {
      const currentScroll = window.scrollY;
      const scrollingDown = currentScroll > lastScroll;
      lastScroll = currentScroll;

      entries.forEach(entry => {
        const element = entry.target;
        const clone = cloneMap.get(element);

        if (!entry.isIntersecting && scrollingDown) {
          clone.setAttribute('class', 'sticky-toc');
          clone.style.display = 'block';
        } else if (entry.isIntersecting && !scrollingDown) {
          element.style.visibility = 'visible';
          clone.style.display = 'none';
        }
      });
    },
    {
      root: null,
      threshold: 0,
      rootMargin: '-10px 0px 0px 0px'
    }
  );

  elements.forEach(element => {
    observer.observe(element);
  });

  window.addEventListener('resize', () => {
    elements.forEach(element => {
      const clone = cloneMap.get(element);
      if (clone.style.display != 'none') {
        // reset didn't seem to work
        svgPanZoom(clone.querySelector('svg')).destroy();
        addPanZoomToElement(clone.querySelector('svg'));
      }
    });
  }, { passive: true });
}

stickyTocAfterScrolling();
View org source for this post

Organizing my sketches

| drawing, supernote
Text and links from sketch

Organizing my sketches

What I have now:

  • SuperNote A5X:
    • Monthly notebooks
    • Long-term note with links
    • Daily moments
    • Crafts
    • PDFs (esp. w/ large margins)
  • Highlighted heading
  • ☆ for needs more
  • No antialiasing: … Preferences
  • Finished sketches:
    • ID: YYYY-MM-DD-NN
    • Export as PNG, medium resolution
    • Rename to ID Title – tags.png
    • Save to sketches or private-sketches
      • sketches.sachachua.com
  • Code to recognize/recolor/rename, open/insert/export a sketch, its text, or a list of sketches

What I want:

  • Use sketches to untangle thoughts
  • Share my notes
  • Make visual cues for A+ & me (menus, moments, trackers)
  • Annotate text/transcripts to make sense of them, organize/summarize info
  • Doodle illustrations for my blog
  • Draft videos, posts

Things I want to improve:

View org source for this post

Looking at my blog post stats by year

| blogging
blog-stats.svg
Figure 1: Blog statistics

I was curious about the shape of my blog over the years, excluding Emacs News and my link-heavy weekly/monthly reviews. It started off with lots of little posts like the way other weblogs were also quick links and notes. As weblogs morphed into blogs with more text, I also settled down into fewer, longer posts with lots of code (analyzed by looking for <pre> blocks). I wrote much less after A+ was born. Interestingly, I've been shifting towards longer posts with more images.

  • Blog posts exclude permalinks that match emacs-news|review|week-ending, which casts a bit of a wide net but should give me the general shape of things.
  • Total words per year and average words per post both exclude code snippets.

Here's how I got those numbers:

(append
 '(("Year" "Posts" "Total words" "Words per post" "Posts with pre" "Posts with images")
   hline)
 (cl-loop for i from 2001 to 2024
          collect
          (let* ((default-directory (expand-file-name (number-to-string i) "~/proj/static-blog/blog"))
                 (exclude (shell-quote-argument "emacs-news|review|week-ending"))
                 (files (format "find . -name '*.html' | grep -v -e '%s' | " exclude))
                 (posts (string-to-number
                         (string-trim
                          (shell-command-to-string (concat files "wc -l")))))
                 (words (string-to-number
                         (replace-regexp-in-string
                          "TOTAL: " ""
                          (shell-command-to-string
                           (concat files "xargs ~/bin/count-words | grep TOTAL")))))
                 (posts-with-images
                  (string-to-number
                   (string-trim
                    (shell-command-to-string (concat files "xargs grep -l '<img' | wc -l")))))
                 (posts-with-pre
                  (string-to-number
                   (string-trim
                    (shell-command-to-string (concat files "xargs grep -l '<pre' | wc -l"))))))
            (list i
                  posts
                  words
                  (/ words posts)
                  posts-with-images
                  posts-with-pre))))
Year Posts Total words Words per post Posts with pre Posts with images
2001 3 438 146 0 0
2002 31 4336 139 0 0
2003 863 64953 75 0 59
2004 967 125789 130 2 98
2005 679 135334 199 4 40
2006 869 171042 196 19 42
2007 489 107011 218 33 32
2008 380 121158 318 85 57
2009 400 175692 439 81 20
2010 335 160289 478 93 19
2011 324 163274 503 93 28
2012 286 124300 434 111 12
2013 273 173021 633 172 11
2014 272 186788 686 138 30
2015 173 133682 772 82 36
2016 25 11560 462 13 6
2017 37 24063 650 6 2
2018 66 46827 709 7 8
2019 18 13054 725 3 6
2020 13 6791 522 4 5
2021 31 17389 560 8 16
2022 21 11264 536 4 9
2023 68 47188 693 26 52
2024 74 58439 789 27 40

And here's how I plotted the charts:

import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(data[1:], columns=data[0])
# Create a figure with subplots
fig, (ax1, ax4, ax2, ax3) = plt.subplots(4, 1, figsize=(10, 12))
fig.suptitle('Blog Statistics by Year', fontsize=16)

# Plot Posts
ax1.bar(df['Year'], df['Posts'], color='lightblue', label='Other posts')
ax1.bar(df['Year'], df['Posts with pre'] , color='darkblue', label='With preformatted blocks')
ax1.set_title('Number of posts per year')
ax1.set_ylabel('Posts')
ax1.legend()

# Plot Posts
ax4.bar(df['Year'], df['Posts'], color='lightblue', label='Other posts')
ax4.bar(df['Year'], df['Posts with images'] , color='darkgreen', label='With images')
ax4.set_title('Number of posts per year')
ax4.set_ylabel('Posts')
ax4.legend()

# Plot Total Words
ax2.bar(df['Year'], df['Total words'], color='lightblue')
ax2.set_title('Total words per year')
ax2.set_ylabel('Total words')

# Plot Words per Post
ax3.bar(df['Year'], df['Words per post'], color='lightblue')
ax3.set_title('Average words per post')
ax3.set_ylabel('Words per post')
ax3.set_xlabel('Year')

# Adjust layout and display
plt.savefig(f)
View org source for this post