emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Viktor Rosenfeld <listuser36@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ox-icalendar: fix handling of timestamps
Date: Sun, 11 Aug 2013 14:53:54 +0200	[thread overview]
Message-ID: <20130811125354.GB69042@kenny.local> (raw)
In-Reply-To: <87ob95dlel.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

Hi Aaron,

Aaron Ecay wrote:

> >      (lambda (ts)
> > -      (let ((uid (format "TS%d-%s" (incf counter) uid)))
> > -        (org-icalendar--vevent entry ts uid summary loc desc cat)))
> > +      (let ((type (org-element-property :type ts))
> > +      (uid (format "TS%d-%s" (incf counter) uid)))
> > +        (when (or (eq with-timestamps 'all)
> 
> Here, I think you want to compare with t, not 'all (check the defcustom
> for ‘org-icalendar-with-timestamps’).

Thanks, fixed!

> 
> > +            (and (eq with-timestamps 'active)
> > +           (or (eq type 'active)
> > +         (eq type 'active-range)))
> 
> This is only a cosmetic comment, so feel free to disregard it, but:
> might the ‘(or ...)’ be cleaner as ‘(memq type '(active active-range))’?

Thanks, fixed! I did not like the construction with `or' but I didn't
know about `memq'. Learning Elisp as I go...

New patch is attached.

Cheers,
Viktor
> 
> -- 
> Aaron Ecay
> 

[-- Attachment #2: 0001-ox-icalendar-fix-handling-of-timestamps.patch --]
[-- Type: text/plain, Size: 2054 bytes --]

From 52511b5e2a538d3bb0375c2e32caef0a27e1998e Mon Sep 17 00:00:00 2001
From: Viktor Rosenfeld <listuser36@gmail.com>
Date: Sun, 11 Aug 2013 03:59:29 +0200
Subject: [PATCH] ox-icalendar: fix handling of timestamps

	* ox-icalendar.el (org-icalendar-entry): Honor setting of
	`org-icalendar-with-timestamps' for timestamps on headlines
	and checkboxes.

	The setting `org-icalendar-with-timestamps' was only applied
	to timestamps which do not appear on a heading or on a
	checkbox. E.g., with `org-icalendar-with-timestamps' set to
	'active, an heading containing an inactive timestamp on would
	be exported. This patch fixes this.

TINYCHANGE
---
 lisp/ox-icalendar.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index c6ab295..ab83a48 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -580,15 +580,22 @@ inlinetask within the section."
 	    ;; When collecting plain timestamps from a headline and
 	    ;; its title, skip inlinetasks since collection will
 	    ;; happen once ENTRY is one of them.
-	    (let ((counter 0))
+	    (let ((counter 0)
+		  (with-timestamps (plist-get info :with-timestamps)))
 	      (mapconcat
 	       'identity
 	       (org-element-map (cons (org-element-property :title entry)
 				      (org-element-contents inside))
 		   'timestamp
 		 (lambda (ts)
-		   (let ((uid (format "TS%d-%s" (incf counter) uid)))
-		     (org-icalendar--vevent entry ts uid summary loc desc cat)))
+		   (let ((type (org-element-property :type ts))
+			 (uid (format "TS%d-%s" (incf counter) uid)))
+		     (when (or (eq with-timestamps t)
+			       (and (eq with-timestamps 'active)
+				    (memq type '(active active-range)))
+			       (and (eq with-timestamps 'inactive)
+				    (memq type '(inactive 'inactive-range))))
+		       (org-icalendar--vevent entry ts uid summary loc desc cat))))
 		 info nil (and (eq type 'headline) 'inlinetask))
 	       ""))
 	    ;; Task: First check if it is appropriate to export it.
-- 
1.8.3.4


  reply	other threads:[~2013-08-11 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11  2:03 [PATCH] ox-icalendar: fix handling of timestamps Viktor Rosenfeld
2013-08-11  2:13 ` Aaron Ecay
2013-08-11 12:53   ` Viktor Rosenfeld [this message]
2013-08-15  7:55     ` Nicolas Goaziou
2013-08-11  7:30 ` Nicolas Goaziou
2013-08-11 12:42   ` Viktor Rosenfeld
2013-08-11 13:15     ` Nicolas Goaziou
2013-08-11 14:14       ` Viktor Rosenfeld
2013-08-11 15:09         ` Viktor Rosenfeld
2013-08-15  7:52           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130811125354.GB69042@kenny.local \
    --to=listuser36@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).