I am trying to select each content-heading extracted with org-noter and then remove all erroneous newlines.
This is my function.
(defun sanitize-noter-import ()
"Sanitizes org-noter imports. This removes white-spaces from all '* Contents' headings."
(interactive)
(let (($headings nil)
(nl "
") ; newline
(nlb "-
") ; newline with hyphen-break
heading)
(org-map-entries
(lambda ()
(setq heading (org-entry-get (point) "ITEM"))
(if (string= heading "Contents")
(progn
(message heading)
(next-line)
(mark-paragraph)
(replace-string nlb "" nil (point) (mark)) ; reconnect hyphenated words
(replace-string nl " " nil (point) (mark)) ; remove line breaks
(message "point is %s" (point))
(message "mark is %s" (mark))
))))
))
This is some example text.
** Skeleton
*** Highlight on page 2
:PROPERTIES:
:NOTER_PAGE: (2 . 0.18962766666666667)
:END:
**** Contents
Gamification is the application of game features, mainly video game elements, into non-game
context for the purpose of promoting motivation and engagement in learning. The application of
gamification in a pedagogical context provides some remedy for many students who find
themselves alienated by traditional methods of instruction. The use of gamifica-
tion could provide...
When I call the function nothing gets replaced and I get the output
Contents
point is 3983
mark is 4022
Mark set
Replaced 0 occurrences
Point and marker are here:
*** Highlight on page 2
:PROPERTIES:
:NOTER_PAGE: (2 . 0.18962766666666667) // point
:END: // marker
How do I select the headings "body" and perform a text-operation on it?