A More Readable ‘C-h b’

It’s annoyed me for, well, decades that one of the (potentially) most useful ways to query Emacs about “well, what commands are available in this mode anyway?”, ‘C-h b’, is less than perfect.

So I’ve tweaked it.


Hitting ‘C-h b’ emacs-28 looks like this (by default):

But once you scroll past the 700 key translations, you get to the er juicy bits:

The code in ‘describe-buffer’ (which this is the output of) is very old, and probably hasn’t changed much over the decades. Emacs’s tag-line is, after all, “the self-documenting editor”, and this sort of output has been basic functionality in Emacs from the start.

The reason the layout hasn’t changed much is, basically, that it was implemented in C, and nobody wants to twiddle too much with finicky layout stuff in C. But last year Stefan Kangas reimplemented it all in Emacs Lisp, duplicating the output perfectly so that we’d have a known starting point when we started to change it.

Which I’ve now done.

To compare, side by side:

So the tweaked layout is more compact vertically, and the indentation is more consistent. And the “??” looked so mysterious, so they’re now expanded, and the non-informative “Prefix Command” bits are gone.

But, of course, the most controversial thing is this:

*gasp* A colourful symbol! It cannot be allowed!

We’ll see what the default ends up being. It can be tweaked endlessly by the user, of course. This is Emacs, after all.

7 thoughts on “A More Readable ‘C-h b’”

  1. whoa super neat.

    I guess the symbol to show the expanded/collapsed portions should be the same one used in the customize interface. Not because I think it is pretty, but, consistency. And it does get the job done…

Leave a Reply