emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to preserve empty headings
@ 2020-11-30 17:21 Titus von der Malsburg
  2020-11-30 17:31 ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 1 reply; 9+ messages in thread
From: Titus von der Malsburg @ 2020-11-30 17:21 UTC (permalink / raw)
  To: Org mailing list


When I start a new line with '* ' followed by RET, the space is automatically deleted and I’m left with a line that just has the asterisk (i.e. not a headline).

Unfortunately there are use cases where empty headlines make sense and they occur often in my work.  One example is Beamer slides where each headline at some level produces a slide.  If the user needs a slide without title (common, e.g., for a large images that fill the slide), an empty headline is needed.

Is there a way to teach Org to leave the empty headline intact?

I may be old-fashioned but when I type '* ', I do it for a reason and I wish that my text editor respects that. :)

  Titus


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

* Re: How to preserve empty headings
  2020-11-30 17:21 How to preserve empty headings Titus von der Malsburg
@ 2020-11-30 17:31 ` Berry, Charles via General discussions about Org-mode.
  2020-11-30 18:14   ` Titus von der Malsburg
  0 siblings, 1 reply; 9+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2020-11-30 17:31 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: Org mailing list



> On Nov 30, 2020, at 9:21 AM, Titus von der Malsburg <malsburg@posteo.de> wrote:
> 
> 
> When I start a new line with '* ' followed by RET, the space is automatically deleted and I’m left with a line that just has the asterisk (i.e. not a headline).
> 
> Unfortunately there are use cases where empty headlines make sense and they occur often in my work.  One example is Beamer slides where each headline at some level produces a slide.  If the user needs a slide without title (common, e.g., for a large images that fill the slide), an empty headline is needed.
> 
> Is there a way to teach Org to leave the empty headline intact?
> 
> I may be old-fashioned but when I type '* ', I do it for a reason and I wish that my text editor respects that. :)
> 


Instead of `* SPACE RET', try `* SPACE C-j'.

This works for me and leaves a blank heading intact through export.

HTH,

Chuck

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

* Re: How to preserve empty headings
  2020-11-30 17:31 ` Berry, Charles via General discussions about Org-mode.
@ 2020-11-30 18:14   ` Titus von der Malsburg
  2020-11-30 18:25     ` Diego Zamboni
  0 siblings, 1 reply; 9+ messages in thread
From: Titus von der Malsburg @ 2020-11-30 18:14 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Org mailing list


On 2020-11-30 Mon 18:31, Berry, Charles wrote:
>> On Nov 30, 2020, at 9:21 AM, Titus von der Malsburg <malsburg@posteo.de> wrote:
>> 
>> 
>> When I start a new line with '* ' followed by RET, the space is automatically deleted and I’m left with a line that just has the asterisk (i.e. not a headline).
>> 
>> Unfortunately there are use cases where empty headlines make sense and they occur often in my work.  One example is Beamer slides where each headline at some level produces a slide.  If the user needs a slide without title (common, e.g., for a large images that fill the slide), an empty headline is needed.
>> 
>> Is there a way to teach Org to leave the empty headline intact?
>> 
>> I may be old-fashioned but when I type '* ', I do it for a reason and I wish that my text editor respects that. :)
>> 
>
>
> Instead of `* SPACE RET', try `* SPACE C-j'.

I’m aware of several workarounds and this one is perhaps the best.  However, I’d prefer if RET would just work as expected.  Org sometimes inserts extra material on RET which I think is okay (e.g. indentation), but is there any precedent, in Org or Emacs more broadly, for RET deleting text?  It seems very counter-intuitive to me.

  Titus



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

* Re: How to preserve empty headings
  2020-11-30 18:14   ` Titus von der Malsburg
@ 2020-11-30 18:25     ` Diego Zamboni
  2020-11-30 18:38       ` Titus von der Malsburg
  2020-11-30 19:20       ` Titus von der Malsburg
  0 siblings, 2 replies; 9+ messages in thread
From: Diego Zamboni @ 2020-11-30 18:25 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: Berry, Charles, Org mailing list

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

>
> I’m aware of several workarounds and this one is perhaps the best.
> However, I’d prefer if RET would just work as expected.  Org sometimes
> inserts extra material on RET which I think is okay (e.g. indentation), but
> is there any precedent, in Org or Emacs more broadly, for RET deleting
> text?  It seems very counter-intuitive to me.
>

 Could it be that the space is being deleted not when you press RET but
when you save the file? I don't see any space deletion when entering an
empty headline, but in my config, whitespace at end of lines is deleted
on save. In Doom Emacs this is enabled by default, and even before I was
using =delete-trailing-whitespace= as part of my =before-save-hook=.

--Diego

[-- Attachment #2: Type: text/html, Size: 967 bytes --]

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

* Re: How to preserve empty headings
  2020-11-30 18:25     ` Diego Zamboni
@ 2020-11-30 18:38       ` Titus von der Malsburg
  2020-11-30 19:17         ` Tom Gillespie
  2020-11-30 19:25         ` Diego Zamboni
  2020-11-30 19:20       ` Titus von der Malsburg
  1 sibling, 2 replies; 9+ messages in thread
From: Titus von der Malsburg @ 2020-11-30 18:38 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: Berry, Charles, Org mailing list


On 2020-11-30 Mon 19:25, Diego Zamboni wrote:
>>
>> I’m aware of several workarounds and this one is perhaps the best.
>> However, I’d prefer if RET would just work as expected.  Org sometimes
>> inserts extra material on RET which I think is okay (e.g. indentation), but
>> is there any precedent, in Org or Emacs more broadly, for RET deleting
>> text?  It seems very counter-intuitive to me.
>>
>
>  Could it be that the space is being deleted not when you press RET but
> when you save the file? I don't see any space deletion when entering an
> empty headline, but in my config, whitespace at end of lines is deleted
> on save. In Doom Emacs this is enabled by default, and even before I was
> using =delete-trailing-whitespace= as part of my =before-save-hook=.
> --Diego

The space is deleted immediately.  But the fact that it’s not happening on your system perhaps means that there *is* a setting that prevents it.  The question is: which?

By the way, I’m using the master branch from https://code.orgmode.org/bzg/org-mode.git as installed by straight.el.

  Titus



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

* Re: How to preserve empty headings
  2020-11-30 18:38       ` Titus von der Malsburg
@ 2020-11-30 19:17         ` Tom Gillespie
  2020-11-30 19:25         ` Diego Zamboni
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Gillespie @ 2020-11-30 19:17 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: Diego Zamboni, Org mailing list, Berry, Charles

This is caused by elastic-indent-mode. As foretold
https://lists.gnu.org/archive/html/emacs-orgmode/2020-11/msg00325.html.
Tom

On Mon, Nov 30, 2020 at 1:38 PM Titus von der Malsburg
<malsburg@posteo.de> wrote:
>
>
> On 2020-11-30 Mon 19:25, Diego Zamboni wrote:
> >>
> >> I’m aware of several workarounds and this one is perhaps the best.
> >> However, I’d prefer if RET would just work as expected.  Org sometimes
> >> inserts extra material on RET which I think is okay (e.g. indentation), but
> >> is there any precedent, in Org or Emacs more broadly, for RET deleting
> >> text?  It seems very counter-intuitive to me.
> >>
> >
> >  Could it be that the space is being deleted not when you press RET but
> > when you save the file? I don't see any space deletion when entering an
> > empty headline, but in my config, whitespace at end of lines is deleted
> > on save. In Doom Emacs this is enabled by default, and even before I was
> > using =delete-trailing-whitespace= as part of my =before-save-hook=.
> > --Diego
>
> The space is deleted immediately.  But the fact that it’s not happening on your system perhaps means that there *is* a setting that prevents it.  The question is: which?
>
> By the way, I’m using the master branch from https://code.orgmode.org/bzg/org-mode.git as installed by straight.el.
>
>   Titus
>
>


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

* Re: How to preserve empty headings
  2020-11-30 18:25     ` Diego Zamboni
  2020-11-30 18:38       ` Titus von der Malsburg
@ 2020-11-30 19:20       ` Titus von der Malsburg
  1 sibling, 0 replies; 9+ messages in thread
From: Titus von der Malsburg @ 2020-11-30 19:20 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: Berry, Charles, Org mailing list


On 2020-11-30 Mon 19:25, Diego Zamboni wrote:
>>
>> I’m aware of several workarounds and this one is perhaps the best.
>> However, I’d prefer if RET would just work as expected.  Org sometimes
>> inserts extra material on RET which I think is okay (e.g. indentation), but
>> is there any precedent, in Org or Emacs more broadly, for RET deleting
>> text?  It seems very counter-intuitive to me.
>>
>
>  Could it be that the space is being deleted not when you press RET but
> when you save the file? I don't see any space deletion when entering an
> empty headline, but in my config, whitespace at end of lines is deleted
> on save. In Doom Emacs this is enabled by default, and even before I was
> using =delete-trailing-whitespace= as part of my =before-save-hook=.

Your comment has put me on the right track.  The line-final whitespace was not deleted by org but by electric-indent-mode, which apparently does this by default.

Sorry for the noise!

  Titus


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

* Re: How to preserve empty headings
  2020-11-30 18:38       ` Titus von der Malsburg
  2020-11-30 19:17         ` Tom Gillespie
@ 2020-11-30 19:25         ` Diego Zamboni
  2020-11-30 22:25           ` Berry, Charles via General discussions about Org-mode.
  1 sibling, 1 reply; 9+ messages in thread
From: Diego Zamboni @ 2020-11-30 19:25 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: Berry, Charles, Org mailing list

[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

What are RET and C-j bound to?

In my setup, RET is bound to =org-return=, which does not delete spaces,
but C-j is bound to =org-return-and-maybe-indent=, which does. So I have
the opposite behavior as yours.

There were some recent changes in behavior of Org with respect to
electric-indent-mode (long discussion in the list), I think this might have
something to do with it but did not follow the full discussion.

Hope this helps,
--Diego


On Mon, Nov 30, 2020 at 7:38 PM Titus von der Malsburg <malsburg@posteo.de>
wrote:

>
> On 2020-11-30 Mon 19:25, Diego Zamboni wrote:
> >>
> >> I’m aware of several workarounds and this one is perhaps the best.
> >> However, I’d prefer if RET would just work as expected.  Org sometimes
> >> inserts extra material on RET which I think is okay (e.g. indentation),
> but
> >> is there any precedent, in Org or Emacs more broadly, for RET deleting
> >> text?  It seems very counter-intuitive to me.
> >>
> >
> >  Could it be that the space is being deleted not when you press RET but
> > when you save the file? I don't see any space deletion when entering an
> > empty headline, but in my config, whitespace at end of lines is deleted
> > on save. In Doom Emacs this is enabled by default, and even before I was
> > using =delete-trailing-whitespace= as part of my =before-save-hook=.
> > --Diego
>
> The space is deleted immediately.  But the fact that it’s not happening on
> your system perhaps means that there *is* a setting that prevents it.  The
> question is: which?
>
> By the way, I’m using the master branch from
> https://code.orgmode.org/bzg/org-mode.git as installed by straight.el.
>
>   Titus
>
>

[-- Attachment #2: Type: text/html, Size: 2265 bytes --]

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

* Re: How to preserve empty headings
  2020-11-30 19:25         ` Diego Zamboni
@ 2020-11-30 22:25           ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 0 replies; 9+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2020-11-30 22:25 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: Org mailing list, Titus von der Malsburg



> On Nov 30, 2020, at 11:25 AM, Diego Zamboni <diego@zzamboni.org> wrote:
> 
> What are RET and C-j bound to?
> 
> In my setup, RET is bound to =org-return=, which does not delete spaces, but C-j is bound to =org-return-and-maybe-indent=, which does. So I have the opposite behavior as yours.
> 


Probably you have `electric-indent-mode' set to nil.

C-j is org-return-and-maybe-indent.

RET is org-return.

If I read the docstrings correctly, org-return (thru org--newline) and org-return-and-indent-maybe both trefer to electric-indent-mode, but in opposite manner (nil vs. t).

Chuck

[rest deleted]


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

end of thread, other threads:[~2020-11-30 22:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 17:21 How to preserve empty headings Titus von der Malsburg
2020-11-30 17:31 ` Berry, Charles via General discussions about Org-mode.
2020-11-30 18:14   ` Titus von der Malsburg
2020-11-30 18:25     ` Diego Zamboni
2020-11-30 18:38       ` Titus von der Malsburg
2020-11-30 19:17         ` Tom Gillespie
2020-11-30 19:25         ` Diego Zamboni
2020-11-30 22:25           ` Berry, Charles via General discussions about Org-mode.
2020-11-30 19:20       ` Titus von der Malsburg

Code repositories for project(s) associated with this 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).