emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] New headline after no content (empty headline)


From: Brady Trainor
Subject: Re: [O] New headline after no content (empty headline)
Date: Fri, 28 Mar 2014 05:57:15 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Bastien <bzg <at> gnu.org> writes:

> ---does the Org version that comes from the maint branch 
> still needs a fix?  If so, can you describe the problem
> again?


I did test the `maint` branch today. The behavior was not ideal for my 
funny use-case.

For `org-insert-heading' (M-RET), I wanted the following action on empty 
headlines:

"* " |--> "* \n* ", rather than "*\n* ".

This patch may be suitable:

(org.el)

==========================

diff --git a/lisp/org.el b/lisp/org.el
index 6d6fbeb..86eb347 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7685,9 +7685,10 @@ This is important for non-interactive uses of the 
command."
 So this will delete or add empty lines."
   (save-excursion
     (goto-char (point-at-bol))
-    (if (looking-back "\\s-+" nil 'greedy)
-    (replace-match ""))
-    (or (bobp) (insert "\n"))
+    (unless (looking-back "\* \n")
+      (if (looking-back "\\s-+" nil 'greedy)
+      (replace-match ""))
+      (or (bobp) (insert "\n")))
     (while (> N 0)
       (insert "\n")
       (setq N (1- N)))))

==========================

Thank you!

Brady










reply via email to

[Prev in Thread] Current Thread [Next in Thread]