emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* postponing todos
@ 2007-08-06 15:42 ignotus
  2007-08-06 23:18 ` Bastien
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: ignotus @ 2007-08-06 15:42 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I would like to have a solution for the following problem:  I browse
TODOs in my agenda view and I would like to postpone them, so agenda
buffers don't list them until a certain date.

I would like to quickly (by using shortcuts) postpone a todo entry from
the agenda buffer by:
  - 1-2-3 day
  - coming monday/friday
  - next monday/friday


What is possible with current org mode?

Thanks, Richard

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-06 15:42 postponing todos ignotus
@ 2007-08-06 23:18 ` Bastien
  2007-08-07  0:56   ` Bastien
  2007-08-07  8:41   ` ignotus
  2007-08-07  1:47 ` Eddward DeVilla
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 16+ messages in thread
From: Bastien @ 2007-08-06 23:18 UTC (permalink / raw)
  To: emacs-orgmode

ignotus@freemail.hu writes:

> I would like to have a solution for the following problem:  I browse
> TODOs in my agenda view and I would like to postpone them, so agenda
> buffers don't list them until a certain date.
>
> I would like to quickly (by using shortcuts) postpone a todo entry from
> the agenda buffer by:
>   - 1-2-3 day
>   - coming monday/friday
>   - next monday/friday
>
> What is possible with current org mode?

I don't think so, and i'm not sure on how it could be implemented. 

Maybe a :WarningAtDay: property? Conceptually this requires that we're
able to distinguish between postponing the date a todo is displayed on
and postponing the todo itself (the day it's supposed to be done)...
All this might be a bit confusing.

If you need this for only a few todos, you might assign a DEADLINE to
them, then set `org-deadline-warning-days' so that they pop up in the
agenda view at the desired date.

-- 
Bastien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-06 23:18 ` Bastien
@ 2007-08-07  0:56   ` Bastien
  2007-08-07  8:41   ` ignotus
  1 sibling, 0 replies; 16+ messages in thread
From: Bastien @ 2007-08-07  0:56 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

>> I would like to quickly (by using shortcuts) postpone a todo entry from
>> the agenda buffer by:
>>   - 1-2-3 day
>>   - coming monday/friday
>>   - next monday/friday
>>
>> What is possible with current org mode?
>
> I don't think so, and i'm not sure on how it could be implemented. 
>
> Maybe a :WarningAtDay: property? Conceptually this requires that we're
> able to distinguish between postponing the date a todo is displayed on
> and postponing the todo itself (the day it's supposed to be done)...
> All this might be a bit confusing.

Trying to think further, i stumbled on this idea: what about having
something like an _AGENDA suffix for properties that would make the
agenda decide whether it should get the entry or not?

For example, here is a todo:

,----
| * Try to avoid stupid examples
|   :PROPERTIES:
|   :WarningAtDay_AGENDA: <2007-11-11 dim>
|   :END:
`----

When getting entries for the agenda display, Org might an entry with
such a _AGENDA property. Then Org's job would be to check whether this
entry has to be included in the results or not. For doing so, it will
have to call a user-defined function like :

,----
| (defun org-agenda-get-entry:WarningAtDay (param)
|   ...
|   [Returns t or nil depending on param]
|   ...)
`----

If the function returns t (e.g. if the function above says that today is
later than the value of WarningAtDay_AGENDA), then the todo is included.

This way each user could (easily) define its own rules for deciding what
entries should appear in the agenda display.

But enough speculation for tonight :)

-- 
Bastien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-06 15:42 postponing todos ignotus
  2007-08-06 23:18 ` Bastien
@ 2007-08-07  1:47 ` Eddward DeVilla
  2007-08-07  8:25   ` ignotus
  2007-08-07 20:14 ` Christian Egli
  2007-08-09  5:05 ` Carsten Dominik
  3 siblings, 1 reply; 16+ messages in thread
From: Eddward DeVilla @ 2007-08-07  1:47 UTC (permalink / raw)
  To: ignotus@freemail.hu; +Cc: emacs-orgmode

On 8/6/07, ignotus@freemail.hu <ignotus@freemail.hu> wrote:
> Hello,
>
> I would like to have a solution for the following problem:  I browse
> TODOs in my agenda view and I would like to postpone them, so agenda
> buffers don't list them until a certain date.
>
> I would like to quickly (by using shortcuts) postpone a todo entry from
> the agenda buffer by:
>   - 1-2-3 day
>   - coming monday/friday
>   - next monday/friday
>
>
> What is possible with current org mode?

I just tend to use the todo list, but I would guess that you might be
able to use SCHEDULED for the day you want the item to appear and then
maybe write a few special functions/bindings to set SCHEDULE to today
+ 1..3 or the next monday or friday.

Edd

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-07  1:47 ` Eddward DeVilla
@ 2007-08-07  8:25   ` ignotus
  2007-08-07 17:13     ` Bastien
  2007-08-07 20:03     ` Christian Egli
  0 siblings, 2 replies; 16+ messages in thread
From: ignotus @ 2007-08-07  8:25 UTC (permalink / raw)
  To: Eddward DeVilla; +Cc: emacs-orgmode

>>>>> Regarding 'Re: [Orgmode] postponing todos'; Eddward DeVilla adds:


  > On 8/6/07, ignotus@freemail.hu <ignotus@freemail.hu> wrote:
  >> Hello,

  >> I would like to have a solution for the following problem: I browse

  >> TODOs in my agenda view and I would like to postpone them, so
  >> agenda buffers don't list them until a certain date.

  >> I would like to quickly (by using shortcuts) postpone a todo entry
  >> from the agenda buffer by:
  >> - 1-2-3 day
  >> - coming monday/friday
  >> - next monday/friday


  >> What is possible with current org mode?

  > I just tend to use the todo list, but I would guess that you might
  > be able to use SCHEDULED for the day you want the item to appear and
  > then maybe write a few special functions/bindings to set SCHEDULE to
  > today
  > + 1..3 or the next monday or friday.

At the moment, all uncompleted todo entries appear in my agenda views,
regardless of scheduling.  Is there something I could use as query
string to filter the list based on scheduling, like "SCHEDULED=today"?

I searched the documentation but haven't found anything.

Thanks, Richard

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-06 23:18 ` Bastien
  2007-08-07  0:56   ` Bastien
@ 2007-08-07  8:41   ` ignotus
  1 sibling, 0 replies; 16+ messages in thread
From: ignotus @ 2007-08-07  8:41 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> Regarding 'Re: postponing todos'; Bastien adds:


  >> What is possible with current org mode?

  > I don't think so, and i'm not sure on how it could be implemented.

I always use org-tags-view to list my todo entries and I hoped that
with a clever MATCH string one could filter the searches based on
scheduling / deadlines.  I think that would be an ideal solution.

,----
| `org-tags-view' is an interactive Lisp function
|   -- loaded from "org"
| (org-tags-view &optional TODO-ONLY MATCH)
| 
| Documentation:
| Show all headlines for all `org-agenda-files' matching a TAGS criterion.
| The prefix arg TODO-ONLY limits the search to TODO entries.
`----

-- 
Richard

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-07  8:25   ` ignotus
@ 2007-08-07 17:13     ` Bastien
  2007-08-07 20:03     ` Christian Egli
  1 sibling, 0 replies; 16+ messages in thread
From: Bastien @ 2007-08-07 17:13 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

Hi Richard,

ignotus@freemail.hu writes:

> At the moment, all uncompleted todo entries appear in my agenda views,
> regardless of scheduling. Is there something I could use as query
> string to filter the list based on scheduling, like "SCHEDULED=today"?

One way to do this is to define your own agenda view through
`org-agenda-custom-commands': 

For example:


[-- Attachment #2: bzg-agenda-command.el --]
[-- Type: application/emacs-lisp, Size: 940 bytes --]

[-- Attachment #3: Type: text/plain, Size: 275 bytes --]


BTW: you can replace :timestamp by :deadline or whatever `org-diary' is
supposed to understand -- but so far i cannot get :scheduled display
today's scheduled entries. I think it's a bug about time computation in
`org-agenda-get-day-entries'.

Hope this helps,

-- 
Bastien

[-- Attachment #4: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-07  8:25   ` ignotus
  2007-08-07 17:13     ` Bastien
@ 2007-08-07 20:03     ` Christian Egli
  1 sibling, 0 replies; 16+ messages in thread
From: Christian Egli @ 2007-08-07 20:03 UTC (permalink / raw)
  To: emacs-orgmode


ignotus@freemail.hu writes:

> At the moment, all uncompleted todo entries appear in my agenda views,
> regardless of scheduling.  Is there something I could use as query
> string to filter the list based on scheduling, like "SCHEDULED=today"?
>
> I searched the documentation but haven't found anything.

Maybe you've set org-agenda-include-all-todo to true?

Try M-x customize-variable org-agenda-include-all-todo RET

org-agenda-include-all-todo is a variable defined in `org.el'.
Its value is t


Documentation:
Set  means weekly/daily agenda will always contain all TODO entries.
The TODO entries will be listed at the top of the agenda, before
the entries for specific days.

You can customize this variable.

Hope that helps
Christian

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-06 15:42 postponing todos ignotus
  2007-08-06 23:18 ` Bastien
  2007-08-07  1:47 ` Eddward DeVilla
@ 2007-08-07 20:14 ` Christian Egli
  2007-08-09  5:05 ` Carsten Dominik
  3 siblings, 0 replies; 16+ messages in thread
From: Christian Egli @ 2007-08-07 20:14 UTC (permalink / raw)
  To: emacs-orgmode


Hi

ignotus@freemail.hu writes:

> I would like to have a solution for the following problem:  I browse
> TODOs in my agenda view and I would like to postpone them, so agenda
> buffers don't list them until a certain date.
>
> I would like to quickly (by using shortcuts) postpone a todo entry from
> the agenda buffer by:
>   - 1-2-3 day
>   - coming monday/friday
>   - next monday/friday
>
>
> What is possible with current org mode?

What I usually do is to schedule the TODOs for a specific day. Then I
use the weekly agenda where I can postpone the TODOs easily with
S-<right> and S-<left>. So a move of a couple of days is easily
done. You can even specify the number of days to move forward or back
with e.g. C-u 5 S-<right>.

It would be fairly easy to extend the function behind S-<right>
(org-agenda-date-later) to do some date calculation (next monday, etc)
with the help of the calendar routines and to bind this to some key in
the agenda view.

C-h f org-agenda-date-later RET should give you a lead.

HTH
Christian

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-06 15:42 postponing todos ignotus
                   ` (2 preceding siblings ...)
  2007-08-07 20:14 ` Christian Egli
@ 2007-08-09  5:05 ` Carsten Dominik
  2007-08-11 14:29   ` ignotus
  2007-08-11 15:31   ` ignotus
  3 siblings, 2 replies; 16+ messages in thread
From: Carsten Dominik @ 2007-08-09  5:05 UTC (permalink / raw)
  To: ignotus; +Cc: emacs-orgmode


On Aug 6, 2007, at 17:42, ignotus@freemail.hu wrote:

> Hello,
>
> I would like to have a solution for the following problem:  I browse
> TODOs in my agenda view and I would like to postpone them, so agenda
> buffers don't list them until a certain date.
>
> I would like to quickly (by using shortcuts) postpone a todo entry from
> the agenda buffer by:
>   - 1-2-3 day
>   - coming monday/friday
>   - next monday/friday
>
>
> What is possible with current org mode?

This is what scheduling is for, and then you use the daily/weekly agenda
instead of the todo list to see those entries.  To schedule, use
`C-c C-s', either in the org-mode buffer or in the agenda.
 From the date prompt, you can use

+1
+2
+3

to quickly set the date to today+N days.

Fri
Mon

set it to the coming Friday/Monday.

If the entry has a scheduled date already you can shift this date
with S-right.  And you can use a prefix argument.  for example

7 S-right

will shift the date by 7 days.

- Carsten

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-09  5:05 ` Carsten Dominik
@ 2007-08-11 14:29   ` ignotus
  2007-08-21 10:19     ` Carsten Dominik
  2007-08-11 15:31   ` ignotus
  1 sibling, 1 reply; 16+ messages in thread
From: ignotus @ 2007-08-11 14:29 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> Regarding 'Re: [Orgmode] postponing todos'; Carsten Dominik adds:


  >> I would like to have a solution for the following problem: I browse
  >> TODOs in my agenda view and I would like to postpone them, so
  >> agenda buffers don't list them until a certain date. [....]

  > This is what scheduling is for, and then you use the daily/weekly
  > agenda instead of the todo list to see those entries.  To schedule,
  > [....]

Dear Carsten, your reply was as always most helpful and full of
information, thanks.  However that is not good for me.  I use
org-tags-view all the time, because that way only those tasks get listed
that I can actually do (based on context).  I would like to have an
option, that when turned on means that org-tags-view lists all the TODOs
that aren't scheduled in the future.

What do you think Carsten?

Richard

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: postponing todos
  2007-08-09  5:05 ` Carsten Dominik
  2007-08-11 14:29   ` ignotus
@ 2007-08-11 15:31   ` ignotus
  2007-08-11 16:34     ` Bastien
  1 sibling, 1 reply; 16+ messages in thread
From: ignotus @ 2007-08-11 15:31 UTC (permalink / raw)
  To: emacs-orgmode

I hack together something that does what I needed.  I don't know org
internal workings, so it is just a quick and dirty hack.  I don't really
know about agenda views as such, maybe what I want to do is possible
with actual org mode stuff, but with my modification org does exactly
what I want the way I want it.  Please Carsten, consider adding
something like this to org-mode.  

Bastien posted another solution that probably does something very
similar but with lot less internal hacking, Bastien please comment.

> ------------------------------------------------------------------------

GOAL: be able to tell org-tags-view to only list entries, that are not
scheduled into the future.  With org-scan-not-future set to nil, users
get standard org behaviour.

CODE:  one new variable and one modified function (ORG-SCAN-TAGS)
 lines marked with ADDED are added by me.

(defvar org-scan-not-future t           ;<<-- ADDED
  "Don't include entries, that are scheduled into the future.")

(defun org-scan-tags (action matcher &optional todo-only)
  "Scan headline tags with inheritance and produce output ACTION.
ACTION can be `sparse-tree' or `agenda'.  MATCHER is a Lisp form to be
evaluated, testing if a given set of tags qualifies a headline for
inclusion.  When TODO-ONLY is non-nil, only lines with a TODO keyword
are included in the output."
  (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\("
		     (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
		     (org-re
		      "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$")))
	 (props (list 'face nil
		      'done-face 'org-done
		      'undone-face nil
		      'mouse-face 'highlight
		      'org-not-done-regexp org-not-done-regexp
		      'org-todo-regexp org-todo-regexp
		      'keymap org-agenda-keymap
		      'help-echo
		      (format "mouse-2 or RET jump to org file %s"
			      (abbreviate-file-name buffer-file-name))))
	 (case-fold-search nil)
         (org-props nil)                ; <<-- ADDED
         lspos
	 tags tags-list tags-alist (llast 0) rtn level category i txt
	 todo marker entry priority)
    (save-excursion
      (goto-char (point-min))
      (when (eq action 'sparse-tree) (org-overview))
      (while (re-search-forward re nil t)
	(catch :skip
          (setq org-props               ; <<-- ADDED
                (save-match-data        ; <<-- ADDED
                  (save-excursion       ; <<-- ADDED
                    (save-restriction   ; <<-- ADDED
                      (org-entry-properties))))) ; <<-- ADDED
	  (setq todo (if (match-end 1) (match-string 2))
		tags (if (match-end 4) (match-string 4)))
	  (goto-char (setq lspos (1+ (match-beginning 0))))
	  (setq level (org-reduced-level (funcall outline-level))
		category (org-get-category))
	  (setq i llast llast level)
	  ;; remove tag lists from same and sublevels
	  (while (>= i level)
	    (when (setq entry (assoc i tags-alist))
	      (setq tags-alist (delete entry tags-alist)))
	    (setq i (1- i)))
	  ;; add the nex tags
	  (when tags
	    (setq tags (mapcar 'downcase (org-split-string tags ":"))
		  tags-alist
		  (cons (cons level tags) tags-alist)))
	  ;; compile tags for current headline
	  (setq tags-list
		(if org-use-tag-inheritance
		    (apply 'append (mapcar 'cdr tags-alist))
		  tags))
	  (when (and (or (not todo-only) (member todo org-not-done-keywords))
		     (eval matcher)
		     (or (not org-agenda-skip-archived-trees)
			 (not (member org-archive-tag tags-list)))
                     )
	    (and (eq action 'agenda) (org-agenda-skip))
	    ;; list this headline
	    (if (eq action 'sparse-tree)
		(progn
		  (org-show-context 'tags-tree))
	      (setq txt (org-format-agenda-item
			 ""
			 (concat
			  (if org-tags-match-list-sublevels
			      (make-string (1- level) ?.) "")
			  (org-get-heading))
			 category tags-list)
		    priority (org-get-priority txt))
	      (goto-char lspos)
	      (setq marker (org-agenda-new-marker))
	      (org-add-props txt props
		'org-marker marker 'org-hd-marker marker 'org-category category
		'priority priority 'type "tagsmatch")
              ; v-- ADDED
              (if org-scan-not-future
                  (if (assoc "SCHEDULED" org-props)
                      ;; scheduled for today, or past?
                      (and (<= (org-days-to-time (cdr (assoc "SCHEDULED" org-props)))
                               0)
                           (push txt rtn))
                      ;; not scheduled, keeper
                      (push txt rtn))
                  (push txt rtn))
              ; ^-- ADDED
	      ;;(push txt rtn)        ; <<-- ADDED (commented out)
              )
	    ;; if we are to skip sublevels, jump to end of subtree
	    (or org-tags-match-list-sublevels (org-end-of-subtree t)))
          )))
    (when (and (eq action 'sparse-tree)
	       (not org-sparse-tree-open-archived-trees))
      (org-hide-archived-subtrees (point-min) (point-max)))
    (nreverse rtn)))

-- 
Udv, Ricsi

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Re: postponing todos
  2007-08-11 15:31   ` ignotus
@ 2007-08-11 16:34     ` Bastien
  0 siblings, 0 replies; 16+ messages in thread
From: Bastien @ 2007-08-11 16:34 UTC (permalink / raw)
  To: emacs-orgmode

ignotus@freemail.hu writes:

> Bastien posted another solution that probably does something very
> similar but with lot less internal hacking, Bastien please comment.

The solution you propose lets the user restrict the output of
`org-tags-view' to the past (and today's) entries.

All my little hack[1] does is to display an agenda buffer listing 
those entries that:

 - have a timestamp for today 
 - match a regular expression

I thought it could be a good start for your problem. But it's not as
general as your code -- it's just an example of what you can do with
`org-agenda-custom-commands' to make it suit your needs.

Notes: 
[1]  http://article.gmane.org/gmane.emacs.orgmode/2613

-- 
Bastien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Re: postponing todos
  2007-08-11 14:29   ` ignotus
@ 2007-08-21 10:19     ` Carsten Dominik
  2007-08-21 10:43       ` Carsten Dominik
  2007-08-21 11:33       ` Bastien
  0 siblings, 2 replies; 16+ messages in thread
From: Carsten Dominik @ 2007-08-21 10:19 UTC (permalink / raw)
  To: ignotus; +Cc: emacs-orgmode


On Aug 11, 2007, at 16:29, ignotus@freemail.hu wrote:

>>>>>> Regarding 'Re: [Orgmode] postponing todos'; Carsten Dominik adds:
>
>
>>> I would like to have a solution for the following problem: I browse
>>> TODOs in my agenda view and I would like to postpone them, so
>>> agenda buffers don't list them until a certain date. [....]
>
>> This is what scheduling is for, and then you use the daily/weekly
>> agenda instead of the todo list to see those entries.  To schedule,
>> [....]
>
> Dear Carsten, your reply was as always most helpful and full of
> information, thanks.  However that is not good for me.  I use
> org-tags-view all the time, because that way only those tasks get 
> listed
> that I can actually do (based on context).  I would like to have an
> option, that when turned on means that org-tags-view lists all the 
> TODOs
> that aren't scheduled in the future.

This can be achieved, as has been shown by you and by Bastien, using
special user-defined commands.

Another option, maybe simpler, is to use the local options in agenda
custom commands to insert a function into `org-agenda-skip-function'.

For example, I can write this function:

(defun org-agenda-skip-if-scheduled ()
   "Function that can be used in `org-agenda-skip-function',
to skip entries that have been scheduled."
   (let (beg end)
     (org-back-to-heading t)
     (setq beg (point))         ; beginning of headline
     (outline-next-heading)
     (setq end (point))         ; end of entry below heading
     (goto-char beg)
     (if (re-search-forward org-scheduled-time-regexp end t)
         end   ; skip, and continue search after END
       nil     ; Don't skip, use this entry.
)))

and then define a custom command like this:

(setq org-agenda-custom-commands
     '(("b" tags "@SHOP"
         ((org-agenda-skip-function org-agenda-skip-if-scheduled)))))

org-agenda-skip-function should *never* be set with `setq' or so,
but you can use the options field in custom commands to temporarily
assign a value.

The next version will have two functions,
org-agenda-skip-if-scheduled and
org-agenda-skip-if-scheduled-or-deadline
built-in, so it will be easier to find entries that have no deadline 
and/or
have not been scheduled.  For your specific application, I guess you
also have to look at the timestamp and see if it is in the future.
Having seen your other lisp code, I guess you can do this yourself.

Hope this helps.

- Carsten

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Re: postponing todos
  2007-08-21 10:19     ` Carsten Dominik
@ 2007-08-21 10:43       ` Carsten Dominik
  2007-08-21 11:33       ` Bastien
  1 sibling, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2007-08-21 10:43 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: ignotus, emacs-orgmode

My apologies, my previous post contains two errors.

On Aug 21, 2007, at 12:19, Carsten Dominik wrote:

>
> On Aug 11, 2007, at 16:29, ignotus@freemail.hu wrote:
>
>>>>>>> Regarding 'Re: [Orgmode] postponing todos'; Carsten Dominik adds:
>>
>>
>>>> I would like to have a solution for the following problem: I browse
>>>> TODOs in my agenda view and I would like to postpone them, so
>>>> agenda buffers don't list them until a certain date. [....]
>>
>>> This is what scheduling is for, and then you use the daily/weekly
>>> agenda instead of the todo list to see those entries.  To schedule,
>>> [....]
>>
>> Dear Carsten, your reply was as always most helpful and full of
>> information, thanks.  However that is not good for me.  I use
>> org-tags-view all the time, because that way only those tasks get 
>> listed
>> that I can actually do (based on context).  I would like to have an
>> option, that when turned on means that org-tags-view lists all the 
>> TODOs
>> that aren't scheduled in the future.
>
> This can be achieved, as has been shown by you and by Bastien, using
> special user-defined commands.
>
> Another option, maybe simpler, is to use the local options in agenda
> custom commands to insert a function into `org-agenda-skip-function'.
>
> For example, I can write this function:
>
> (defun org-agenda-skip-if-scheduled ()
>   "Function that can be used in `org-agenda-skip-function',
> to skip entries that have been scheduled."
>   (let (beg end)
>     (org-back-to-heading t)
>     (setq beg (point))         ; beginning of headline
>     (outline-next-heading)
>     (setq end (point))         ; end of entry below heading
>     (goto-char beg)
>     (if (re-search-forward org-scheduled-time-regexp end t)
>         end   ; skip, and continue search after END

This must be "(1- end)" instead of "end".

>       nil     ; Don't skip, use this entry.
> )))
>
> and then define a custom command like this:
>
> (setq org-agenda-custom-commands
>     '(("b" tags "@SHOP"
>         ((org-agenda-skip-function org-agenda-skip-if-scheduled)))))

org-agenda-skip-if-scheduled must be quoted, thus:

(setq org-agenda-custom-commands
     '(("b" tags "@SHOP"
         ((org-agenda-skip-function 'org-agenda-skip-if-scheduled)))))

- Carsten

>
> org-agenda-skip-function should *never* be set with `setq' or so,
> but you can use the options field in custom commands to temporarily
> assign a value.
>
> The next version will have two functions,
> org-agenda-skip-if-scheduled and
> org-agenda-skip-if-scheduled-or-deadline
> built-in, so it will be easier to find entries that have no deadline 
> and/or
> have not been scheduled.  For your specific application, I guess you
> also have to look at the timestamp and see if it is in the future.
> Having seen your other lisp code, I guess you can do this yourself.
>
> Hope this helps.
>
> - Carsten
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Re: postponing todos
  2007-08-21 10:19     ` Carsten Dominik
  2007-08-21 10:43       ` Carsten Dominik
@ 2007-08-21 11:33       ` Bastien
  1 sibling, 0 replies; 16+ messages in thread
From: Bastien @ 2007-08-21 11:33 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <dominik@science.uva.nl> writes:

> Another option, maybe simpler, is to use the local options in agenda
> custom commands to insert a function into `org-agenda-skip-function'.

That's great!

Playing with this i wrote a custom agenda view that skips TODOs below
levels 1 and 2. This is something i've been looking for, since the
hierarchy of my Org file somehow reflects the importance of a task.

(setq org-agenda-custom-commands
      ;; Put your own custom key
      '(("c" todo "TODO"
	 ((org-agenda-skip-function 
            'org-agenda-skip-if-below-level)))))

(defun org-agenda-skip-if-below-level ()
  "Function that can be used in `org-agenda-skip-function',
to skip entries that are below a level 1 and 2."
  (let (beg end)
    (org-back-to-heading t)
    (setq beg (point))         ; beginning of headline
    (outline-next-heading)
    (setq end (point))         ; end of entry below heading
    (goto-char beg)
    (while (eq (get-text-property (point) 'face) 'org-hide)
      (forward-char))
    (if (not (member (get-text-property (point) 'face)
		     '(org-level-1 org-level-2)))
        (1- end)   ; skip, and continue search after END
      nil     ; Don't skip, use this entry.
      )))

-- 
Bastien

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-08-21 11:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-06 15:42 postponing todos ignotus
2007-08-06 23:18 ` Bastien
2007-08-07  0:56   ` Bastien
2007-08-07  8:41   ` ignotus
2007-08-07  1:47 ` Eddward DeVilla
2007-08-07  8:25   ` ignotus
2007-08-07 17:13     ` Bastien
2007-08-07 20:03     ` Christian Egli
2007-08-07 20:14 ` Christian Egli
2007-08-09  5:05 ` Carsten Dominik
2007-08-11 14:29   ` ignotus
2007-08-21 10:19     ` Carsten Dominik
2007-08-21 10:43       ` Carsten Dominik
2007-08-21 11:33       ` Bastien
2007-08-11 15:31   ` ignotus
2007-08-11 16:34     ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).