Instantly share code, notes, and snippets.

@prathik /todo.el
Last active Jun 3, 2018

What would you like to do?
Manage daily todo files on Emacs
(defun todo-create-directory (directory)
"Creates the todo directory."
(if (file-exists-p directory) (message "Director exists")
(make-directory directory)
(message "Directory created")
(defun create-todo-file (directory filename)
"Checks if the todo file exists if not creates it."
(create-directory directory)
(if (file-exists-p filename) (message "Todo exists for the day")
(write-region "" nil filename)))
(defun open-todo-file (directory)
"Opens a todo file for the current day."
(let (
(concat directory "/" (format-time-string "%Y-%m-%d") ".org")))
(create-todo-file directory filename)
(find-file filename)))
(defun open-todo-file-interactive ()
"Creates 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."
(open-todo-file "~/todo"))
(global-set-key (kbd "C-c C-t") 'open-todo-file-interactive)

This comment has been minimized.

Copy link

greydonfoil commented Jan 26, 2018

Awesome gist. Line 10 in the current version needs to change to "create-directory" -> "todo-create-directory" after your most recent edits. Thanks for this!

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