Skip to content

Instantly share code, notes, and snippets.

@mowen
Created March 22, 2013 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mowen/5225169 to your computer and use it in GitHub Desktop.
Save mowen/5225169 to your computer and use it in GitHub Desktop.
(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)))))
(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)))))

Current Task

test 1

To Do Today

test 2

Woo Hoo 2

Activity Inventory

Progress

[2013-03-08 Fri]

[2013-03-07 Thu]

[2013-03-06 Wed]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment