Created
July 29, 2013 16:25
-
-
Save natfarleydev/6105561 to your computer and use it in GitHub Desktop.
Little function to clean org mode files that have no more TODO items in them from the org-agenda-file
This file contains hidden or 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
;; Function for cleaning org mode agenda | |
(defun clean-org-mode-agenda (tmp-org-agenda) | |
"Clean up all the org mode files that no longer have TODO items in" | |
(while tmp-org-agenda | |
(set-buffer (find-file-noselect (car tmp-org-agenda))) | |
(goto-char (point-min)) | |
(if (re-search-forward "^\*+ TODO" nil t 1) | |
() | |
(org-remove-file (car tmp-org-agenda)) | |
) | |
(setq tmp-org-agenda (cdr tmp-org-agenda)) | |
) | |
) | |
(defun really-clean-org-mode-agenda () | |
(interactive) | |
(clean-org-mode-agenda (org-agenda-files)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment