;;; org-todo-file.el --- Manage daily Org todo files. ;; Copyright © 2018 Oleg Pykhalov ;; This file is part of Emacs-org-todo-file. ;; Emacs-org-todo-file is free software; you can redistribute it ;; and/or modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation, either version 3 of ;; the License, or (at your option) any later version. ;; ;; Emacs-org-todo-file is distributed in the hope that it will be ;; useful, but WITHOUT ANY WARRANTY; without even the implied warranty ;; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with Emacs-org-todo-file. ;; If not, see . ;;; Commentary: ;; This file provides `org-todo-file-open', the function to create ;; daily Org files. ;; ;; Inspired by ;; and . ;;; Code: (defun org-todo-create-directory (directory) "Creates the todo directory." (if (file-exists-p directory) (message "Director exists") (make-directory directory) (message "Directory created"))) (defun org-todo-file-create-todo-file (directory filename) "Checks if the todo file exists if not creates it." (org-todo-file-todo-create-directory directory) (if (file-exists-p filename) (message "Todo exists for the day") (write-region "" nil filename))) (defun org-todo-file-open-todo-file (directory) "Open a todo file for the current day." (let ((filename (concat directory "/" (format-time-string "%Y-%m-%d") ".org"))) (org-todo-file-create-todo-file directory filename) (find-file filename))) (defun org-todo-file-open-todo-file-interactive () "Create a daily todo file. Track what needs to be done for the day. Plan your day better. See what you have accomplished at the end of the day." (interactive) (org-todo-file-open-todo-file org-directory)) (provide 'org-todo-file) ;;; org-todo-file.el ends here