From mboxrd@z Thu Jan 1 00:00:00 1970 From: ignotus@freemail.hu Subject: Re: postponing todos Date: Sat, 11 Aug 2007 17:31:59 +0200 Message-ID: <87odheulxs.fsf@freemail.hu> References: <878x8osm96.fsf@freemail.hu> <2151c7f8a47e69a374e5edbed368e83d@science.uva.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IJswc-0005J9-E8 for emacs-orgmode@gnu.org; Sat, 11 Aug 2007 11:32:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IJswa-0005GC-Qa for emacs-orgmode@gnu.org; Sat, 11 Aug 2007 11:32:01 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJswa-0005G3-OA for emacs-orgmode@gnu.org; Sat, 11 Aug 2007 11:32:00 -0400 Received: from viefep18-int.chello.at ([213.46.255.22] helo=viefep33-int.chello.at) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IJswa-0002zS-59 for emacs-orgmode@gnu.org; Sat, 11 Aug 2007 11:32:00 -0400 Received: from [192.168.0.175] (really [80.98.106.103]) by viefep33-int.chello.at (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070811153158.YOTY9755.viefep33-int.chello.at@[192.168.0.175]> for ; Sat, 11 Aug 2007 17:31:58 +0200 Received: from ignotus by localhost with local (masqmail 0.2.21) id 1IJswZ-7kL-00 for ; Sat, 11 Aug 2007 17:31:59 +0200 In-Reply-To: <2151c7f8a47e69a374e5edbed368e83d@science.uva.nl> (Carsten Dominik's message of "Thu, 9 Aug 2007 07:05:46 +0200") 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 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