Scott Novotney <snovot...@gmail.com> writes: > Hello, > > Does anyone know a way to sort headers or subheaders? I can sort items by > time in the agenda view, > but something more powerful, possibly by :TAG: or just by name would be very > useful.
You want org-sort. To sort your example by name, put the cursor in the top level heading (* Top) and then use M-x org-sort, and select 'a' for alphanumeric sort. org-sort calls org-sort-entries-or-items (unless you're in a table). Below is the documentation for that (C-h f org-sort-entries-or-items) [It looks like the main index of the manual needs a n entry under 'sort' or 'sorting'. Currently there's only one for sorting in the agenda.] Dan ,---- | org-sort-entries-or-items is an interactive compiled Lisp function in | `org.el'. | | (org-sort-entries-or-items &optional with-case sorting-type | getkey-func compare-func property) | | Sort entries on a certain level of an outline tree, or plain list items. | If there is an active region, the entries in the region are sorted. | Else, if the cursor is before the first entry, sort the top-level items. | Else, the children of the entry at point are sorted. | If the cursor is at the first item in a plain list, the list items will be | sorted. | | Sorting can be alphabetically, numerically, by date/time as given by | a time stamp, by a property or by priority. | | The command prompts for the sorting type unless it has been given to the | function through the sorting-type argument, which needs to a character, | (?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?r ?R ?f ?F). Here is the | precise meaning of each character: | | n Numerically, by converting the beginning of the entry/item to a number. | a Alphabetically, ignoring the TODO keyword and the priority, if any. | t By date/time, either the first active time stamp in the entry, or, if | none exist, by the first inactive one. | In items, only the first line will be chekced. | s By the scheduled date/time. | d By deadline date/time. | c By creation time, which is assumed to be the first inactive time stamp | at the beginning of a line. | p By priority according to the cookie. | r By the value of a property. | | Capital letters will reverse the sort order. | | If the sorting-type is ?f or ?F, then getkey-func specifies a function to be | called with point at the beginning of the record. It must return either | a string or a number that should serve as the sorting key for that record. | | Comparing entries ignores case by default. However, with an optional argument | with-case, the sorting considers case as well. `---- > > Example: > > * Top > ** C > ** B > ** A > > ----------------------------------------------------- > after some magic key combination > ----------------------------------------------------- > > * Top > ** A > ** B > ** C > > Thanks! > > -Scott > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode