Subject: bug#70530: Better sorting for describe-bindings and describe-mode

From: Dan Jacobson <[email-masked]>
Date: Tue, 23 Apr 2024 18:04:27 +0800

I discovered that
C-h m describe-mode and thus also
C-h b describe-bindings
are several times more helpful, if sorted by the last field, not the first.
E.g., for
$ emacs file.html #then C-h m and save to a file and pipe it to
grep --perl-regexp \\t | expand | sort -k 1.16 #giving:

C-c C-a         sgml-attributes
C-c /           sgml-close-tag
C-c C-e         sgml-close-tag
C-c ]           sgml-close-tag
C-c C-d         sgml-delete-tag
C-c DEL         sgml-delete-tag
C-c C-n         sgml-name-char
C-c <left>      sgml-skip-tag-backward
C-c C-b         sgml-skip-tag-backward
C-c <right>     sgml-skip-tag-forward
C-c C-f         sgml-skip-tag-forward
/               sgml-slash
C-c C-o         sgml-tag
C-c C-t         sgml-tag
C-c ?           sgml-tag-help

Allowing the user to suddenly see all the alternate bindings in a glance.

Therefore I propose C-h b and C-h m start listing them that way, or at least offer an option to do so. Thanks.

Wait, hold on. Let's examine the default sort order.

...
C-c <left>	sgml-skip-tag-backward
C-c <right>	sgml-skip-tag-forward

C-M-i		ispell-complete-word

M-o M-o		font-lock-fontify-block

C-c C-c #	html-id-anchor
C-c C-c -	html-horizontal-rule
C-c C-c c	html-checkboxes
...

We see that there is no default sort order.
It's all just glued together as processing proceeded.
Even more reason to use my brilliant proposed order.

GNU Emacs 29.3