diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-10-15 21:24:40 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-10-15 21:24:40 -0400 |
commit | 3d44737380569bf9c077d6b55d1800b30f9dfd66 (patch) | |
tree | 233e873208e64b487839c5dbc12b7066818fa140 | |
parent | f2918264af77e47f535db3c62d82c5a974634b13 (diff) | |
download | emacs.d-3d44737380569bf9c077d6b55d1800b30f9dfd66.tar.gz |
Add org-sort-all-level-headings command
-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)) |