From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-agenda-log-mode doesn't list past scheduled items if org-agenda-skip-scheduled-if-done is t Date: Mon, 2 May 2011 11:20:52 +0200 Message-ID: <6BBB68CA-0FCD-4A1A-AFF8-CE3CF182B3E8@gmail.com> References: <87fwpxgfc5.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpJK-0004Ct-9s for emacs-orgmode@gnu.org; Mon, 02 May 2011 05:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGpJJ-0006wY-9J for emacs-orgmode@gnu.org; Mon, 02 May 2011 05:20:58 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:63066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpJJ-0006wP-03 for emacs-orgmode@gnu.org; Mon, 02 May 2011 05:20:57 -0400 Received: by eyd9 with SMTP id 9so1894052eyd.0 for ; Mon, 02 May 2011 02:20:56 -0700 (PDT) In-Reply-To: <87fwpxgfc5.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Antoine Levitt Cc: emacs-orgmode@gnu.org Hi Antoine, the agenda does list scheduled items anyway, so I do not see why this information should be repeated in the logging items. - Carsten On Apr 5, 2011, at 12:30 PM, Antoine Levitt wrote: > I guess my use case is pretty common: I use org-agenda to keep track = of > appointments, and use org-agenda-skip-scheduled-if-done to avoid > displaying past appointments. If I want to review what I did last week > for instance, I'd like the SCHEDULED dates to appear in > org-agenda-log-mode, not the dates where I closed the TODO entry. But > org-agenda-log-mode-items only has support for closed, clock and state > changes. A nice feature would be a 'scheduled option, which would > display done entries that have a SCHEDULED tag. >=20 > I tried to implement it, but got stuck at date handling (apparently, = the > problem is that SCHEDULED items use <> syntax, while CLOSED uses > []. Not sure why.) Could someone take a look at it? >=20 > I'm attaching a very preliminary attempt to implement it, in case = anyone > is interested. It's buggy because of the date issues. >=20 > diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el > index 9adc180..89c9dde 100644 > --- a/lisp/org/org-agenda.el > +++ b/lisp/org/org-agenda.el > @@ -4733,6 +4733,7 @@ be skipped." > (list > (if (memq 'closed items) (concat "\\<" = org-closed-string)) > (if (memq 'clock items) (concat "\\<" = org-clock-string)) > + (if (memq 'scheduled items) (concat "\\<" = org-scheduled-string)) > (if (memq 'state items) "- State = \"\\([a-zA-Z0-9]+\\)\".*?")))) > (parts-re (if parts (mapconcat 'identity parts "\\|") > (error "`org-agenda-log-mode-items' is empty"))) > @@ -4744,10 +4745,10 @@ be skipped." > (format-time-string > (car org-time-stamp-formats) > (apply 'encode-time ; DATE bound by calendar > - (list 0 0 0 (nth 1 date) (car date) (nth 2 = date)))) > + (list 0 0 0 (nth 1 date) (car date) (nth 2 = date)))) > 1 11)))) > (org-agenda-search-headline-for-time nil) > - marker hdmarker priority category tags closedp statep clockp = state > + marker hdmarker priority category tags closedp statep clockp = scheduledp state > ee txt extra timestr rest clocked) > (goto-char (point-min)) > (while (re-search-forward regexp nil t) > @@ -4755,8 +4756,9 @@ be skipped." > (org-agenda-skip) > (setq marker (org-agenda-new-marker (match-beginning 0)) > closedp (equal (match-string 1) org-closed-string) > + scheduledp (equal (match-string 1) org-scheduled-string) > statep (equal (string-to-char (match-string 1)) ?-) > - clockp (not (or closedp statep)) > + clockp (not (or closedp scheduledp statep)) > state (and statep (match-string 2)) > category (org-get-category (match-beginning 0)) > timestr (buffer-substring (match-beginning 0) = (point-at-eol)) > @@ -4765,7 +4767,7 @@ be skipped." > ;; substring should only run to end of time stamp > (setq rest (substring timestr (match-end 0)) > timestr (substring timestr 0 (match-end 0))) > - (if (and (not closedp) (not statep) > + (if (and (not closedp) (not statep) (not scheduledp) > (string-match = "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*?\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)"= rest)) > (progn (setq timestr (concat (substring timestr 0 -1) > "-" (match-string 1 rest) = "]")) > @@ -4780,6 +4782,9 @@ be skipped." > (setq extra (match-string 1)))) > (clockp > (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ = \t]*$") > + (setq extra (match-string 1)))) > + (scheduledp > + (and (looking-at ".*\n[ \t]*-[ \t]+\\([^-\n \t].*?\\)[ = \t]*$") > (setq extra (match-string 1))))) > (if (not (re-search-backward "^\\*+ " nil t)) > (setq txt org-agenda-no-heading-message) > @@ -4788,6 +4793,8 @@ be skipped." > tags (org-get-tags-at)) > (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") > (setq txt (match-string 1)) > + (if (and scheduledp (not (string-match (regexp-opt = org-done-keywords-for-agenda) txt))) > + (throw :skip nil)) > (when extra > (if (string-match "\\([ \t]+\\)\\(:[^ \n\t]*?:\\)[ \t]*$" = txt) > (setq txt (concat (substring txt 0 (match-beginning = 1)) > @@ -4796,8 +4803,9 @@ be skipped." > (setq txt (org-format-agenda-item > (cond > (closedp "Closed: ") > - (statep (concat "State: (" state ")")) > - (t (concat "Clocked: (" clocked ")"))) > + (scheduledp "Scheduled: ") > + (statep (concat "State: (" state ")")) > + (t (concat "Clocked: (" clocked ")"))) > txt category tags timestr))) > (setq priority 100000) > (org-add-props txt props - Carsten