[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote b89b566dff: Tweak docs about splitting an Org su
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote b89b566dff: Tweak docs about splitting an Org subtree |
Date: |
Thu, 10 Nov 2022 22:57:30 -0500 (EST) |
branch: externals/denote
commit b89b566dff610036b5f07cd5608b2ebf597c0d82
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Tweak docs about splitting an Org subtree
---
README.org | 40 ++++++++++++++++++++++++----------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/README.org b/README.org
index c9b5cacc2d..9a6501b4d7 100644
--- a/README.org
+++ b/README.org
@@ -1798,25 +1798,33 @@ official channels
([[#h:1ebe4865-c001-4747-a6f2-0fe45aad71cd][Contributing]]).
:CUSTOM_ID: h:d0c7cb79-21e5-4176-a6af-f4f68578c8dd
:END:
-With Org files in particular, it is common to have nested headings which
-could be split off into their own standalone notes. In Org parlance an
-entry with all its subheadings is a "subtree". With the following code,
-the user places the point inside the heading they want to split off and
-invokes the command ~my-denote-split-org-subtree~. It will create a
-note using the heading's text and tags for the new file. The contents
-of the subtree become the contents of the new note and are removed from
-the old one.
+With Org files in particular, it is common to have nested headings
+which could be split off into their own standalone notes. In Org
+parlance, an entry with all its subheadings is a "subtree". With the
+following code, the user places the point inside the heading they want
+to split off and invokes the command ~my-denote-org-extract-subtree~.
+It will create a note using the heading's text and tags for the new
+file. The contents of the subtree become the contents of the new note
+and are removed from the old one.
#+begin_src emacs-lisp
-(defun my-denote-split-org-subtree ()
- "Create new Denote note as an Org file using current Org subtree."
+(defun my-denote-org-extract-subtree ()
+ "Create new Denote note using current Org subtree.
+Make the new note use the Org file type, regardless of the value
+of `denote-file-type'.
+
+Use the subtree title as the note's title. If available, use the
+tags of the heading are used as note keywords.
+
+Delete the original subtree."
(interactive)
- (let ((text (org-get-entry))
- (heading (org-get-heading :no-tags :no-todo :no-priority :no-comment))
- (tags (org-get-tags)))
- (delete-region (org-entry-beginning-position) (org-entry-end-position))
- (denote heading tags 'org)
- (insert text)))
+ (if-let ((text (org-get-entry))
+ (heading (org-get-heading :no-tags :no-todo :no-priority
:no-comment)))
+ (progn
+ (delete-region (org-entry-beginning-position) (org-entry-end-position))
+ (denote heading (org-get-tags) 'org)
+ (insert text))
+ (user-error "No subtree to extract; aborting")))
#+end_src
Have a different workflow? Feel welcome to discuss it in any of our
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/denote b89b566dff: Tweak docs about splitting an Org subtree,
ELPA Syncer <=