diff options
author | Franck Cuny <franck.cuny@gmail.com> | 2019-12-09 12:52:37 -0800 |
---|---|---|
committer | Franck Cuny <franck.cuny@gmail.com> | 2019-12-09 12:52:37 -0800 |
commit | 0490a5a4f1936b6888a070e840740e152f04c3de (patch) | |
tree | 9d47c1bb51e823a60c50e46d0e981adfabdbc494 /emacs.d/custom/fcuny-org.el | |
parent | [org] add `orgit` to my configuration. (diff) | |
download | emacs.d-0490a5a4f1936b6888a070e840740e152f04c3de.tar.gz |
[org] put all configs related to org together
Instead of having functions related to org in another file, move everything in a single file, this makes it easier to find dead code and update some functions.
Diffstat (limited to '')
-rw-r--r-- | emacs.d/custom/fcuny-org.el | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/emacs.d/custom/fcuny-org.el b/emacs.d/custom/fcuny-org.el index dae6c7a..8ab36f4 100644 --- a/emacs.d/custom/fcuny-org.el +++ b/emacs.d/custom/fcuny-org.el @@ -293,4 +293,47 @@ The current time is used if the entry has no timestamp." (interactive) (fcuny/org-refile-to-datetree org-default-work-journal-file)) +(defun fcuny/org-subtree-region () + "Return a list of the start and end of a subtree." + (save-excursion + (list (progn (org-back-to-heading) (point)) + (progn (org-end-of-subtree) (point))))) + +(defun fcuny/org-refile-directly (file-dest) + "Move the current subtree to the end of FILE-DEST. +If SHOW-AFTER is non-nil, show the destination window, +otherwise, this destination buffer is not shown." + (interactive "fDestination: ") + + (defun dump-it (file contents) + (find-file-other-window file-dest) + (goto-char (point-max)) + (insert "\n" contents)) + + (save-excursion + (let* ((region (fcuny/org-subtree-region)) + (contents (buffer-substring (first region) (second region)))) + (apply 'kill-region region) + (save-window-excursion (dump-it file-dest contents))))) + +(defun fcuny/org-refile-to-task () + "Refile (move) the current Org subtree to `org-default-tasks-file'." + (interactive) + (fcuny/org-refile-directly org-default-tasks-file)) + +(defun fcuny/org-refile-to-personal () + "Refile (move) the current Org subtree to `org-default-personal-file'." + (interactive) + (fcuny/org-refile-directly org-default-personal-file)) + +(defun fcuny/org-refile-to-notes () + "Refile (move) the current Org subtree to `org-default-notes-file'." + (interactive) + (fcuny/org-refile-directly org-default-notes-file)) + +(defun fcuny/org-refile-to-work () + "Refile (move) the current Org subtree to `org-default-work-file'." + (interactive) + (fcuny/org-refile-directly org-default-work-file)) + (provide 'fcuny-org) |