emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard KLINDA <rklinda@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Re: how to do this org-agenda command?
Date: Sat, 07 Feb 2009 15:31:07 +0100	[thread overview]
Message-ID: <87hc36qpxw.fsf@gmail.com> (raw)
In-Reply-To: <e7cdbe30902070513t532cd858m5b36e6aad1f3e40a@mail.gmail.com> (Manish's message of "Sat, 7 Feb 2009 18:43:15 +0530")

>>>>> Regarding 'Re: [Orgmode] Re: how to do this org-agenda command?'; Manish adds:


  > How about switching the TODO state when you clock in to a task and
  > adding a block to the custom agenda to inlude tasks with that state?

  > --8<---------------cut here---------------start------------->8---
  > (setq org-clock-in-switch-to-state "STARTED")
  > --8<---------------cut here---------------end--------------->8---

Thanks, in the end I wrote a hackish org-agenda-skip-function for my
needs.  Thank you for your input.

,----
| (defun rk-org-agenda-skip-not-interesting ()
|   "Skip not interesting TODO entries, only keep:
|   - [#A] priority entries,
|   - scheduled for today entries,
|   - entries that are clocked in.
| Ripped from org-agenda-skip-if function."
|   (let (beg end m)
|     (org-back-to-heading t)
|     (setq beg (point)
| 	  end (progn (outline-next-heading) (1- (point))))
|     (goto-char beg)
|     (and (and
|           ;; CLOCKED IN entries
|           (not (save-excursion
|                  (when (re-search-forward "^ +CLOCK: \\[.*?\\]$" end t)
|                    (beginning-of-line)
|                    (not (re-search-forward "--" (line-end-position) t))
|                    )))
|           ;; PRIORITY [#A] entries
|           (not (save-excursion
|                  (re-search-forward "\\[#A\\]" end t)))
|           ;; SCHEDULED FOR (TO)DAY entries
|           (not (save-excursion
|                  (when (re-search-forward org-ts-regexp
|                                           end t)
|                    (calendar-date-equal (org-date-to-gregorian
|                                          (time-to-days
|                                           (org-time-string-to-time (match-string 0))))
|                                         date
|                                         )))))
|          end)))
`----

Usage example:

,----
|           ...
|           (alltodo "" ((org-agenda-skip-function
|                         'rk-org-agenda-skip-not-interesting)))
|           ...
`----

-- 
Richard

  reply	other threads:[~2009-02-07 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-07  2:38 how to do this org-agenda command? Richard KLINDA
2009-02-07  9:48 ` Manish
2009-02-07 12:03   ` Richard KLINDA
2009-02-07 12:22     ` Manish
2009-02-07 12:54       ` Richard KLINDA
2009-02-07 13:13         ` Manish
2009-02-07 14:31           ` Richard KLINDA [this message]
2009-02-07 14:13     ` Matthew Lundin
2009-02-07 14:26       ` Richard KLINDA

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hc36qpxw.fsf@gmail.com \
    --to=rklinda@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).