Carsten Dominik <[EMAIL PROTECTED]> 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


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

Reply via email to