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

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

[emacs-wiki-discuss] Improvements to planner-create-note-from-task


From: Chris Parsons
Subject: [emacs-wiki-discuss] Improvements to planner-create-note-from-task
Date: Wed, 01 Dec 2004 09:20:50 +0000
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (windows-nt)

Hi planner types,

Well, I was using the excellent new planner-create-note-from-task, and
thought, "wouldn't it be nice to have the note optionally created on the
plan page rather than the (less useful) date page? I must ask Sacha to
do that." 

And then I thought, "No! I'll venture into the previously unchartered
depths of lisp programming... and work out how to do it myself."

Here's my diff. Pass a prefix argument to always create on the plan
page. Perhaps this should be the default - Sacha's call, I guess.

Be gentle, it's my first proper lisp coding :)

--- c:/Program Files/emacs-21.3/site-lisp/planner/planner.el.orig       
2004-12-01 09:12:31.831323200 +0000
+++ c:/Program Files/emacs-21.3/site-lisp/planner/planner.el    2004-12-01 
09:18:22.675812800 +0000
@@ -1945,14 +1945,19 @@
 
 ;; Improvements:
 ;; - Link back to the task? 
-;; - Make it possible to have your note on another page?
-(defun planner-create-note-from-task ()
-  "Create a note based on the current task."
-  (interactive)
+(defun planner-create-note-from-task (&optional plan-page-p)
+  "Create a note based on the current task.
+Argument PLAN-PAGE-P is used to determine whether we put the new note on the 
task's plan page or on the current page."
+
+  (interactive "P")
   (let ((task-info (planner-current-task-info))
          note-num)
     (when task-info
-      (setq note-num (planner-create-note (planner-page-name)))
+                       ; If PLAN-PAGE-P and on a day page, we jump to the plan 
page 
+                       (when (and plan-page-p (string= (planner-task-date 
task-info) 
+                                                                               
 (planner-task-page task-info)))
+                               (planner-jump-to-linked-task task-info))
+                       (setq note-num (planner-create-note 
(planner-page-name)))
       (save-excursion
         (save-window-excursion
           (when (planner-find-task task-info)
 
Chris

PS: Sacha, I couldn't work out a better way of finding whether we are
on a date page or not... is there one?

-- 
Chris Parsons





reply via email to

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