Skip to content

hoclun-rigsep/org-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

org-sort.el

An LLM wrote this README so beware.

A utility script for sorting top-level headings in Org-mode files. It reads an Org file from standard input, sorts its top-level headings based on specified keys, and writes the sorted output to standard output. Requires `emacs` with `org-mode`.

Usage

Basic usage:

./org-sort.el -- --key=a < input.org > output.org

Note double dash before actual options.

Multiple keys can be specified. The first key given acts as the primary sort key.

./org-sort.el -- --key=t --key=a < input.org > output.org

Combined codes can also be used with `-k`:

./org-sort.el -- -k pA < input.org > output.org

But emacs option parsing apparently does not like -- -kpA. You need the space in there.

Sort Keys

Uppercase reverses the sort order.

CodeDescription
`a`Alphabetical (headline text)
`n`Numeric within headline
`o`TODO keyword order
`p`Priority cookie
`s`SCHEDULED timestamp
`d`DEADLINE timestamp
`t`Other timestamp in headline

Examples

  • Sort alphabetically:
    ./org-sort.el -- --key=a < in.org
        
  • Sort by SCHEDULED timestamp (descending), then by priority (ascending):
    ./org-sort.el -- -k S -k p < in.org
        
  • Sort by TODO keyword order (ascending):
    ./org-sort.el -- --key=o < in.org
        

About

Filter script for sorting org-mode headlines; requires emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published