Browse Source

Small adjustment to behavior of org-insert-heading

* lisp/org.el (org-insert-heading): Allow to remove blank lines if the
user does not want any.
Carsten Dominik 11 years ago
parent
commit
7fdb56a861
1 changed files with 4 additions and 3 deletions
  1. 4 3
      lisp/org.el

+ 4 - 3
lisp/org.el

@@ -7669,9 +7669,10 @@ This is important for non-interactive uses of the command."
 	  (insert stars)
 	  (just-one-space)
 	  (insert initial-content)
-	  (if adjust-empty-lines
-	      (if (and blank (not (org-previous-line-empty-p)))
-		  (org-N-empty-lines-before-current (if blank 1 0))))
+	  (when adjust-empty-lines
+	    (if (or (not blank)
+		    (and blank (not (org-previous-line-empty-p))))
+		(org-N-empty-lines-before-current (if blank 1 0))))
 	  (run-hooks 'org-insert-heading-hook)))))))
 
 (defun org-N-empty-lines-before-current (N)