I use a custom function (originally from this post on StackExchange) to create files from org-capture (one file per entry). For some reason, if I cancel the entry with C-c C-k Emacs still creates the file.

(defun my/generate-org-note-name ()
  (setq my-org-note--name (read-string "Name: "))
  (setq my-org-note--date (format-time-string "%Y-%m-%d"))
  (expand-file-name (format "%s.org" my-org-note--name) "~/org/wiki"))

(setq org-capture-templates
  '(("q" "Quote" entry (file "~/org/capture/quotes.org")
     "* %^{Attribution}\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n%?")
    ("w" "Wiki Entry" plain (file my/generate-org-note-name)
     "%(format \"* %s\n:PROPERTIES:\n:CREATED:  %s\n:END:\n\n%%?\" my-org-note--name my-org-note--date)")))

My other template in this example captures a quote to quotes.org (notice that this is basically the same code). But cancelling this in org-capture does not auto-create the entry...

What am I doing wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.