How to type a dynamic file entry for org capture

◇◆丶佛笑我妖孽 提交于 2019-12-19 10:43:14

问题


I'm trying to figure out if there is some way to create a dynamic file name for capture in emacs org-mode.

("z" "test" entry (file+headline ***A date specific headline*** "Notes"))
    "** %^{prompt}")

Is there some simple way to pass a date and year to the file part, so that I can have a file dynamically created for each month. What I'd like is something like this:

(concat "/home/me/file/report_notes_" (format-time-string "%m_%Y") ".org")

Edit - I've finally got it working, using backquoting:

`(("z" "test" entry (file+headline ,(capture-report-date-file "/path/path/name_")
   "Notes")
   "** %^{prompt}")))

then writing a function like this:

(defun capture-report-date-file (path)
  (concat path (format-time-string "%m_%Y")))

I got to the answer after reading this answer to a similar question.


回答1:


Have a look at "org-daypage": https://github.com/almost/org-daypage

Right now it creates a page for the current day and saves it to a specific directory, maybe you can modify the code according to your needs.



来源:https://stackoverflow.com/questions/8614642/how-to-type-a-dynamic-file-entry-for-org-capture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!