Hacker News new | ask | show | jobs
by Vekz 1239 days ago
One example of synergy I have is that of TODO code comments and org-mode agenda scheduling. For context, some programmers leave //TODO comments through their projects. org-mode uses a notation syntax of *TODO to capture and schedule an agenda item for later completion. These agenda items can be scheduled on a calendar and the agenda can be queried for day, week, month TODOS.

Org mode has custom templates for capturing org agenda items. I've made a "TODO code comment" capture template that I can execute on TODO comments. Once executed the template creates org-mode entries which are added to the calendar and link to the comments file and line number.

1 comments

this is one thing I miss in VSCode. Can you please share the lisp code you have to customize the org-mode for this. This will be a huge favor for a lot of programmers.
This is what I have, it def could be improved:

  (defun capture-comment-line (&optional line)
    (let ((c
          (save-excursion
            (save-window-excursion
              (switch-to-buffer (plist-get org-capture-plist :original-buffer))
            comment-start)
            )))
      (while (string-prefix-p c line)
        (setq line (string-remove-prefix c line)))
      (comment-string-strip line t t)
      ))

  (setq org-capture-templates
        '(("C" "TODO code comment" entry (file+headline "~/org/brain/code.org" "Tasks")
          "\* %(capture-comment-line \"%i\")\n  %a"
          )))
Thank you very much