Easily create a new .org entry
The random generation should be improved, I found the random snippet on the internet. I just wanted a quick PoC.
(defun random-alnum ()
(let* ((alnum "abcdefghijklmnopqrstuvwxyz0123456789")
(i (% (abs (random)) (length alnum))))
(substring alnum i (1+ i))))
(defun random-string (n)
"Generate a slug of n random alphanumeric characters.
Inefficient implementation; don't use for large n."
(if (= 0 n)
""
(concat (random-alnum) (random-string (1- n)))))
(defun org-file ()
"Create a random org file and insert a link to it"
(interactive)
(setq name (concat (random-string 8) ".org"))
(setq title (read-string "Title: "))
(make-empty-file name)
(write-region (concat "#+TITLE: " title) nil name)
(insert (concat "[[file:" name "][" title "]]"))
)