0

There is org-blank-before-new-entry to insert a blank line before a new entry. But is there a similar variable for adding a blank line after a new entry? It would be useful when inserting an entry between entries.

This question was previously asked on the site, but it seems to have been deleted:

1 Answer 1

0

I solved this problem myself using this hack. It seems to work okay.

(defvar night/org-blank-after-new-heading-p t
  "If non-nil, insert a blank line after inserting a new heading in Org mode.")

(defun night/insert-blank-after-org-heading (&rest dummy)
  "Insert a newline after a new org heading if `night/org-blank-after-new-heading-p` is true."
  (when night/org-blank-after-new-heading-p
    (save-excursion
      (end-of-line)
      (insert "\n"))))

(advice-add 'org-insert-heading :after #'night/insert-blank-after-org-heading)
4
  • That will interfere with Org mode's abitlity to parse the entry e.g. for DEADLINE or SCHEDULED keywords or a property drawer (e.g. LOGBOOK). These things are supposed to come after a headline with no empty lines in between.
    – NickD
    Feb 21 at 18:06
  • @NickD Umm. When I insert a new heading, I don't have a property drawer by default. I don't really use the scheduled etc. functionality though, so maybe I just haven't encountered that need ...
    – HappyFace
    Feb 22 at 14:55
  • 1
    I should have said that it might interfere: if you insert these things using the appropriate functions, they (the functions) might take care of everything - I haven't tried it. But if not, that might bite you in the future, so just keep it in the back of your mind.
    – NickD
    Feb 22 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.