Add function to create a note from a region

This commit is contained in:
Andreas Zweili 2023-07-23 22:24:58 +02:00
parent 984746ef5c
commit 0e657ed65d
1 changed files with 12 additions and 0 deletions

View File

@ -1,7 +1,19 @@
(use-package denote
:bind
(("C-c C-n r" . denote-rename-file)
("C-c C-n p" . az-denote-create-new-note-from-region)
("C-c C-n n" . denote-create-file))
:config
(defun az-denote-create-new-note-from-region (beg end)
"Create note whose contents include the text between BEG and END. Prompt
for title and keywords of the new note."
(interactive "r")
(if-let (((region-active-p))
(text
(buffer-substring-no-properties beg end)))
(progn (denote
(denote-title-prompt) (denote-keywords-prompt)) (insert text))
(user-error
"No region is available")))
(setq denote-file-type "markdown-yaml"
denote-directory "~/nextcloud/10_documents/"))