From 940a9c580cd40b59afc743afc1265bfdc208453c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 17 Dec 2019 12:03:57 +0000 Subject: feat(emacs.d): Add function to insert TODO comments --- tools/emacs/config/bindings.el | 3 +++ tools/emacs/config/functions.el | 12 ++++++++++++ 2 files changed, 15 insertions(+) (limited to 'tools/emacs') diff --git a/tools/emacs/config/bindings.el b/tools/emacs/config/bindings.el index 8f54d9cf554f..a45c8d4707ab 100644 --- a/tools/emacs/config/bindings.el +++ b/tools/emacs/config/bindings.el @@ -37,4 +37,7 @@ ;; Open a file in project: (global-set-key (kbd "C-c f") 'project-find-file) +;; Insert TODO comments +(global-set-key (kbd "C-c t") 'insert-todo-comment) + (provide 'bindings) diff --git a/tools/emacs/config/functions.el b/tools/emacs/config/functions.el index e50950a8ef9e..6024ce34cb83 100644 --- a/tools/emacs/config/functions.el +++ b/tools/emacs/config/functions.el @@ -230,4 +230,16 @@ Including indent-buffer, which should not be called automatically on save." (goto-char start) (insert memed)))) +(defun insert-todo-comment (prefix todo) + "Insert a comment at point with something for me to do." + + (interactive "P\nsWhat needs doing? ") + (save-excursion + (move-end-of-line nil) + (insert (format " %s TODO(%s): %s" + comment-start + (if prefix (read-string "Who needs to do this? ") + (getenv "USER")) + todo)))) + (provide 'functions) -- cgit 1.4.1