emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* C-RET and empty lines
@ 2023-08-21 15:25 Max Nikulin
  2023-08-22  9:52 ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Max Nikulin @ 2023-08-21 15:25 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

A couple of recent threads reminded me about quite peculiar behavior 
when a new heading is added by C-RET. I prefer to have an empty line 
before headings. Sometimes such empty lines disappear. Is such behavior 
(highly dependent of context) intentional? From my point of view it is 
confusing.

--- 8< ---
Try =C-RET= when cursor in the following heading titles
* No empty line added

Text
* Existing empty line consumed

Text

* Empty line added before new heading

Text
--- >8 ---

Variants of C-RET effect:

--- 8< ---
* No empty line added

Text
* |
* Existing empty line consumed
--- >8 ---

or

--- 8< ---
* Existing empty line consumed

Text
* |
* Empty line added before new heading
--- >8 ---

or

--- 8< ---
* Empty line added before new heading

Text

* |
--- >8 ---



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: C-RET and empty lines
  2023-08-21 15:25 C-RET and empty lines Max Nikulin
@ 2023-08-22  9:52 ` Ihor Radchenko
  2023-08-22 11:21   ` Juergen Fenn
  2023-08-24 12:10   ` Max Nikulin
  0 siblings, 2 replies; 6+ messages in thread
From: Ihor Radchenko @ 2023-08-22  9:52 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> A couple of recent threads reminded me about quite peculiar behavior 
> when a new heading is added by C-RET. I prefer to have an empty line 
> before headings. Sometimes such empty lines disappear. Is such behavior 
> (highly dependent of context) intentional? From my point of view it is 
> confusing.

Yes, it is intentional. Org follows the blank lines of the current
heading when you press C-RET, by default.

This behaviour is customizable. See `org-blank-before-new-entry'.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: C-RET and empty lines
  2023-08-22  9:52 ` Ihor Radchenko
@ 2023-08-22 11:21   ` Juergen Fenn
  2023-08-22 11:38     ` Ihor Radchenko
  2023-08-24 12:10   ` Max Nikulin
  1 sibling, 1 reply; 6+ messages in thread
From: Juergen Fenn @ 2023-08-22 11:21 UTC (permalink / raw)
  To: emacs-orgmode



Am 22.08.23 um 11:52 Uhr schrieb Ihor Radchenko:
> This behaviour is customizable. See `org-blank-before-new-entry'.

Thank you for this hint. That was new to me as well.

M-x describe-variable RET org-blank-before-new-entry RET says:

> Should ‘org-insert-heading’ leave a blank line before new heading/item?
> The value is an alist, with ‘heading’ and ‘plain-list-item’ as CAR,
> and a boolean flag as CDR.  The cdr may also be the symbol ‘auto’, in
> which case Org will look at the surrounding headings/items and try to
> make an intelligent decision whether to insert a blank line or not.


Could you please advise how to configure the variable in your init file
to have it produce a blank line before _every_ new entry?

Thanks, and best regards,
Jürgen.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: C-RET and empty lines
  2023-08-22 11:21   ` Juergen Fenn
@ 2023-08-22 11:38     ` Ihor Radchenko
  2023-08-22 12:45       ` Juergen Fenn
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2023-08-22 11:38 UTC (permalink / raw)
  To: Juergen Fenn; +Cc: emacs-orgmode

Juergen Fenn <jfenn@gmx.net> writes:

> Could you please advise how to configure the variable in your init file
> to have it produce a blank line before _every_ new entry?

(setf (alist-get 'heading org-blank-before-new-entry) t)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: C-RET and empty lines
  2023-08-22 11:38     ` Ihor Radchenko
@ 2023-08-22 12:45       ` Juergen Fenn
  0 siblings, 0 replies; 6+ messages in thread
From: Juergen Fenn @ 2023-08-22 12:45 UTC (permalink / raw)
  To: emacs-orgmode



Am 22.08.23 um 13:38 Uhr schrieb Ihor Radchenko:

>> Could you please advise how to configure the variable in your init file
>> to have it produce a blank line before _every_ new entry?
>
> (setf (alist-get 'heading org-blank-before-new-entry) t)

Thanks, again. Works fine for me. :)

Best Regards,
Jürgen.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: C-RET and empty lines
  2023-08-22  9:52 ` Ihor Radchenko
  2023-08-22 11:21   ` Juergen Fenn
@ 2023-08-24 12:10   ` Max Nikulin
  1 sibling, 0 replies; 6+ messages in thread
From: Max Nikulin @ 2023-08-24 12:10 UTC (permalink / raw)
  To: emacs-orgmode

On 22/08/2023 16:52, Ihor Radchenko wrote:
> Max Nikulin writes:
> 
> Yes, it is intentional. Org follows the blank lines of the current
> heading when you press C-RET, by default.
> 
> This behaviour is customizable. See `org-blank-before-new-entry'.

Thank you for explanation. Frankly speaking, I missed an option "do not 
try to be smart (do not make decisions on hidden content because the 
previous heading is folded)" that just adds "\n*" with appropriate 
number of asterisks. I will try ('heading . t).




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-24 12:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-21 15:25 C-RET and empty lines Max Nikulin
2023-08-22  9:52 ` Ihor Radchenko
2023-08-22 11:21   ` Juergen Fenn
2023-08-22 11:38     ` Ihor Radchenko
2023-08-22 12:45       ` Juergen Fenn
2023-08-24 12:10   ` Max Nikulin

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).