[oni-org] Add commands to move subtrees relative to others
This commit is contained in:
parent
297df3579d
commit
aaa5b89d0a
1 changed files with 22 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2022.0401.183938
|
;; Version: 2022.0424.025154
|
||||||
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
|
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -858,5 +858,26 @@ This is an around advice for ‘org-html--svg-image’ as FUN."
|
||||||
|
|
||||||
(defalias 'org-dblock-write:oni-project-steps 'oni-org-dblock-write-project-steps)
|
(defalias 'org-dblock-write:oni-project-steps 'oni-org-dblock-write-project-steps)
|
||||||
|
|
||||||
|
;;; Moving subtrees
|
||||||
|
|
||||||
|
(defun oni-move-subtree-above ()
|
||||||
|
(interactive)
|
||||||
|
(let ((target (org-refile-get-location "Move subtree above")))
|
||||||
|
(org-cut-subtree)
|
||||||
|
(goto-char (nth 3 target))
|
||||||
|
(org-paste-subtree)))
|
||||||
|
|
||||||
|
(defun oni-move-subtree-below ()
|
||||||
|
(interactive)
|
||||||
|
(let* ((components (org-heading-components))
|
||||||
|
(target (org-refile-get-location "Move subtree below"))
|
||||||
|
(marker (copy-marker (nth 3 target))))
|
||||||
|
(org-cut-subtree)
|
||||||
|
(goto-char marker)
|
||||||
|
(org-forward-heading-same-level 1)
|
||||||
|
(when (= (point) (marker-position marker))
|
||||||
|
(goto-char (point-max)))
|
||||||
|
(org-paste-subtree (car components))))
|
||||||
|
|
||||||
(provide 'oni-org)
|
(provide 'oni-org)
|
||||||
;;; oni-org.el ends here
|
;;; oni-org.el ends here
|
||||||
|
|
Loading…
Reference in a new issue