From mboxrd@z Thu Jan 1 00:00:00 1970 From: eric johnson Subject: Proposed tweak to org-agenda-skip-entry-when-regexp-matches-in-subtree Date: Mon, 28 Jun 2010 07:34:29 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=46123 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTCbo-0001DH-UN for emacs-orgmode@gnu.org; Mon, 28 Jun 2010 07:34:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTCbf-0003rL-PT for emacs-orgmode@gnu.org; Mon, 28 Jun 2010 07:34:32 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:57582) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTCbf-0003r5-L0 for emacs-orgmode@gnu.org; Mon, 28 Jun 2010 07:34:31 -0400 Received: by pwi6 with SMTP id 6so5815pwi.0 for ; Mon, 28 Jun 2010 04:34:29 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi - org-mode is fantastic. Part of what makes it so awesome is that one can ke= ep tweaking the software and the process. In looking at my own usage, I noticed that I really wanted to simplify my org-todo-keywords. I had a separate list of TODOs for projects (PROJ->PRST->DONE) and was wondering why I had to have that. Why couldn't I just get by with TODO->STARTED->DONE for everything, tasks and projects, and mark up projects with a tag. You can see what I'm aiming for with this example. (setq org-tags-exclude-from-inheritance '("project")) (setq org-todo-keywords '( (sequence "TODO" "STARTED" "WAITING" "|" "DONE" "CNCL")) (setq org-stuck-projects '("project/STARTED" ("TODO" "WAITING" "STARTED") nil "")) * STARTED Stuck project=A0 =A0=A0=A0 =A0=A0=A0 :project: ** DONE This was done * STARTED Not stuck project=A0=A0 =A0 :project: ** TODO Next project C-a # won't show "Stuck Project". That's because the project line's "START= ED" is found in org-agenda-skip via the org-agenda-skip-entry-when-regexp-matches-in-subtree. I really want it to be org-agenda-skip-entry-when-regexp-ONLY-matches-in-subtree. To do that, I hacked up the function to capture a "begin" point after the headline. (defun org-agenda-skip-entry-when-regexp-matches-in-subtree () "Checks if the current subtree contains match for `org-agenda-skip-regexp= '. If yes, it returns the end position of the current entry (NOT the tree), causing agenda commands to skip the entry but continuing the search in the subtree. This is a function that can be put into `org-agenda-skip-function' for the duration of a command. An important use of this function is for the stuck project list." (let ((begin (save-excursion (org-end-of-line) (1- (point)))) (end (save-excursion (org-end-of-subtree t))) (entry-end (save-excursion (outline-next-heading) (1- (point)))) skip) (save-excursion (goto-char begin) (setq skip (re-search-forward org-agenda-skip-regexp end t))) (and skip entry-end))) If this change is too radical, it might make sense to modify org-agenda-list-stuck-projects to let the user define the skip function via an element in org-stuck-projects. I'm thinking something like this... (let* ((org-agenda-skip-function (or (nth 4 org-stuck-projects) 'org-agenda-skip-entry-when-regexp-matches-in-subtree)) That would enable everyone to control the org-agenda-skip-function. -Eric