Getting an Org link URL from a string; debugging regex groups

| elisp, org

Sometimes I want to get the URL from a string whether the string contains a bare URL (https://example.com) or an Org bracketed link ([[https://example.com]] or [[https://example.com][Example]], ignoring any extra non-link text (blah https://example.com blah blah). org-link-any-re seemed like the right regular expression to use, but I started to get a little dizzy looking at all the parenthesis and I couldn't figure out which matching group to use. I tried using re-builder. That highlighted the groups in different colours, but I didn't know what the colours meant. All the matching information is in (match-data), but integer pairs can be a little hard to translate back to substrings. So I wrote an Emacs Lisp function to gave me the matching groups:

(defun my-match-groups (&optional object)
  "Return the matching groups, good for debugging regexps."
  (seq-map-indexed (lambda (entry i)
                     (list i entry
                           (and (car entry)
                                (if object
                                    (substring object (car entry) (cadr entry))
                                  (buffer-substring (car entry) (cadr entry))))))
                   (seq-partition
                    (match-data t)
                    2)))

There's probably a standard way to do this, but I couldn't figure out how to find it.

Anyway, if I give it a string with a bracketed link, I can tell that the URL ends up in group 2:

(let ((text "blah [[https://example.com][example]] blah blah"))
  (when (string-match org-link-any-re text)
    (pp-to-string (my-match-groups text))))
((0 (5 37) "[[https://example.com][example]]")
 (1 (5 37) "[[https://example.com][example]]")
 (2 (7 26) "https://example.com")
 (3 (28 35) "example"))

When I use a string with a bare link, I can see that the URL ends up in group 7:

(let ((text "blah https://example.com blah blah"))
  (when (string-match org-link-any-re text)
    (pp-to-string (my-match-groups text))))
((0 (5 24) "https://example.com")
 (1 (nil nil) nil) (2 (nil nil) nil)
 (3 (nil nil) nil) (4 (nil nil) nil)
 (5 (nil nil) nil) (6 (nil nil) nil)
 (7 (5 24) "https://example.com")
 (8 (5 10) "https") (9 (11 24) "//example.com"))

This makes it so much easier to refer to the right capture group. So now I can use those groups to extract the URL from a string:

(defun my-org-link-url-from-string (s)
  "Return the link URL from S."
  (when (string-match org-link-any-re s)
    (or
     (match-string 7 s)
       (match-string 2 s))))

This is handy when I summarize Emacs News links from Mastodon or from my inbox. Sometimes I add extra text after a link that I've captured from my phone, and I don't want that included in the URL. Sometimes I have a bracketed link that I've copied from org-capture note. Now I don't have to worry about the format. I can just grab the link I want.

View org source for this post

Reflecting on my conscientiousness (or whatever the opposite is)

| reflection, life

Over the past few days, I've been reflecting on the personality trait of conscientiousness, which is something that can be a bit of a struggle for me. From Wikipedia:

Conscientiousness is the personality trait of being responsible, careful, or diligent. Conscientiousness implies a desire to do a task well, and to take obligations to others seriously. Conscientious people tend to be efficient and organized as opposed to easy-going and disorderly. They tend to show self-discipline, act dutifully, and aim for achievement; they display planned rather than spontaneous behavior; and they are generally dependable. Conscientiousness manifests in characteristic behaviors such as being neat, systematic, careful, thorough, and deliberate (tending to think carefully before acting).

Conscientiousness and me

conscientiousness-butterfly.jpg

I think of myself as not very conscientious. At school, I struggled with completing homework, sometimes not even turning in assigned essays. I forgot about deadlines and accidentally left my stuff behind. I did well on standardized tests because I could read quickly and eliminate probably incorrect answers, but other types of tests were a drag. There were some subjects I liked enough to do well in (well, mostly teachers I found engaging). For the most part, though, I didn't particularly care about grades. Even as an adult, I occasionally forget to finish something I'm working on, I lose things and time due to disorganization and attentional hiccups, and I've used my "Oops" fund a number of times. (W+ is more conscientious than I am, and occasionally patiently reminds me to take care of stuff.) I tend to follow the butterflies of my interest.

Fortunately, I've figured out some things that work well for me. Coding is great because even though it needs me to be pretty exact, I can work in small chunks, write tests to help me double-check, and automate repetitive tasks that my brain tends to hiccup on. When I worked at IBM, I had a lot of fun working on projects I cared about, like building systems to help professionals transition into teaching or helping food banks distribute food. I also did well skimming pages and pages of internal discussions so that I could summarize key themes for workshops. For my consulting clients, I tend to focus on prototyping their crazy ideas. If the idea proves worthwhile, we can then turn it over to other people to get it ready for production. Org Mode helps me keep track of what I want to do and when. In the Emacs community, I tend to focus on breadth rather than depth: Emacs News instead of package maintenance or core Emacs development. (And besides, it's volunteering anyhow, so when people bump into bugs in my code, it's either an opportunity for them to help out or something they might just put up with or work around.) I like experimenting, and I don't feel stuck; I can move on from an experiment when I've gotten enough data or when things change. I've shifted my life so that most of the tasks on my to-do list are things that I want to do that aren't time-sensitive, so I can do them when I want.

Noticing when my brain likes to do the work

conscientiousness-piano.jpg

I recognize myself in other descriptions of conscientiousness. I like to plan and I like to take notes. I get somewhat stressed by the idea of being late, although I've learned to chill out a little about that because kids mean being flexible about time. I like considering decisions carefully and doing little experiments. I find risky behaviour stressful rather than fun. Still, I tend to think of myself as someone who doesn't do the extra work, who often doesn't pay attention to the fiddly details. A few counter-examples might help me figure out more about when my brain likes to spend the extra time on things:

  • In a cryptography course that I took in university, we had an assignment to break a simple Caesar cipher. Each student was assigned one line. I had fun crunching through all of them (puzzles! piece of cake) and I distinctly remember relishing the teachers' surprise the next day.
  • I signed up for more school, getting a master's degree in Mechanical and Industrial Engineering at the University of Toronto. I got interested in it for two reasons:
    • I enjoyed teaching computer science at my alma mater. Getting an advanced degree was strongly recommended. I experimented with a masters in education but I wasn't that interested in it.
    • I was also interested in personal information management thanks to Emacs and Planner Mode, so I was curious about exploring the usage patterns of people who had highly customized their PIM tool. Several papers in that area had been written by a researcher at the University of Toronto, so I applied there for a master's. That researcher left shortly after I arrived, so we looked around for another topic. Eventually we settled on social networking platforms in organizations, which was also interesting for me because it was about how people use technology to organize collective knowledge.
  • I also signed up for parenting knowing that it's a ton of extra work including stress-testing my abilities, being responsible for helping an entirely separate little being figure out things I'm still figuring out myself, and handling endless problem-solving and adaptation in the face of uncertainty.
  • I notice that I'm getting a little better at slowing down and practising piano, singing, and drawing. I've tried all these things before, but now I can approach it differently because I'm going into it with more life experience.
    • For piano, I can treat it like a moving meditation on the quirks of my monkey mind, and be amused at how my brain learns. I enjoy feeling the motions become more automatic. I also like the thoughts and memories that the pieces evoke. (As part of this beginner course I'm doing, I just practised a very simple version of "Thus Spake Zarathustra", which makes everything feel more epic.) Eventually I think it would be nice to be able to play the music that A+ and I might want to sing to. It seems to be my current hyperfocus. I enjoy spending the time practising, knowing that there's no way to skip that part (and perhaps this is even supposed to be the fun part).
    • For singing, I can be mystified by all the weird movements that I have to figure out in my larynx and my diaphragm and other parts I haven't even figured out how to name yet, much less activate. It gives me some empathy for how kids are learning about things we can't easily teach them.
    • For drawing, I can be amused by the gap between how things really are and how I imagine them to be, and the gap between what I imagine and what I can draw. The video tutorial assures me that taking the time to slow down and shade or add texture is worthwhile, and is even the fun part of drawing. I still get impatient occasionally (do I really want to spend all this time on one sketch?), but it's an interesting perspective. I think it might be nice to develop art into a relaxing activity. If I go through the steps, I'll probably get there. Also, I like doodling to break up the wall of text in a blog post like this one, so that's another fun way to practice.

So maybe I can be a bit more conscientious when it's something I'm curious about or care about.

Supporting my brain

conscientiousness-toolbox.jpg

For the tasks that I need to be conscientious about, there are other things that help:

  • I'm getting better at accepting my limits. For example, when I had a pie in the oven last night, I told A+ that I couldn't go off to play Minecraft with her because I might forget about the pie and accidentally undercook or overcook it.
  • Writing notes helps me keep track of where I am, what I wanted to do next, what I'm figuring out along the way, and so on. The possibility of sharing those notes (and thus having more opportunities to learn from my past self or from other people) also encourages me to get to a point where those notes can be shared. Here I really appreciate how Org Mode helps me capture, manage, and post my tasks and notes, thanks to literate programming. People occasionally tell me that they think I'm very organized, but that's probably just because I write about stuff so that when I forget, I can look them up again.
  • Checklists are also handy. Most of the time, I just make a checklist on my phone using Orgzly Revived, but maybe I can make these more visual. I notice that I'm not particularly influenced by the gamification strategy of a streak count and mildly influenced by XP bars.
  • Journal entries and blog posts also give me a record of what I've worked on, and even little bits of progress accumulate.
  • I'm also learning to to distract the fidgety part of my brain with music or movement, and to manage it with timers. Timers are great. Timers to get started, timers to check in with myself, timers to come back…
  • Automation is wonderful. Getting a computer to do the work is often more fun and less error-prone than my doing it myself. Even semi-automation is helpful.

Despite not thinking of myself as particularly conscientious, I'm pretty happy with what I've been figuring out about my life and the world. I can think of how I work as building on my strengths instead of just working around my weaknesses. I enjoy learning about and dabbling in lots of different interests, and the combination of ideas can be very useful (like dancer curiosity). Framing many decisions as experiments helps me get to 80%-fine quickly, and I don't spend a lot of time chasing down that last 20% that takes most of the effort. I don't fit the hustle culture of many self-help books, blogs, and videos, and that's okay.

Not far from the tree

conscientiousness-ultralight.jpg

I think my dad was not particulary conscientious either, at least not in terms of planning ahead, paying attention to details, following conventions. He was always in motion, happiest whenever he had a crazy project. Fortunately, he was really good at inspiring other people to handle the logistics. He came up with the ideas ("I want to fly across the Philippines in an ultralight") and people like my mom figured out how (fuel, landing spots, etc.). His spontaneous road trips drove me a little batty when I was a kid. But also, when it came to the things he cared about, he could spend hours, days, weeks on getting it right. I remember how he'd stay up late to figure something out, whether it was digital photography or Microsoft 3D Pinball. I've written about how he repeatedly drew variations on the same sketch in order to figure out what he wanted. He did okay. He found his way, even though it looked nothing at all like the standard paths. I'm probably doing all right, too.

My mom was more conscientious and deliberate than my dad was. She handled the business while my dad got to focus on his passions. From her, I picked up the habits of reading and writing. I think I'd like to be more of a mix between their styles rather than one or the other.

Growing

Apparently, conscientiousness tends to increase with age, so that's interesting. I feel slower when it comes to some things (probably because of adapting to all those distractions and periods of sleep deprivation, or maybe age, or simply a more realistic evaluation of my abilities), so it's easier to give myself time to do things that are slow. Maybe I'll get better at enjoying the act of practising and paying attention to the details. I'll probably benefit from more orderliness, too. I wonder how I can get my brain to enjoy decluttering and figuring out the right homes for objects. It's a little like preparing the space so that I can see what I like and it's easy to work on what I enjoy. (Marie Kondo's The Life-Changing Magic of Tidying Up might be relevant here, although even she has found keeping a tidy house with kids to be a challenge…)

Tangent: A quote from Marie Kondo

When I first became a mother, I felt frustrated when I couldn’t tidy my home exactly the way I wanted. Then, I had two more children, and I found I didn’t even have the energy to consider some of my former practices around the house!

With this in mind, here are some tips that help me keep my home in order with two young children.

Motherhood has taught me to be more forgiving of myself. The joy that comes from parenting exceeds any satisfaction that could have come from a perfectly neat home. My children also remind me that our lives can shift daily (if not every minute) — and that the best we can do is honor where we are in the present moment.

source

I've been trying to think of a neutral or positively-coded word for the opposite of the conscientiousness personality trait. I asked Claude AI to generate a bunch of antonyms. I don't quite identify with "free-spirited" or "spontaneous", but I like "adaptable" and "improvisational," and "interest-driven" is an accurate description of the way we spend our energy. Those words don't quite cover the same cluster of meanings that "conscientious" does, but they give me other ways to think about the personality trait as something more positive.

Learning on my own and with others

I'm always curious about how I can work with what I've got. New challenges, new experiences, new capabilities… I get to learn even more about how my brain works and what I can do, especially as I build systems and processes to support myself.

Figuring out more about building on my strengths will also help me parent A+, so this work is extra worth it. I can even learn from the worries that sometimes flutter up when I see her also wandering far from what the school system would probably prefer that she focus on.

conscientiousness-timeline.jpg

Thinking about processes and tools and self-acceptance also makes me think a little about Andy's recent blog post My 10 Years with Emacs, in which (among other thoughts about what he's learned about using Emacs and other people he wants to thank for helping) he mentions thinking of me as kind of the community mom. I was 18 when I started using Emacs, I've grown up in this community, and I've got blog posts and videos that help me catch glimpses of myself throughout the years. It does feel interesting to notice the shifts in my brain, from kind of an enthusiastic puppy bursting with energy to something more about experimentation, reflection, and connection. If I can get better at understanding myself and the tools I can build to support who I am and what I want to do, I wonder if that'll help other people too. I'm looking forward to being able to someday bring grandparent energy to this. What could that be like? There are people even older than I am in this community, which is wonderful. I'm looking forward to seeing how we all figure out how to work with what we've got.

View org source for this post

2025-03-03 Emacs news

| emacs, emacs-news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Mastodon #emacs, Bluesky #emacs, Hacker News, lobste.rs, programming.dev, lemmy.world, lemmy.ml, communick.news, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar, and emacs-devel. Thanks to Andrés Ramírez for emacs-devel links. Do you have an Emacs-related link or announcement? Please e-mail me at sacha@sachachua.com. Thank you!

View org source for this post

Monthly review: February 2025

| monthly, review

Text and links from sketch (, and) a list of emojis per day

February 2025

  • field trips
  • birthday
  • music and art

By day:

  1. 👀 looking ahead
  2. 💃 dance
  3. ✅ curriculum checklist
  4. 🖼️ Art Gallery of Ontariqo
  5. 🤖 MakeyMakey
  6. 🐕 sheepdog realizations
  7. 📱 iPad experiments
  8. 📲 my own iPad
  9. 🛷 sledding
  10. 📸 sorting through photos
  11. 🎨 drew a review of A+'s 8th year
  12. 🏢 Moments in Modernism
  13. 🛷 sledding snow day
  14. 🎤 piano and voice
  15. ☃️ even more snow
  16. ❄️ quinzhee
  17. 🍪 galaxy cookies
  18. 🚲 shovelling trail walkway
  19. 📝 individual assessment
  20. 🧁 cupcakes
  21. 🧁 icing
  22. ⛸️ skating party
  23. ❄️ breaking up ice
  24. 🌀 Minecraft Parkour Spiral 2
  25. ⛸️ more skating
  26. 📈 results: growth, exceptionality
  27. 🤖 Comparing Claude and ChatGPT
  28. 🔍 word search

This month, A+ asked me if we could do a field trip. Since her virtual grade 3 class was doing a unit on drawing landscapes, I thought I'd take her to the Art Gallery of Ontario so that she could practise digital painting surrounded by lots of great examples. I enjoyed that enough to get my own iPad for drawing on. She asked for another field trip the following week to check out the Moments in Modernism exhibit, so we got to practise digital painting together. (We ended up back in the landscape gallery.) I wonder what we'll explore next month.

Being able to do iPad things together also nudged us to explore music and art. I experimented with paying for the Simply family subscription. A+ and I have been practising singing and piano, and W- has been practising patience. I've been going through the art tutorials too. A+ has run out of colourful drawings to work on and is not particularly interested in the pencil courses, so maybe that'll be for later.

It was A+'s birthday this month. She wanted to have a skating party with just her closest friends and their families. We made and decorated cupcakes and cookies, and then we brought her and the party supplies over to the park in our cargo bikes. W- brought over pizza and hot chocolate. I enjoyed drawing a one-page summary of A+'s 8th year, and that also helped other people get a sense of what we've been up to the rest of the year. I used parts of that drawing for little thank-you cards for her friends, too.

Lots and lots of snow this month. It's amazing how much some guerilla shovelling can make a difference. We cleared the entrance to the Martin Goodman Trail closest to our house, and W- also cleared some things in our neighbourhood and on our bike ride home.

Checking in with myself

I noticed I've been a little more fretful than I'd like to be. I think I've been letting myself get all tangled up in worries about A+ and school fit, and I've also been staying up late exploring sketching. My current plan is:

  • schedule fretting for Saturdays so that I don't fret too much at A+ during the week
  • remind myself of counterexamples: A+ does actually get her work done, and she's pretty good at making decisions; even if she messes up, failure is feedback
  • externalize my anxiety by calling her "Gumamelon" (long story), and thank her for showing up and trying to protect us and make life easier
  • try to get better at detecting when Gumamelon is sneaking up on me, write down her concerns, and remind her that she can come back on Saturday.
  • distract Gumamelon with other things I can do
  • sleep better

It's weird, but maybe it'll help. =)

Also, trying out this approach of answering reflection questions in order to think more deeply.

Where did I feel most energized this month? What activities drained me?

I liked figuring things out with W- and A+, whether it was breaking up the ice on the walkway or redoing the galaxy icing on the cupcakes. I also liked the calmness of going through the music and art tutorials, even if they felt quite slow at times. I'm not too keen on the frazzled feeling of fretting at A+, but I'm glad I'm getting better at recognizing the irrationality of it, and that both W- and A+ are good at reminding me to back off. I'm looking forward to finding ways to redirect that. This might be the time to get back into exploring the things I want to learn. That'll keep me plenty busy.

What moments made me say "aha!" this month?

It's interesting to see how both A+ and I respond well to impersonal feedback from a computer and to breaking things down into bite-sized, gamified learning. The pitch visualizations in the singing app have been helping her pay more attention to melody. I like the way the notes in the piano app don't let me move forward until I get them right. I'm going to experiment with pitch detection to practise singing scales. I want to see if I can get Claude AI to give me reasonably-useful writing feedback, too.

Emoji summary

Nudged by Gina Trapani's My Life in Weeks (found via HN) and the Life in Weeks app (also discussed on HN), I'm noodling around the idea of having a quick but expressive overview. I have a journal covering most of the days since 2016, somewhat spotty coverage of weekly/monthly notes before then, and yearly reviews going back to 2005. If I wanted to summarize each day with an emoji, February would be:

👀💃🖼️🤖🐕📱📲🛷📸🎨🏢🛷🎤☃️❄️🍪🚲📝🧁🧁⛸️❄️🌀⛸️📈🤖🔍

Which is promisingly compact and could be fun to experiment with over the year, and then maybe I could pick weekly highlights too.

Anyway, in March, I'd like to:

  • Practise being calmer and more easygoing; get better at thinking in terms of experiments
  • Take A+ on more informal field trips: Royal Ontario Museum, pottery class
  • Start digging into the ideas and tasks I've been postponing
  • Finish the Simply Piano course and start working on sheet music for the songs A+ wants to sing
  • Practise singing scales while waiting for A+ to catch up with Simply Sing
  • Automate the BigBlueButton setup a bit more so that I don't forget about meetups

Sketches

Time

Category Previous month % This month % Diff % h/wk Diff h/wk
A- 35.6 41.9 6.3 63.5 10.6
Business 2.0 2.4 0.4 3.6 0.7
Discretionary - Family 0.0 0.1 0.1 0.2 0.2
Discretionary - Play 0.6 0.2 -0.4 0.3 -0.7
Discretionary - Productive 11.7 11.2 -0.6 16.9 -1.0
Personal 8.6 7.4 -1.1 11.3 -1.9
Sleep 35.4 33.9 -1.4 51.5 -2.4
Unpaid work 6.2 3.2 -3.0 4.8 -5.0

Hmm, definitely want to get more sleep.

View org source for this post

Two weeks with the iPad Air (+ SuperNote A5X and Lenovo P52)

Posted: - Modified: | geek, tech, ipad

[2025-03-01 Sat]: Genaro suggested beorg, so now I've got that on my iPad and it seems to be doing fine for browsing my Org Mode files. I think I'll set up WebDAV on our network-attached storage (NAS) and see what that's like, too.

Also, apparently, it's been about three weeks, whoops!

I've had this iPad Air 13" for about two three weeks now, and I'm slowly settling into how the different pieces of tech can work together and how things can flow.

Text from sketch

Getting used to SuperNote A5X + iPad Air 13"

SuperNote A5X:

  • I prefer it for writing, sketchnotes
    • pen feel
    • strokes: exactly as I expect, no hooks or smoothing
    • lighter weight
    • no backlight
  • Also nice for reading EPUBs, PDFs

iPad Air:

  • Libby for library e-books
  • Procreate, Simply Draw for art
  • NetNewswire for RSS
  • Copying & pasting is nice

Procreate replaces spaces with underscores and doesn't overwrite files. Instead, it adds 2 to the filename.

I want to start building up thought maps so I can see quick summaries and open questions. The laptop is probably the best place to do it.

Org Mode files with sketches, text, and links

  • Export to HTML
  • Also, add export to HTML gallery view?

Private sketches: Available through DS

Private web server on the NAS? I can just run my sketch viewer.

DS: Synology NAS drive

  • Program the server to consolidate files?
  • Consider moving metadata to subdir for easier flipping?

Ideas for next steps:

  • Figure out easier doodling from iPad: resample, autocrop, insert with HTML markup
  • Automate recolour/rename from Dropbox (phone? server?)

On the iPad, I've been mostly using:

Moving data around is a bit of a hodgepodge: internal webserver or Dropbox for the Supernote, Dropbox and Synology's DS Drive for the iPad, and Syncthing for the server. I'm sure that'll settle down eventually as I figure out a better flow.

Untitled_Artwork.jpg

I like how drawing, singing, and playing the piano give me a way to distract myself from the urge to nag A+. Still definitely just starting out, but it's fun anyway. It's nice to be able to breeze through library e-books again, too.

I notice I've been missing the occasional calendar reminder from my phone, so that's probably a sign that I need to (a) set up the iPad for calendar access as well, (b) have more distinct notifications on my phone, and (c) take the phone with me as I go from room to room. On the plus side, that probably means I've been getting in the zone, yay! It seems a little easier to just take the whole stack of phone+Supernote+iPad when I move rooms instead of leaving them in different places and then having to go find them. The laptop is a lot heavier, though, so I tend to move that on an as-needed basis.

I set up a copy of sketches.sachachua.com server on the NAS (so it's just on the local network) pointing to my private sketches directory, so now I can flip through my private sketches fairly easily. They're mostly just various thoughts on parenting and emotions and life. Now I can review them from either my iPad or my laptop, yay!

Ideas for next steps:

  • Keep distracting myself from fretting about A+ by completing various art/music tutorials.
  • Have fun doodling.
  • Contemplate whether I want to read my Org files on the iPad, and what the best way of doing it might be. (Organice? PlainOrg? Just do a PDF/EPUB export of stuff I'm focusing on? - update 2025-03-01: added Beorg)
  • See if A+ is up for field trips to the art gallery or museum.

The iPad Air seems like a good addition. Let's see what I can do with it.

View org source for this post

Letting A+ play with generative artificial intelligence for fiction, and a primer

Posted: - Modified: | ai

[2025-03-01 Sat]: After experimenting with ChatGPT in depth, A+ has decided that she prefers Claude, so we'll try that.

A+ likes prompting Claude AI to generate funny kid-focused Star Wars fanfic mostly exploring how various characters might babysit Luke, Leia, and Grogu in a universe where Anakin did not fall to the Dark Side. This seems to be working out well. It encourages her to improvise stories even when we're off-screen, and it lets her play with small variations on ideas and quickly try things out. The stories that Claude generates are humorous and descriptive, with better dialogue and characterization than I might come up with myself. This is infinitely better than letting her wander around fanfiction.net on her own.

She often runs into the free tier's usage limits. There are plenty of other things she enjoys doing, so it's not a problem. She just goes on to read other things, practise singing, or colour. Still, we've been noodling around the idea of paying for a subscription, especially if we can help her get even more out of it. For example, maybe we could build some routines like:

  • Daily: Tell me your favourite story of the day. What did you like about it? What was the problem and what was the solution?
  • Weekly:
    • Check in to see if you're all caught up with schoolwork
    • Pick a story and let's draw a quick scene from it together; maybe I can compile it into a little PDF we can enjoy
  • Once a month:
    • Record one story out loud (~ 250 words, so a couple of minutes)

(I know, I know, it's pretty aspirational. But maybe I can sneak some of it in here and there, especially if I start doing it myself. Then she usually wants to join in.)

Prompt engineering

A+ currently writes prompts like:

  • Write a funny story where Darth Vader has a bunch of body doubles (like Queen Amidala did) and they have a very important meeting. The Emperor is trying to find Darth Vader and keeps finding the body doubles instead.
  • Write a silly story where Anakin raises Luke and Leia with Padme instead of turning to the dark side.
  • Write a continuation of The Skywalker Family Chronicles where Anakin is helping Luke and Leia get dressed for a very important Bring Your Children to a Council meeting.
  • Write a funny continuation of The Skywalker Family Chronicles about the time that Captain Rex brought the rest of the 501 Legion and Commander Cody's Legion to help babysit Luke and Leia.
  • Write a continuation of The Skywalker Family Chronicles where Commander Cody has to babysit Luke and Leia because Captain Rex is dealing with leftover Separatist droids and has to call in reinforcements who run into the Skywalker Naboo Lake House, fully armed, and wearing their full armor, asking whether his problem is either rouge Separatists droids or the Skywalker children and bringing two bags of military equipment and two bags of Skywalker Specific Stress Depleters and other things for babysitting.
  • Write a continuation of The Skywalker Family Chronicles where Grogu reads his journal, flipping to the page where Padme takes Ahsoka, Anakin, Yoda, Grogu, still talking and potty training, Luke, and Leia to a boat ride, but it turns out Yoda, Anakin, Luke, Ahsoka, and Leia get seasick, told from Grogu's point of view in detail.
    • It was interesting to see this prompt evolve over 16 iterations starting from "Write a continuation of The Skywalker Family Chronicles where Padme takes Anakin, Luke, and Leia to a boat ride, but it turns out that boat rides become disasters for Skywalkers."
  • Write a continuation of The Skywalker Family Chronicles where Ahsoka reads her journal, ending up on the page where she ends up at the Senate Medical Center due to some flu that only Togrutas can catch, the journal written in slightly squiggly handwriting, which is either Grogu or Anakin's handwriting.
The story Claude generated for that prompt

Ahsoka's Journal — Entry #47

[The handwriting is notably messy and inconsistent, with some letters larger than others and lines that don't quite stay straight across the page]

Dear Snips Journal Ahsoka's Top Secret Thoughts Today's Very Important Record of Events

Anakin here. Ahsoka is sick in bed with Togrutan Spotted Fever (which is apparently a thing??), so I'm writing this for her because she made me promise to "keep her journal updated" and threatened to tell Padmé about the speeder bike incident if I didn't. So here we are.

Medical droid says she'll be fine in a few days but needs rest. She keeps trying to get up to train, so I'm taking dictation between making her stay in bed. Her exact words: "Make sure you get everything right, Master, or I'll know."

This is ridiculous Here's what happened:

It started three days ago when Ahsoka's lekku developed these weird purple spots. She insisted it was "just a cosmetic phase all Togruta go through" and refused to see a healer. Then she collapsed during lightsaber practice, which was TERRIFYING, by the way. Not that I panicked. I was very calm and collected as I carried her across the Senate District while shouting for people to move out of the way.

The twins kept trying to "help" by Force-pushing pedestrians, which didn't actually help AT ALL. Leia claims "that man was going to step on Ahsoka's lekku" but I'm pretty sure she just wanted to see if she could push someone into a fountain. (She could.)

Luke tried to use the Force to make Ahsoka float "so you don't have to carry her, Dad" but only managed to make her boots come off. One hit Senator Organa right in the back of the head. I'll have to apologize for that later.

When we got to the Senate Medical Center, the droid at reception just stared at us like we were crazy. In my defense, it's not every day a former Jedi Knight runs in carrying an unconscious Togruta while two Force-sensitive five-year-olds make medical equipment float around the waiting room.

Padmé arrived looking perfect as always, somehow already briefed on the situation. She claims she "felt a disturbance in the Force, and that disturbance was you causing chaos, Anakin." She's not even Force-sensitive! How does she KNOW these things??

The medical droid diagnosed Ahsoka with "Togrutan Spotted Fever" which apparently only Togruta can catch. The spots spread all over her lekku and montrals before the fever kicked in. The droid said it's like "human chicken pox but confined to head-tails" which is both fascinating and disgusting.

Grogu seemed very interested in the spots, kept trying to touch them until Ahsoka made that scary growling noise. Now he brings her soup instead. At least I think it's soup. It's green and bubbling and I'm a little afraid to ask what's in it, but Ahsoka seems to like it.

Obi-Wan stopped by with "medicinal tea" which smelled terrible but made Ahsoka laugh so hard she snorted bacta solution out her nose. Something about a mission where I apparently got similar spots in an inappropriate location? I DON'T REMEMBER THIS AND IT NEVER HAPPENED.

Oh, Ahsoka wants me to add:

"Master Yoda visited and said 'Strong with the antibodies, you must be.' He brought me a weird root that tasted awful but made my headache go away. Also, tell the younglings the spots are NOT for coloring practice!" Speaking of which, I caught Luke trying to "connect the dots" on Ahsoka's lekku with a marker while she was sleeping. Leia was standing lookout. I'm simultaneously proud of their teamwork and horrified by their choices. Padmé has now banned everyone except medical droids from the sick room after Ahsoka's fever spiked when Rex brought the entire 501st to "boost morale." Apparently twenty clone troopers singing get-well songs isn't restful. Who knew?

Ahsoka is falling asleep now, but insists I note that "Anakin's nursin g skills are terri bl…"

She didn't finish that sentence because she's WRONG and also finally sleeping. I am an EXCELLENT caretaker! I've only spilled bacta solution twice, and the second time wasn't even my fault because R2 bumped into me. I should wrap this up. Padmé says my handwriting is getting worse, which I didn't think was possible. Also, Grogu is trying to add his own notes in the margins and I can't tell if those are drawings or actual words. Get better soon, Snips. The twins miss their "Auntie 'Soka" and I miss having someone else to blame when things go wrong.

— Anakin

[In the corner, there appears to be a small green handprint with what might be Grogu's attempt at writing "Get better" beside it]

All right, let's get a bit meta here. "Here are some prompts that my 9-year-old child has been using to generate funny Star Wars fanfiction in alternate timelines. Suggest 5 ideas for improving her prompts and provide detailed examples." We're out of free messages for Claude, so I asked ChatGPT.

It suggested:

  1. Be more specific about the chaos or conflict.
  2. Add unexpected reactions from characters.
  3. Use a "What If?" format to spark creativity.
  4. Introduce a clear perspective or narrator.
  5. Add an absurd or over-the-top element.
Full response including examples and details

Your child already has a fantastic imagination and a great sense of humor! Here are five general tips to help improve and refine her prompts for even funnier and more engaging Star Wars fanfiction:

1. Be More Specific About the Chaos or Conflict

  • Funny stories often work best when there's a strong contrast or a big misunderstanding. Adding more details about what could go wrong will make the story even funnier.
  • Example: Instead of: "Write a funny story where Darth Vader has a bunch of body doubles, and the Emperor keeps finding them instead." Try: "Write a story where Darth Vader has a dozen body doubles, but they're all terrible actors who keep revealing they're fakes in ridiculous ways. The Emperor gets increasingly frustrated as he accidentally promotes one to Grand Moff, challenges another to a lightsaber duel, and gets tricked by one into approving a Death Star Karaoke Night."

2. Add Unexpected Reactions From Characters

  • One of the funniest things in fanfiction is when characters react in ways they normally wouldn't. Encourage your child to play with unexpected character reactions.
  • Example: Instead of: "Write a silly story where Anakin raises Luke and Leia with Padmé instead of turning to the dark side." Try: "Write a story where Anakin raises Luke and Leia with Padmé, but he's the most overprotective parent in the galaxy. He installs lightsaber-proof baby gates, interrogates their playdates like a Jedi Council trial, and insists on Force-training them before they can walk. Meanwhile, Obi-Wan just shakes his head and drinks space tea."

3. Use a "What If?" Format to Spark Creativity

  • Reframing prompts as "What if?" questions can help make them more engaging and open-ended.
  • Example: Instead of: "Write a funny continuation where Captain Rex and the clones babysit Luke and Leia." Try: "What if the entire 501st Legion had to babysit Luke and Leia for a day, but they treated it like a high-stakes military mission? Their strategy meetings include creating 'Operation Diaper Storm,' using clone trooper formations for nap time, and having emergency evacuations when Leia gets hold of a blaster."

4. Introduce a Clear Perspective or Narrator

  • Some of the best humor comes from seeing an event through the eyes of a character with a strong personality or a unique way of looking at things.
  • Example: Instead of: "Write a story where Grogu reads his journal about a boat ride." Try: "Write a story from Grogu's journal where he describes (in broken baby Yoda language) a disastrous boat ride. Yoda, Anakin, Luke, and Leia all get seasick, Ahsoka tries to 'train' the fish, and Padmé regrets everything. Meanwhile, Grogu just wants snacks and writes about it like it's a Jedi prophecy."

5. Add an Absurd or Over-the-Top Element

  • Taking an idea to the extreme can make it even funnier.
  • Example: Instead of: "Write a story where Commander Cody has to babysit Luke and Leia." Try: "Write a story where Commander Cody has to babysit Luke and Leia, but he's so stressed that he calls in every trooper he knows for backup. Within an hour, the Skywalker Lake House is surrounded by AT-ATs, aerial support is patrolling for 'nap-time threats,' and Palpatine accidentally approves a new 'Elite Babysitting Clone Squad' after mistaking their report for a battle plan."

Encourage her to keep going with her hilarious and creative ideas! These small adjustments can make the prompts even more fun and engaging. 🚀

We read through this yesterday, and she's started telling me how she's added more detail to her prompts. I think she takes constructive feedback from the AI better than from me (just like using a timer works better than me telling her it's time to wrap up), so maybe there's some opportunity here on using a layer of indirection to keep the grumps from getting in the way of learning…

A primer on generative AI

I don't want A+ to treat generative AI as some kind of magic black box with amazing capabilities, so I've been sprinkling in some primer information here and there. I want her to understand roughly how it works, how it's not actually thinking but can still do a surprisingly good job of putting things together based on patterns derived from really large data sets in ways that are hard for humans to fully understand.

I also explained how conversations and token limits work. She's already getting the hang of editing prompts to refine things instead of adding more prompts to the conversation, although she still prefers to keep most of her story prompts in one conversation because the stories sometimes refer to previous incidents in the timeline.

Text from sketch

Generative artificial intelligence

How it works:

  • Tons of data: webpages, books, questions & answers, even images & videos
  • Computer model that predicts the next word/etc.
    • noticing the context
    • bat: ball, fly, base
    • bat: cave, wing, guano, fly
    • bat: man
  • Repeat with training until it gets things mostly right
  • We finish each other's sentences/sandwiches

Result: tools that can predict words or fill in blanks or even make images, recordings, and videos of things that don't exist.

They don't actually think for themselves yet; although sometimes the results can be quite interesting

Things to remember:

  • It doesn't actually know or think things. Not everything it says is true. Double-check when needed.
  • It usually doesn't cite or credit its sources. Even when it seems to do so, it can be wrong. So double-checking can be hard.
  • Use it to help you learn & explore. Don't let it substitute for your thinking & learning.
  • Don't put sensitive/private info in.

Caveats: The models cost a lot of energy to create. They cost less energy to use, but still a lot in terms of carbon emissions, water, etc. The data they were trained on includes things that people didn't give them permission to use. They are changing jobs & industries, but are often overhyped. Everyone's still figuring things out.

prompt, response context, tokens

sachachua.com/2025-02-27-01

Other resources:

I also showed her what NotebookLM could do with audio podcast generation, so she could get a sense of computer-generated audio. She noticed the interactive mode, so we experimented with that for a bit. The pauses in her speech tend to trigger premature answers, so it works better if she thinks about her sentence and says it confidently.

Going forward

A+ finds generating text very engaging at the moment and I think she's learning a lot through experiments. She'll probably have a deeper understanding of and appreciation for fiction than I did as a kid because she can easily change some things and see how it feels. (What if this story is told in third-person perspective? What if this story is told in present tense or past tense? What if this event happens differently; what would happen because of that change?)

With any luck, exposure to lots of story elements, vivid words, and dialogue will influence how she writes. Maybe she'll eventually get to the point where she can imagine a story and then want to write parts of it or all of it herself to bring it closer to her vision. So it's probably worth supporting this and seeing where it can go.

View org source for this post

Working with smaller chunks of thoughts; adding anchors to paragraphs in Org Mode HTML export

Posted: - Modified: | org, js

I write my blog posts in Org Mode and export them to Eleventy with ox-11ty, which is derived from the ox-html backend.

Sometimes I want to link to something in a different blog post. This lets me build on thoughts that are part of a post instead of being a whole post on their own.

If I haven't added an anchor to the blog post yet, I can add one so that I can link to that section. For really old posts where I don't have an Org source file, I can edit the HTML file directly and add an id="some-id" so that I can link to it with /url/to/post#some-id. Most of my new posts have Org source, though. I have a my-blog-edit-org function and a my-blog-edit-html function in my Emacs configuration to make it easier to jump to the Org file or HTML for a blog post.

If the section has a heading, then it's easy to make that linkable with a custom name. I can use org-set-property to set the CUSTOM_ID property to the anchor name. For example, this voice access section has a heading that has CUSTOM_ID, as you can see in the . If I don't mind having long anchor names, I can use the my-assign-custom-ids function from my config to automatically set them based on the outline path.

my-assign-custom-ids
(defun my-assign-custom-ids ()
  (interactive)
  (let ((custom-ids
         (org-map-entries (lambda () (org-entry-get (point) "CUSTOM_ID")) "CUSTOM_ID={.}")))
    (org-map-entries
     (lambda ()
       (let ((slug
              (replace-regexp-in-string
               "^-\\|-$" ""
               (replace-regexp-in-string "[^A-Za-z0-9]+" "-"
                                         (downcase (string-join (org-get-outline-path t) " "))))))
         (while (member slug custom-ids)
           (setq slug (read-string "Manually set custom ID: ")))
         (org-entry-put (point) "CUSTOM_ID" slug)))
     "-CUSTOM_ID={.}")))

Adding anchors to paragraphs

If the part that I want to link to is not a heading, I can add an ID by using the #+ATTR_HTML: :id ... directive, like this snippet from my reflection on landscapes and art:

  #+ATTR_HTML: :id interest-development
  That reminds me a little of another reflection
  I've been noodling around on interest development...

Anchor links

It might be fun to have a little margin note with 🔗 to indicate that that's a specially-linkable section, which could be handy when I want to link when mobile. It feels like that would be a left margin thing on a large screen, so it'll just have to squeeze in there with the sticky table of contents. I've been meaning to add link icons to sub-headings with IDs, anyway, so I can probably solve both with a bit of Javascript.

/* Add link icons to headings and anchored paragraphs */
function addLinkIcons() {
  document.querySelectorAll('h1[id], h2[id], h3[id], p[id]').forEach((o) => {
    const link = document.createElement('a');
    const article = o.closest('article[data-url]');
    link.href = window.location.origin + (article?.getAttribute('data-url') || window.location.pathname) + '#' + o.getAttribute('id');
    link.innerHTML = '🔗';  // link icon
    link.title = 'anchor';
    link.classList.add('anchor-icon');
    link.addEventListener('click', copyLink);
    o.prepend(link);
  });
}

addLinkIcons();

And some CSS:

.entry h2, .entry h3, .entry h4, .entry p, .content h2, .content h3, .content h4, .content p { position: relative }
.content a.anchor-icon:link, .entry a.anchor-icon:link { font-size: 60%; text-decoration: none !important; font-size: small; float: right }
@media only screen and (min-width: 95rem) {
   .content a.anchor-icon:link, .entry a.anchor-icon:link { display: block; position: absolute; left: -2em; top: 0.2em; float: none}
}

Text fragments

Text fragments are even more powerful, because I can link to a specific part of a paragraph. I can link to one segment with something like #::text=text+to+highlight~. I can specify multiple text fragments to highlight by using #::text=first+text+to+highlight&text=second+text~, and the browser will automatically scroll to the first highlighted section. I can specify a longer section by using text=textStart,textEnd. Example: #:~:text=That%20is%20the%20gap,described The text fragments documentation has more options, including using prefixes and suffixes to disambiguate matches.

Text fragment links require rel="noopener" for security, so I added JKC-Codes/eleventy-plugin-automatic-noopener to my 11ty config.

If I find myself using this a lot, it might be interesting to figure out how to make it easier, maybe with something like the Text Fragment extension for Firefox.

Update 2025-02-28: Ah, it turns out I already have some Emacs Lisp to link to currently-selected text using Spookfox. Spookfox connects Emacs to Firefox using a browser extension. Once it's properly set up and connected, it allows Emacs to evaluate things in the Firefox context.

These seem like good starting points for addressing smaller chunks of thoughts.

View org source for this post