When I have a large discriminated union in my code, or a large pattern match, or a large block of constants, I like to have some consistent easy way of organizing them, and so I like to
:sort them. For example,
type UbuntuVersion = // :sort | ArtfulAardvark | BreezyBadger ... | ZestyZapus // :sort
If I insert a new
BionicBeaver, I do not want to have to do the sort in my head, find the right place, and insert it. Nor do I want to have to manually select everything between the
// :sort markers. I would just like it to be auto-sorted at some sane point after insertion, such as immediately before save (or directly after insertion if there is any way to do that without causing chaos).
Is there an existing way to do this? The code files I particularly need it in are F# but I see this feature as agnostic to the major mode. Even if there isn't an existing plugin, surely to those wise in ELisp it would just be a block of 10 or 15 lines in some startup file? (I have still not had much of a chance to dig into ELisp.)
Even if there were a command that I would have to invoke manually, but that recognized the region I wanted rather than having me select it myself, that would be great optimization for me.