summaryrefslogtreecommitdiffstatshomepage
path: root/nroam-utils.el
diff options
context:
space:
mode:
authorGravatar Nicolas Petton2021-03-15 00:00:39 +0100
committerGravatar GitHub2021-03-15 00:00:39 +0100
commit78ee615baef3c53c6c3c2f44f2e466c70503ef6f (patch)
tree7dd75cbb77e900f16a95f2273592b903e2ea6872 /nroam-utils.el
parent7ae549a22225eb1dd099cd63726dc164109c92d7 (diff)
parentf2deda6cd7b0a38966262486e06afeb0a47ef336 (diff)
downloadnroam-78ee615baef3c53c6c3c2f44f2e466c70503ef6f.tar.gz
nroam-78ee615baef3c53c6c3c2f44f2e466c70503ef6f.zip
Merge pull request #14 from cdlm/single-heading
Organize backlinks under single heading
Diffstat (limited to 'nroam-utils.el')
-rw-r--r--nroam-utils.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/nroam-utils.el b/nroam-utils.el
index e94bdff..8dea64f 100644
--- a/nroam-utils.el
+++ b/nroam-utils.el
@@ -34,6 +34,17 @@
(let ((inhibit-read-only t))
(unless (eq ?\n (char-before (1- (point)))) (insert "\n"))))
+(defun nroam--insert-heading (level title &optional tags)
+ "Insert TITLE as a section heading with LEVEL stars.
+Add the string or list of strings as TAGS to the heading."
+ (let ((pos (point))
+ (stars (make-string level ?*)))
+ (insert stars " " title "\n")
+ (when tags
+ (save-excursion
+ (goto-char pos)
+ (org-set-tags tags)))))
+
(defun nroam--do-separated-by-newlines (function sequence)
"Apply FUNCTION to each element of SEQUENCE.
Insert a single newline between each call to FUNCTION."