diff options
-rw-r--r-- | lisp/km-org.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/km-org.el b/lisp/km-org.el index 2a00814..9f7c8f8 100644 --- a/lisp/km-org.el +++ b/lisp/km-org.el @@ -150,6 +150,16 @@ current heading." (outline-up-heading arg) (call-interactively #'org-sort))) +(defun km/org-sort-all-level-headings (level) + "Sort all buffer headings that are at LEVEL (default 1)." + (interactive "p") + (org-map-entries (lambda () + (when (and (= (org-current-level) level) + ;; Avoid "Nothing to sort" error. + (save-excursion (org-goto-first-child))) + (org-sort-entries nil ?a)))) + (message "Sorted headings at level %s" level)) + (defun km/org--prop-sort-args () "Return `org-sort-entries' arguments based on \"SORT\" property." (when (save-excursion (org-goto-first-child)) |