Created
March 22, 2013 22:09
-
-
Save mowen/5225169 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun org-pomodoro-refile (refile-heading) | |
"Move the heading at point to the heading specified." | |
(let ((match-found nil) | |
(paste-location (point))) | |
(save-excursion | |
(goto-char (point-min)) | |
(if (re-search-forward refile-heading nil t) | |
(progn | |
(backward-char) | |
(setq match-found t | |
paste-location (point))))) | |
(if match-found | |
(progn | |
(beginning-of-line) | |
(org-cut-subtree) | |
(goto-char paste-location) | |
(end-of-line) | |
(org-paste-subtree))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load "org-pomodoro") | |
(ert-deftest org-pomodoro-refile-down () | |
(with-temp-buffer | |
(insert-file "test.org") | |
(search-forward "test 2") | |
(beginning-of-line) | |
(forward-char 3) | |
(org-pomodoro-refile "Activity Inventory") | |
(search-forward "test 2") | |
(should (= 83 (point))))) | |
(ert-deftest org-pomodoro-refile-up () | |
(with-temp-buffer | |
(insert-file "test.org") | |
(search-forward "test 2") | |
(org-pomodoro-refile "Current Task") | |
(goto-char (point-min)) | |
(search-forward "test 2") | |
(should (= 25 (point))))) | |
(ert-deftest org-pomodoro-refile-nonexistent-heading () | |
(with-temp-buffer | |
(insert-file "test.org") | |
(search-forward "test 1") | |
(org-pomodoro-refile "Non existent") | |
(should (= 25 (point))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment