News for hackers. Stuff that matters.
Re:Sorting in Emacs by cle on Saturday August 12, 2023 @08:39AM (#37099575)
If this is Python, I'd just send it to a Python one-liner with C-u M-| and then:

    python -c 'import sys; v=eval(sys.stdin.read().strip()); v.sort(); print(v)'
It's hard to generalize these kinds of things, like if you have a list split across lines with different indentations, single/double quotes, trailing/non-trailing commas on the last value, etc. Probably best to just do the easiest thing to get them sorted and then use a keyboard macro or multiple-cursors to massage the output to your desired format.

There are no comments on this comment yet.