Create helper command my-org-fix-newlines

This commit is contained in:
contrapunctus 2022-02-06 17:38:19 +05:30
parent a3577588bb
commit 2eef05cb80
1 changed files with 23 additions and 0 deletions

View File

@ -4096,6 +4096,29 @@ From https://emacs.stackexchange.com/questions/20577/org-babel-load-all-language
ad-do-it))
#+END_SRC
*** my-org-fix-newlines
#+BEGIN_SRC emacs-lisp
(defun my-org-fix-newlines ()
"Insert newlines around Org headings.
Newlines are inserted before headings (unless immediately
preceded by another heading) and after headings."
(interactive)
(org-map-tree
(lambda ()
(save-excursion
(forward-line -1)
(goto-char (point-at-bol))
(unless (or (looking-at-p "^$")
(org-at-heading-p))
(goto-char (point-at-eol))
(insert "\n")))
(save-excursion
(forward-line)
(goto-char (point-at-bol))
(when (looking-at-p "^$")
(join-line))))))
#+END_SRC
*** org-html-themify
#+BEGIN_SRC emacs-lisp
(use-package org-html-themify