From 6b5fd99e2e3cc40e564e76ed568807d87221e745 Mon Sep 17 00:00:00 2001 From: Damien Pollet Date: Sun, 14 Mar 2021 17:48:20 +0100 Subject: Organize backlinks under single heading --- nroam-utils.el | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nroam-utils.el') diff --git a/nroam-utils.el b/nroam-utils.el index e94bdff..a4e58fc 100644 --- a/nroam-utils.el +++ b/nroam-utils.el @@ -34,6 +34,16 @@ (let ((inhibit-read-only t)) (unless (eq ?\n (char-before (1- (point)))) (insert "\n")))) +(defun nroam--insert-heading (level title &optional tags) + "Insert a section 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." -- cgit v1.2.3-54-g00ecf From f2deda6cd7b0a38966262486e06afeb0a47ef336 Mon Sep 17 00:00:00 2001 From: Damien Pollet Date: Sun, 14 Mar 2021 20:54:01 +0100 Subject: Improve comment of nroam--insert-heading --- nroam-utils.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nroam-utils.el') diff --git a/nroam-utils.el b/nroam-utils.el index a4e58fc..8dea64f 100644 --- a/nroam-utils.el +++ b/nroam-utils.el @@ -35,7 +35,8 @@ (unless (eq ?\n (char-before (1- (point)))) (insert "\n")))) (defun nroam--insert-heading (level title &optional tags) - "Insert a section heading" + "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") -- cgit v1.2.3-54-g00ecf