Last active
May 22, 2018 19:23
-
-
Save joonro/b400f14cf284339602f822c02bfdb22b to your computer and use it in GitHub Desktop.
[Org: Add an entry with properties] https://emacs.stackexchange.com/questions/34956/create-a-template-that-generates-a-list-of-properties-to-be-filled-in-under-a-he/41583#41583, modified code from http://kitchingroup.cheme.cmu.edu/blog/2013/10/29/Add-subheadings-to-all-headings-in-an-org-file-at-some-level #orgmode #emacs-lisp #emacs #org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+BEGIN_SRC emacs-lisp :results none | |
(setq properties-list '("Title" "Composer" "Publisher" "NDisks")) | |
(let ((MATCH t) | |
(SCOPE 'file) | |
(SKIP nil) | |
(spacing nil)) | |
(org-map-entries | |
(lambda () | |
(let ((level (nth 1 (org-heading-components)))) | |
(if (= level 3) | |
(save-restriction | |
(org-narrow-to-subtree) | |
(goto-char (point-max)) | |
(org-insert-heading) | |
(insert "New Entry\n") | |
(dolist (property properties-list) | |
(org-entry-put (point) property nil) | |
) | |
;; now cut tree and paste at level 4 | |
(org-cut-subtree) | |
(org-paste-subtree 4) | |
)))) MATCH SCOPE SKIP)) | |
#+END_SRC | |
** Class One | |
*** Student 1 | |
**** Essay 1 | |
*** Student 2 | |
*** Student 3 | |
**** Essay 1 | |
** Class Two | |
*** Student 1 | |
*** Student 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment