From: Brady Trainor <algebrat@uw.edu>
To: emacs-orgmode@gnu.org
Subject: Re: New headline after no content (empty headline)
Date: Fri, 28 Mar 2014 05:57:15 +0000 (UTC) [thread overview]
Message-ID: <loom.20140328T065045-734@post.gmane.org> (raw)
In-Reply-To: 87ob0xmhzc.fsf@bzg.ath.cx
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
next prev parent reply other threads:[~2014-03-28 5:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-15 21:24 New headline after no content (empty headline) Brady Trainor
2014-03-17 0:49 ` Bastien
2014-03-23 2:08 ` Brady Trainor
2014-03-23 8:33 ` Bastien
2014-03-28 5:57 ` Brady Trainor [this message]
2014-03-31 5:55 ` Bastien
2014-03-31 6:26 ` Brady Trainor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20140328T065045-734@post.gmane.org \
--to=algebrat@uw.edu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).