Variable: org-sort-function

org-sort-function is a customizable variable defined in org-macs.el.

Value

string-collate-lessp

Documentation

Function used to compare strings when sorting.

This function affects how Org mode sorts headlines, agenda items, table lines, etc.

The function must accept either 2 or 4 arguments: strings to compare and, optionally, LOCALE and IGNORE-CASE - locale name and flag to make comparison case-insensitive.

The default value uses sorting rules according to OS language. Users who want to make sorting language-independent, may customize the value to org-sort-function-fallback.

Note that some string sorting rules are known to be not accurate on MacOS. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275. MacOS users may customize the value to org-sort-function-fallback.

This variable was added, or its default value changed, in Org version
9.7.

Source Code

;; Defined in ~/.emacs.d/elpa/org-9.8.2/org-macs.el
;;; String manipulation

(defcustom org-sort-function #'string-collate-lessp
  "Function used to compare strings when sorting.
This function affects how Org mode sorts headlines, agenda items,
table lines, etc.

The function must accept either 2 or 4 arguments: strings to compare
and, optionally, LOCALE and IGNORE-CASE - locale name and flag to make
comparison case-insensitive.

The default value uses sorting rules according to OS language.  Users
who want to make sorting language-independent, may customize the value
to `org-sort-function-fallback'.

Note that some string sorting rules are known to be not accurate on
MacOS.  See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275.
MacOS users may customize the value to
`org-sort-function-fallback'."
  :group 'org
  :package-version '(Org . "9.7")
  :type '(choice
          (const :tag "According to OS language" string-collate-lessp)
          (const :tag "Using string comparison" org-sort-function-fallback)
          (function :tag "Custom function")))