I am trying to write an emacs function that uses the current date to create a file. I'm new to emacs, so I have problems with variables and syntax. Here is what I have:
(defun daily () (interactive) (let daily-name (format-time-string "%T")) (find-file (daily-name)))
I don’t understand how emacs uses variables well enough to force it to set the time string as a variable and pass that variable to the find-file function. Any help is appreciated.
Based on what others say:
(defun daily-tex-file () (interactive) (let ((daily-name (format-time-string "%Y-%m-%d"))) (find-file (expand-file-name (concat "~/" daily-name ".tex")))))
The main differences:
~/
(defun daily () (interactive) (let ((daily-name (format-time-string "%T"))) (find-file (concat daily-name ".tex"))))
(defun daily () (interactive) (let ((daily-name (format-time-string "%T"))) (find-file (format "%s.tex" daily-name))))
M-x daily "12: 34: 56.tex".
M-x daily
. :
(defun daily () (interactive) (let ((daily-name (format-time-string "%T"))) (find-file daily-name)))
, , (daily-name) ; daily-name , .
(daily-name)
daily-name
, :
(defun daily () (interactive) (find-file (format-time-string "%T")))
Source: https://habr.com/ru/post/1792587/More articles:ClearCanvas DicomFile.DataSet - Как добавить новый тег? - dicomEditing XML with PowerShell and the "file format" error - xmlJQuery GET request on Sinatra always results in an error - jqueryClientClass does not indicate a type. GCC Linux - c ++ANDROID - How to display text on an image? - androidYii - Module with its UserIdentity component - authentication++ i versus i ++: is there any difference in any modern compiler? - c ++Does the Java HTTP connection pool have an eviction time? Can it be installed? - javaGetting GoogleDoc via API and creating PDF substitution using native text - pythonDetermining the number of lines in a text line? - c #All Articles