I currently have bound the command dired-create-empty-file
to f7
. Emacs then prompts me for a file name. When I press f7
I would like Emacs to automatically create an ORG file and automatically generate a file name for it based on the date and time and then open the new file for editing. I find I prefer to rename files later if necessary than take the time to devise a name for them at the start.
Add a comment
|
1 Answer
You can write your own function and bind it to F7
instead of binding dired-create-empty-file to it - something like this (lightly tested):
(defun my-dired-create-empty-file ()
(interactive)
(let* ((ts (format-time-string "%Y-%m-%dT%H.%M.%S" (current-time)))
(fname (format "%s.org" ts)))
(dired-create-empty-file fname)
(find-file fname)))
It probably does not handle the case of an existing file name properly, but if you wait at least one second between generating files, that should not be much of a problem :-).