Skip to content

Instantly share code, notes, and snippets.

@prathik
Last active September 27, 2020 05:27
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save prathik/ae2899ae2c432dcb0cfe966aa3683eb3 to your computer and use it in GitHub Desktop.
Save prathik/ae2899ae2c432dcb0cfe966aa3683eb3 to your computer and use it in GitHub Desktop.
Manage daily todo files on Emacs
(defun todo-create-directory (directory)
"Creates the todo directory."
(if (file-exists-p directory) (message "Directory exists")
(make-directory directory)
(message "Directory created")
))
(defun create-todo-file (directory filename)
"Checks if the todo file exists if not creates it."
(todo-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 (
(filename
(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."
(interactive)
(open-todo-file "~/todo"))
(global-set-key (kbd "C-c C-t") 'open-todo-file-interactive)
@greydonfoil
Copy link

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!

@prathik
Copy link
Author

prathik commented Sep 27, 2020

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!

Thanks @greydonfoil! However I have moved away from this format for my todos now, check this out https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html it's a great way to manage todos.

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