Re: [O] :EXPORT_FILE_NAME: containing a date-stamp

2018-02-07 Thread Berry, Charles


> On Feb 7, 2018, at 9:37 AM, Kaushal Modi  wrote:
> 
> On Wed, Feb 7, 2018 at 12:22 PM Berry, Charles  wrote:
> Use an `eval' macro.
> 
> In a more recent version than you use, this works:
> 
> * abc
>   :PROPERTIES:
>   :EXPORT_TITLE: {{{etitle(my title)}}}
>   :END:
> 
> #+macro: etitle (eval (concat (format-time-string "%Y-%m-%d") " " $1))
> 
> That works for EXPORT_TITLE!
> 
> So I tried for EXPORT_FILE_NAME, but it doesn't work there, because 
> org-export-output-file-name should be getting called internally *before* the 
> macro expansion is done.

I missed that. 

Further, `org-export-file-name' gets called before `org-export-as' so there is 
no hope of using export hooks or filters or other gambits like that.

I don't see a clean way to do date stamp the file name without writing your own 
export-to-file function that handles date-stamping the file arg sent to 
`org-export-to-file' or replacing/advicing `org-export-file-name' to do that.

Chuck



Re: [O] :EXPORT_FILE_NAME: containing a date-stamp

2018-02-07 Thread Kaushal Modi
On Wed, Feb 7, 2018 at 12:22 PM Berry, Charles  wrote:

> Use an `eval' macro.
>
> In a more recent version than you use, this works:
>
> * abc
>   :PROPERTIES:
>   :EXPORT_TITLE: {{{etitle(my title)}}}
>   :END:
>
> #+macro: etitle (eval (concat (format-time-string "%Y-%m-%d") " " $1))
>

That works for EXPORT_TITLE!

So I tried for EXPORT_FILE_NAME, but it doesn't work there, because
org-export-output-file-name should be getting called internally *before*
the macro expansion is done.
-- 

Kaushal Modi


Re: [O] :EXPORT_FILE_NAME: containing a date-stamp

2018-02-07 Thread Berry, Charles


> On Feb 7, 2018, at 7:31 AM, Karl Voit  wrote:
> 
> What I want to achieve:
> 
> *** My Report
> :PROPERTIES:
> :EXPORT_FILE_NAME: (format-time-string "%Y-%m-%d") Project Status.html
> :END:
> 
> ... which results in the file: "2018-02-07 Project Status.html"


Use an `eval' macro.

In a more recent version than you use, this works:

* abc
  :PROPERTIES:
  :EXPORT_TITLE: {{{etitle(my title)}}}
  :END:


#+macro: etitle (eval (concat (format-time-string "%Y-%m-%d") " " $1))

...

You might need to quote the `$1'. The quoting convention was changed recently.

HTH,

Chuck



Re: [O] :EXPORT_FILE_NAME: containing a date-stamp

2018-02-07 Thread Kaushal Modi
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 
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


[O] :EXPORT_FILE_NAME: containing a date-stamp

2018-02-07 Thread Karl Voit
Hi,

Is there a possibility to define an export file name of a heading so
that the resulting file contains a date-stamp?

What I want to achieve:

*** My Report
:PROPERTIES:
:EXPORT_FILE_NAME: (format-time-string "%Y-%m-%d") Project Status.html
:END:

... which results in the file: "2018-02-07 Project Status.html"

No, this does not work this way at the moment (Orgmode from git
maint, d3f7309cb from 9 weeks ago).

-- 
get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <
Personal Information Management > http://Karl-Voit.at/tags/pim/
Emacs-related > http://Karl-Voit.at/tags/emacs/