automate blog post creation

Creating post manually can be a pain. This means calling find-file, entering the filename (this excludes the timestamp but includes the separating underscores), and then calling prepend the timestamp (via date2name-prepend-date ) onto the file from the dired buffer. This is something that can and should be automated. To that end, I have been experimenting with this function I wrote for generating a new blog post.

(defun! oo-new-blog-post ()
  "Create a new blog post, prompting for the name."
  (interactive)
  (set! blog-dir "~/Documents/MyBlog/org/posts/")
  (set! name (read-string "Post: "))
  (set! name (replace-regexp-in-string (rx (1+ white)) "_" name))
  (set! name (date2name-prepend-date name (current-time) 'with-time))
  (set! name (concat "draft_" name))
  (set! name (if (string-match-p "\\.org$" name) name (concat name ".org")))
  (find-file (expand-file-name name blog-directory)))

I do not know if this is the end all be all solution. I am also considering advising find-file to act differently if the file I am creating is in the blog directory. For another post.