Emacs: prettier tab-line #

Back in 2018 I posted about making tabbar.el look pretty. Emacs 27 includes two built-in ways to display tabs:

  1. tab-bar-mode works per frame to show window configurations
  2. tab-line-mode works per window to show buffers

Tab-line mode seems similar to tabbar.el, so I decided to switch from tabbar.el to tab-line.

Screenshot of emacs 27 tab-line-mode
Emacs 27 tab-line mode


Notes about eyeglasses #

These are my barely-organized notes about my need for eyeglasses to correct my nearsightedness. It is likely that I have some of this wrong because I don't fully understand it.


When an optometrist measures your "prescription" they're measuring the 0th and 1st order zernicke polynomials. The 0th order is "sphere" and is a single number, rounded to the closest 0.25. The 1st order is "cylinder" (astigmatism) and has two numbers: a direction axis and an amount. There are higher order aberrations too but the optometrist doesn't measure these. These higher order aberrations can cause halos and other effects; see this example image that shows a "coma" (point smeared out like a comet), "spherical aberration" (starbursts and halos), and "quadrefoil" (point spreads out multiple directions). Laser surgery can often correct these but sometimes the healing process generates new ones.


Emacs mode line simplified #

Back in 2017 I posted that I switched from my own custom Emacs modeline to Spaceline. I liked having a simpler configuration with more features. Unfortunately I eventually realized that those features were slowing down my system. In particular, column number, which-function, and selection-info, and my custom unicode display had to be updated on every keystroke. I went back to the default mode line and used this trick to see when it was recalculated:

(defvar-local mode-line-eval-count 0 "Counting :eval")

;;; put this in mode-line-format
 '(:eval (progn
           (setq mode-line-eval-count (+ 1 mode-line-eval-count))
           (format "%+4d " mode-line-eval-count))))

Every recalculation, the counter increases. By experimenting with the default mode line, I found that having %c in the mode line (column number) causes it to redisplay (almost) every keystroke, and %l (line number) causes it to redisplay when changing lines. I also realized during this experimentation that Emacs felt faster with the default mode line than with Spaceline.

I decided to switch from Spaceline to the default mode line, much closer to my setup before 2017, but simpler, more modular, and matching my tabbar. It feels nice and it looks good. I thought I would miss a few of the fancy features from Spaceline, but I didn't miss them as much as I thought I would. Features I use:

  • Read-only and modified status show a bright color on the left.
  • Project directory and filename are in separate colors.
  • The color theme depends on project (red for work, blue for personal, purple for configuration).
  • Week number ties into my task tracking system.
  • Line number uses Emacs 26's line-numbers-mode instead of the mode line.
Screenshot of Emacs tabbar, line-numbers-mode, and mode-line

I've put a simplified version of the code in a gist.


Fractal islands in the Pacific #

I'm not a big fan of the Pacific Ocean. There. I said it. I like water/land interfaces. Coasts, rivers, lakeshores, beaches, coral reefs, tide pools. The Pacific Ocean has too few of these. So … let's fix it. Here's an idea I had from around 2003 but never blogged about:

Drawing of earth with volcanic islands added
I couldn't find a whiteboard drawing from 2003 but I have this newer one


iTunes Sync Error -256 #

This was a mystery.

I had been messing with my photo sync settings in iTunes, so that I could get more photos onto my iPhone. I started getting this iTunes sync error, -256. I googled for this but naturally Google ignored "256", as it seems to enjoy ignoring the most important words in my queries. I couldn't find an answer, and I had no luck deleting and resyncing photos. I decided I should wipe the phone and restore from backup at some point, but "not today".

A few weeks later (today) I discovered the real culprit. At some point in the past few months I had accidentally deleted podcast files in iTunes. I had restored the iTunes catalog file, and I had restored the files themselves from Trash. Or so I thought. I discovered today that I hadn't gotten them all. Once I fixed that (by deleting in iTunes and telling it to download them again), the photo sync worked again!

Grr1: iTunes does too many things, and it's hard to diagnose errors. Grr2: "error -256" is unhelpful. If it told me what it was doing at the time, it would've helped me realize it was podcasts and not photos that were the problem. Grr3: iTunes catalog and the files on disk can get out of sync; this is fragile.

I'm writing this blog post so that if anyone else has error -256, and convinces Google not to ignore that term, they might find a solution here.