Skip to main content

Use the sorting tag for questions involving arranging things in a defined order: sorting lines alphabetically, bibtex entries by date or author, emails by sender, completion candidates by various criteria, etc.

Emacs provides basic text-sorting functions in library sort.el. This includes

  • sort-lines
  • sort-paragraphs
  • sort-pages
  • sort-fields
  • sort-numeric-fields
  • sort-columns
  • reverse-region

Details are provided in the manual node (emacs) Sorting. Further details are provided in the Elisp manual, and many packages provide sorting functions for their particular subject.