bastibe / org-journal

A simple org-mode based journaling mode
BSD 3-Clause "New" or "Revised" License
1.23k stars 122 forks source link

Evaluate org-journal-date-prefix #80

Closed psamim closed 7 years ago

psamim commented 7 years ago

Hi,

I wanted to be able to add calendar-persian-date-string at the top of my diary file. I thought I should set org-journal-date-prefix, but it expects a string.

Is there any way I could achieve this?

Thanks

bastibe commented 7 years ago

The date entry is composed of the org-journal-date-prefix, and after that, the current date, as formatted by org-journal-date-format. org-journal-date-prefix is copied verbatim, and org-journal-date-format is passed to format-time-string. I would hope that format-time-string has some provisions for printing persion date strings.

psamim commented 7 years ago

Unfortunately I could not find any. I changed source code as follow for my self:

      ;; empty file? Add a date timestamp
      (when new-file-p
        (insert org-journal-date-prefix
                (calendar-persian-date-string)
                " -- "
                (format-time-string org-journal-date-format time)))

It would be nice if we could have a general solution for evaluating some function at that point.