about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-17T12·03+0000
committerVincent Ambo <tazjin@google.com>2019-12-17T12·09+0000
commit940a9c580cd40b59afc743afc1265bfdc208453c (patch)
treee2a5c975d875861eec1fc7ad8f1637bd78763bc6 /tools
parentcc68e2851493bfe82e6034de8a4c0f0c6825fdec (diff)
feat(emacs.d): Add function to insert TODO comments r/176
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs/config/bindings.el3
-rw-r--r--tools/emacs/config/functions.el12
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/emacs/config/bindings.el b/tools/emacs/config/bindings.el
index 8f54d9cf55..a45c8d4707 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 e50950a8ef..6024ce34cb 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)