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.

1 Answer 1


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 ()
  (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 :-).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.