Elisp Create Today Log Files
Using elisp create a empty log file by today date
elisp code snippet start
(defun my/create-today-log ()
(interactive)
(let (log-file)
(setq log-file
(concat "~/notes/"
(format-time-string "%Y-%m-%d")
".org"))
(when (not (file-exists-p log-file))
(progn
(write-region "* Notes" nil log-file)))
(find-file log-file)))elisp code snippet end
Futhermore, we can using command to call this function
sh code snippet start
emacs --batch -l ~/.emacs.d/init.el --eval '(my/create-today-log)'sh code snippet end