diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-12-10 01:14:17 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-12-10 01:14:17 -0500 |
commit | 0ea9f73242d0139aaca58695c059e31748a002f9 (patch) | |
tree | 8c3141b5193984877798ef7d1033b4b5df8cb01b /lisp | |
parent | 294e3c389f7fa883eb950bf1864e94fa1d34986e (diff) | |
download | emacs.d-0ea9f73242d0139aaca58695c059e31748a002f9.tar.gz |
Clean up and comment org-sort-parent
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-org.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el index e1fa33f..35a39cb 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -190,14 +190,16 @@ After sorting, the point is returned to its previous location under the current heading." (interactive "p") (let ((heading (org-no-properties (org-get-heading t t))) - starting-pos + (starting-pos (point)) chars-after-heading) - (setq starting-pos (point)) - (save-excursion - (org-back-to-heading t) - (setq chars-after-heading (- starting-pos (point))) - (outline-up-heading arg) - (call-interactively 'org-sort)) + (org-back-to-heading t) + (setq chars-after-heading (- starting-pos (point))) + (outline-up-heading arg) + (call-interactively #'org-sort) + ;; Sorting doesn't play well with `save-restriction' or markers, + ;; so just put the point where it was relative to original + ;; heading. This may not actually be the same tree if there are + ;; redundant headings. (goto-char (+ (org-find-exact-headline-in-buffer heading nil t) chars-after-heading)))) |