From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: :EXPORT_FILE_NAME: containing a date-stamp Date: Wed, 07 Feb 2018 16:41:01 +0000 Message-ID: References: <2018-02-07T16-21-12@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11c0166e9bc5b40564a1f6f0" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejSmZ-0000Qb-R2 for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 11:41:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejSmY-0008BG-NE for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 11:41:15 -0500 Received: from mail-yw0-x236.google.com ([2607:f8b0:4002:c05::236]:39872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ejSmY-0008B3-Hs for emacs-orgmode@gnu.org; Wed, 07 Feb 2018 11:41:14 -0500 Received: by mail-yw0-x236.google.com with SMTP id v196so467522ywc.6 for ; Wed, 07 Feb 2018 08:41:14 -0800 (PST) In-Reply-To: <2018-02-07T16-21-12@devnull.Karl-Voit.at> 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" To: Karl Voit Cc: emacs-orgmode@gnu.org --001a11c0166e9bc5b40564a1f6f0 Content-Type: text/plain; charset="UTF-8" On Wed, Feb 7, 2018 at 10:33 AM Karl Voit wrote: > :EXPORT_FILE_NAME: (format-time-string "%Y-%m-%d") Project Status.html > Yes, you cannot do that (How would Org know that you do not want to name your file literally like that? :)). Also you do not need to (should not?) provide the file extension there.. the correct extension is added based on the exporter you use. That said, I quickly tested this out, and it works: (defun modi/org-advice-prefix-export-file-name-with-date (orig-fun &rest args) "Prefix the output file name with current date." (let* ((date-format "%Y-%m-%d") ;Customize this variable as you like (date-file-separator "-") ;Customize this variable as you like (orig-output-file-name (apply orig-fun args)) (orig-output-dir (file-name-directory orig-output-file-name)) (orig-output-just-file-name (file-name-nondirectory orig-output-file-name)) (date (format-time-string date-format (current-time)))) (concat orig-output-dir date date-file-separator orig-output-just-file-name))) (advice-add 'org-export-output-file-name :around #'modi/org-advice-prefix-export-file-name-with-date) ;; (advice-remove 'org-export-output-file-name #'modi/org-advice-prefix-export-file-name-with-date) After evaluating the above, current date will be prefixed to the exported file name, whether you export the whole file or just a subtree. -- Kaushal Modi --001a11c0166e9bc5b40564a1f6f0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Feb 7,= 2018 at 10:33 AM Karl Voit <dev= null@karl-voit.at> wrote:
:E= XPORT_FILE_NAME: (format-time-string "%Y-%m-%d") Project Status.h= tml

Yes, you cannot do that (How would = Org know that you do not want to name your file literally like that? :)).
Also you do not need to (should not?) provide the file ext= ension there.. the correct extension is added based on the exporter you use= .

That said, I quickly tested this out, and it works:
=
(defun modi/org-advice-prefix-export-file-name-with-date (orig-fun &= ;rest args)
=C2=A0 "Prefix the output file name with current date.&= quot;
=C2=A0 (let* ((date-format "%Y-%m-%d")=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ;Customize this variable as you like
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (date-file-separator "-")=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 ;Customize this variable as you like
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (orig-output-file-name (apply orig-= fun args))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (orig-output= -dir (file-name-directory orig-output-file-name))
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (orig-output-just-file-name (file-name-nondirec= tory orig-output-file-name))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (date (format-time-string date-format (current-time))))
=C2=A0=C2= =A0=C2=A0 (concat orig-output-dir date date-file-separator orig-output-just= -file-name)))
(advice-add 'org-export-output-file-name :around #'= ;modi/org-advice-prefix-export-file-name-with-date)
;; (advice-remove &#= 39;org-export-output-file-name #'modi/org-advice-prefix-export-file-nam= e-with-date)


After evaluating the above, current date= will be prefixed to the exported file name, whether you export the whole f= ile or just a subtree.
--

Kaus= hal Modi

--001a11c0166e9bc5b40564a1f6f0--