emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] Idea for improved automatic status reports


From: Seth Falcon
Subject: [emacs-wiki-discuss] Idea for improved automatic status reports
Date: Sun, 15 Jan 2006 10:28:28 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

The idea: 
  When a task is marked done, pop-up a remember-like buffer and allow
  the user to add a completion note to the task.

  A status report that culled completed tasks and their completion
  note if available would provide a nice accomplishment/status report.


What I've tried:

  - Add a function to planner-mark-task-hook that calls remember when
    the new-status is "done".  This almost works, but although
    remember gets called, I can't get the hook to display the
    *remember* buffer.

  - Then I realized I wanted a link in the task to the note.  Wanting
    to stick with the remember interface, I wrote a remember
    annotation function for tasks.  This is kind of nice because it
    allows you to add notes with the same interface everywhere, you
    just call remember.

  - From the annotation function, I tried marking the task complete,
    but this is almost certainly a bad idea as one looses track of the
    task if using planner-trunk, etc.

So other than writing my own remember-work-a-like, any ideas on how I
can either trigger remember properly after marking a task complete or
mark a task complete *after* I C-c C-c the remember buffer?  Seems
like I could advise the func run with C-c C-c, but I would only want
the advice if a particular annotation function was run.  Help, I'm
thinking of using a global variable!

Thanks for listening.

+ seth



PS: Here is the task annotation function:

To use it, set something like:

(add-to-list planner-annotation-functions 
             'syf/planner-annotation-from-planner-task)
(setq remember-annotation-functions planner-annotation-functions)

;; helper function
(defun syf/planner-get-next-note-num ()
  "Return the number to use for the next note"
  (save-excursion
    (planner-seek-to-first 'notes)
    (save-restriction
      (when (planner-narrow-to-section 'notes)
        (let ((total 1))
          (goto-char (point-min))
          (while (re-search-forward "^\\.#[0-9]+\\s-+" nil t)
            (setq total (1+ total)))
          total)))))

(defun syf/planner-annotation-from-planner-task ()
  "Set remember-initial-contents to the task description. Call
when the point is on a task.  This allows you to use the remember
interface to add notes to a task.  You also get nice timestamps
on your notes."
  (when (and (planner-derived-mode-p 'planner-mode)
             (planner-page-name))
    (save-excursion
      (let ((task-info (planner-current-task-info))
            (note-num (syf/planner-get-next-note-num)))
        (when (and task-info note-num)
          (setq remember-initial-contents 
                (concat (planner-task-description task-info)))
          ;; Add link to task description
          (save-excursion
            (save-window-excursion
              (when (planner-find-task task-info)
                (planner-edit-task-description
                 (concat (planner-task-description task-info) " "
                         (planner-make-link
                          (concat (planner-page-name) "#"
                                  (number-to-string note-num))
                          (format "(%d)" note-num)))))))
          "\n\n")))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]