From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Makes diary sexps appear correct in agenda views. Date: Fri, 20 Feb 2009 11:05:09 +0100 Message-ID: <839C66B8-92BE-49DB-8977-103AC67B32D0@uva.nl> References: <87wsbm8n0i.fsf@abc.se> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/mixed; boundary="===============1050696381==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaSFu-00012A-Ar for emacs-orgmode@gnu.org; Fri, 20 Feb 2009 05:05:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaSFs-00011M-Qn for emacs-orgmode@gnu.org; Fri, 20 Feb 2009 05:05:13 -0500 Received: from [199.232.76.173] (port=46452 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaSFs-000113-Ch for emacs-orgmode@gnu.org; Fri, 20 Feb 2009 05:05:12 -0500 Received: from mail-fx0-f174.google.com ([209.85.220.174]:60311) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LaSFr-0005m3-IW for emacs-orgmode@gnu.org; Fri, 20 Feb 2009 05:05:12 -0500 Received: by fxm22 with SMTP id 22so220510fxm.18 for ; Fri, 20 Feb 2009 02:05:10 -0800 (PST) In-Reply-To: <87wsbm8n0i.fsf@abc.se> 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: Mikael Fornius Cc: emacs-orgmode@gnu.org --===============1050696381== Content-Type: multipart/alternative; boundary=Apple-Mail-4--880927721 --Apple-Mail-4--880927721 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hi Michael, The <%%(diary-function)> format is really for DEADLINE and scheduled. If you want to use diary-like entries, also including the text after the function call, the idea is that you place these lines directly in the buffer, exactly like you would in the diary buffer: * Today is the 17th %%(diary-date 17 t t) %%(diary-date 18 t t) Now it is the 18th. * Birthdays %%(diary-anniversary 3 3 1979) Adam becomes %d years old! > The <%%(-sexps has worked properly before in earlier versions of org > and > the regexp > >> - (regexp "^&?%%(") > > makes me think that there is more because I find the ampersand hard to > understand or motivate. The ampersand is allowed because it has a function in diary buffers. It has no function in Org buffers, but this allows you to copy and paste diary lines into Org buffers without further modifications. HTH - Carsten On Feb 19, 2009, at 4:27 PM, Mikael Fornius wrote: > Fixes a problem with some diary-sexps not occuring correct or not > showing up at all in agenda view. (More description in the attached > patch.) > > I hope it will be useful! > > Org-mode is a great mode. > > From 0f05f81034eefeca63fd03f841c22a89357f3768 Mon Sep 17 00:00:00 2001 > From: Mikael Fornius > Date: Thu, 19 Feb 2009 15:54:05 +0100 > Subject: [PATCH] Makes diary sexps appear correct in agenda views. > > Advanced sexps did not show up because of problem in > org-agenda-get-sexps. Now: > > When no additional text in sexp-entry it uses the headline text in > agenda: > > * Today is the 17th > <%%(diary-date 17 t t)> > <%%(diary-date 18 t t) Now it is the 18th.> > * Birthdays > <%%(diary-anniversary 3 3 1979) Adam becomes %d years old!> > > The first is formatted with "Today is the 17th" in the agenda view, > the second sexp as "Now it is the 18th." (not with the heading) and > the anniversary as "Adam becomes 30 years old!". > --- > lisp/org-agenda.el | 23 ++++++++++------------- > 1 files changed, 10 insertions(+), 13 deletions(-) > > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > index 40fc456..a67081a 100644 > --- a/lisp/org-agenda.el > +++ b/lisp/org-agenda.el > @@ -3504,7 +3504,7 @@ the documentation of `org-diary'." > 'help-echo > (format "mouse-2 or RET jump to org file %s" > (abbreviate-file-name buffer-file-name)))) > - (regexp "^&?%%(") > + (regexp "<%%(") > marker category ee txt tags entry result beg b sexp sexp-entry > todo-state) > (goto-char (point-min)) > @@ -3516,7 +3516,7 @@ the documentation of `org-diary'." > (setq b (point)) > (forward-sexp 1) > (setq sexp (buffer-substring b (point))) > - (setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)") > + (setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)>") > (org-trim (match-string 1)) > "")) > (setq result (org-diary-sexp-entry sexp sexp-entry date)) > @@ -3525,17 +3525,14 @@ the documentation of `org-diary'." > category (org-get-category beg) > todo-state (org-get-todo-state)) > > - (if (string-match "\\S-" result) > - (setq txt result) > - (setq txt "SEXP entry returned empty string")) > - > - (setq txt (org-format-agenda-item > - "" txt category tags 'time)) > - (org-add-props txt props 'org-marker marker) > - (org-add-props txt nil > - 'org-category category 'date date 'todo-state todo-state > - 'type "sexp") > - (push txt ee)))) > + (when (string-match "\\S-" result) > + (setq txt (org-format-agenda-item > + "" result category tags 'time)) > + (org-add-props txt props 'org-marker marker) > + (org-add-props txt nil > + 'org-category category 'date date 'todo-state todo-state > + 'type "sexp") > + (push txt ee))))) > (nreverse ee))) > > (defalias 'org-get-closed 'org-agenda-get-progress) > -- > 1.5.6 > > > -- > Mikael Fornius > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-4--880927721 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable

Hi = Michael,

The <%%(diary-function)> format is = really for DEADLINE and scheduled.

If you want = to use diary-like entries, also including the text
after the = function call, the idea is that you place these lines
directly = in the buffer, exactly like you would in the diary = buffer:

* Today is the 17th
%%(diary-date 17 t = t)
%%(diary-date 18 t t) Now it is the 18th.
* = Birthdays
%%(diary-anniversary 3 3 1979) Adam becomes %d years = old!

The <%%(-sexps has = worked properly before in earlier versions of org and
the = regexp

-  (regexp = "^&?%%(")

makes me think that there is more because I find = the ampersand hard to
understand or = motivate.


The ampersand is allowed = because it has a function in diary buffers.
It has no function = in Org buffers, but this allows you
to copy and paste diary = lines into Org buffers without = further
modifications.

HTH
- Carsten


On Feb 19, = 2009, at 4:27 PM, Mikael Fornius wrote:

Fixes a problem with some diary-sexps not occuring correct = or not
showing up at all in agenda view. (More description in the = attached
patch.)

I hope it will be useful!

Org-mode is = a great mode.

=46rom 0f05f81034eefeca63fd03f841c22a89357f3768 Mon = Sep 17 00:00:00 2001
From: Mikael Fornius <mfo@abc.se>
Date: Thu, 19 Feb 2009 = 15:54:05 +0100
Subject: [PATCH] Makes diary sexps appear correct in = agenda views.

Advanced sexps did not show up because of problem = in
org-agenda-get-sexps. Now:

When no additional text in = sexp-entry it uses the headline text in
agenda:

* Today is the = 17th
<%%(diary-date 17 t t)>
<%%(diary-date 18 t t) Now it = is the 18th.>
* Birthdays
<%%(diary-anniversary 3 3 1979) Adam = becomes %d years old!>

The first is formatted with "Today is the = 17th" in the agenda view,
the second sexp as "Now it is the 18th." = (not with the heading) and
the anniversary as "Adam becomes 30 years = old!".
---
lisp/org-agenda.el |   23 = ++++++++++-------------
1 files changed, 10 insertions(+), 13 = deletions(-)

diff --git a/lisp/org-agenda.el = b/lisp/org-agenda.el
index 40fc456..a67081a 100644
--- = a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3504,7 +3504,7 = @@ the documentation of `org-diary'."
=      'help-echo
=      (format "mouse-2 or RET jump to org file = %s"
= = =      (abbreviate-file-name = buffer-file-name))))
- (regexp "^&?%%(")
+ (regexp = "<%%(")
= marker category ee txt tags entry result beg b sexp = sexp-entry
= todo-state)
    (goto-char = (point-min))
@@ -3516,7 +3516,7 @@ the documentation of = `org-diary'."
(setq b (point))
= (forward-sexp 1)
(setq sexp (buffer-substring b = (point)))
- = (setq sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)")
+ (setq = sexp-entry (if (looking-at "[ \t]*\\(\\S-.*\\)>")
=     (org-trim (match-string 1))
=   ""))
(setq result = (org-diary-sexp-entry sexp sexp-entry date))
@@ -3525,17 +3525,14 @@ = the documentation of `org-diary'."
category (org-get-category = beg)
= = todo-state (org-get-todo-state))

- =  (if (string-match "\\S-" result)
- =      (setq txt result)
- =    (setq txt "SEXP entry returned empty = string"))
-
-  (setq txt = (org-format-agenda-item
- =             &n= bsp;       "" txt category tags = 'time))
- =  (org-add-props txt props 'org-marker marker)
- =  (org-add-props txt nil
-    'org-category = category 'date date 'todo-state todo-state
- =    'type "sexp")
-  (push txt ee))))
+ =  (when (string-match "\\S-" result)
+ =      (setq txt = (org-format-agenda-item
+ "" result category tags = 'time))
+ =      (org-add-props txt props = 'org-marker marker)
+ =      (org-add-props txt nil
+ = 'org-category category 'date date 'todo-state = todo-state
+ = = 'type "sexp")
+ =      (push txt ee)))))
=     (nreverse ee)))

(defalias = 'org-get-closed 'org-agenda-get-progress)
--
1.5.6


-- =
Mikael = Fornius
_______________________________________________
Emacs-orgmod= e mailing list
Remember: use `Reply All' to send replies to the = list.
Emacs-orgmode@gnu.org
http://= lists.gnu.org/mailman/listinfo/emacs-orgmode

= --Apple-Mail-4--880927721-- --===============1050696381== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1050696381==--