From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] Formatting of {{{DATE}}} Date: Mon, 09 Feb 2015 01:05:40 +0100 Message-ID: <87egq0q78r.fsf@nicolasgoaziou.fr> References: <8761bc85pm.fsf@gmx.us> <87mw4oq8jn.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKbqA-00055G-2m for emacs-orgmode@gnu.org; Sun, 08 Feb 2015 19:04:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKbq6-0006dN-B7 for emacs-orgmode@gnu.org; Sun, 08 Feb 2015 19:04:38 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:59454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKbq6-0006b6-4n for emacs-orgmode@gnu.org; Sun, 08 Feb 2015 19:04:34 -0500 In-Reply-To: <87mw4oq8jn.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Mon, 09 Feb 2015 00:37:32 +0100") 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: Rasmus Cc: emacs-orgmode@gnu.org Correcting myself, Nicolas Goaziou writes: > I suggest > > (cons "date" > (format > "(eval (if (org-string-nw-p \"$1\") %s %S))" > "(org-export-get-date info \"$1\")" > (or (org-element-interpret-data (plist-get info :date)) > ""))) Please scratch that, reference to "info" will prevent us to move to use lexical binding later. Something like this is required instead: (cons "date" (let* ((date (plist-get info :date)) (value (or (org-element-interpret-data date) ""))) (if (and (null (cdr date)) (eq (org-element-type (car date)) 'timestamp)) (format "(eval (if (org-string-nw-p \"$1\") %s %S))" (format "(org-timestamp-format '%S \"$1\")" ;; Remove parent to avoid ;; read error. `(timestamp ,(org-combine-plists (nth 1 (car date)) '(:parent nil)))) value) value))) I think the later part could use an `org-element-copy' function (to be implemented).