• XEmacs: Sorting Key-Value Lines by Value

    From Johann 'Myrkraverk' Oskarsson@21:1/5 to All on Fri Dec 15 19:40:36 2017
    Hi, This is a short edition of my blog at


    http://www.myrkraverk.com/blog/2017/12/xemacs-sorting-key-value-lines-by-value/

    To cut to the chase, to sort key: value lines in numerical order by
    value, drop this into your ~/.xemacs/init.el

    (defun my-sort-key-value-lines (beg end)
    (interactive "r")
    (save-excursion
    (save-restriction
    (narrow-to-region beg end)
    (goto-char (point-min))
    (sort-subr nil 'forward-line 'end-of-line
    (lambda ()
    (search-forward ":" nil nil 1)
    (string-to-number
    (buffer-substring (point)
    (point-at-eol))))))))

    The code can be considered WTFPL 2.0, because there's only so much you
    can do with boilerplate.

    --
    Johann | email: invalid -> com | www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | twitter: @myrkraverk

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)