emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [feature request] org-insert-heading
@ 2012-02-10 20:40 Achim Gratz
  2012-02-11  9:23 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Achim Gratz @ 2012-02-10 20:40 UTC (permalink / raw)
  To: emacs-orgmode

The command M-RET actually does what it's docstring says (insert before
when point is at BOL, split line when it is inside), but there is
inconsistent behaviour when point is at EOL, IMHO. Consider the
following list (or equivalent headline structure), with point after
"aaaa":

- aaaa
  + abbb
  + accc

Using org-insert-heading and entering "bbbb" will produce this:

- aaaa
- bbbb
  + abbb
  + accc

In doing so, the subtree of "aaaa" has been transferred to the new
heading, which is almost never what I want (and could easily be done by
appending the new list or headline text and then splitting the line).  I
would expect that the subtree of "aaaa" is considered as a unit when
inserting a new headline with point at EOL (just like all moving
commands would do and the result should be this:

- aaaa
  + abbb
  + accc
- bbbb

Could org-insert-heading be extended to handle this situation as I
outlined?



Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada

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

* Re: [feature request] org-insert-heading
  2012-02-10 20:40 [feature request] org-insert-heading Achim Gratz
@ 2012-02-11  9:23 ` Nicolas Goaziou
  2012-02-11 17:43   ` Achim Gratz
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2012-02-11  9:23 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Hello,

Achim Gratz <Stromeko@nexgo.de> writes:

> The command M-RET actually does what it's docstring says (insert before
> when point is at BOL, split line when it is inside), but there is
> inconsistent behaviour when point is at EOL, IMHO. Consider the
> following list (or equivalent headline structure), with point after
> "aaaa":
>
> - aaaa
>   + abbb
>   + accc
>
> Using org-insert-heading and entering "bbbb" will produce this:
>
> - aaaa
> - bbbb
>   + abbb
>   + accc
>
> In doing so, the subtree of "aaaa" has been transferred to the new
> heading, which is almost never what I want (and could easily be done by
> appending the new list or headline text and then splitting the line).  I
> would expect that the subtree of "aaaa" is considered as a unit when
> inserting a new headline with point at EOL (just like all moving
> commands would do and the result should be this:
>
> - aaaa
>   + abbb
>   + accc
> - bbbb
>
> Could org-insert-heading be extended to handle this situation as I
> outlined?

By default, M-RET is allowed to split lines, and therefore contents. You
may use the following to achieve the desired effect:

--8<---------------cut here---------------start------------->8---
(setq org-M-RET-may-split-line '((item) (default . t)))
--8<---------------cut here---------------end--------------->8---


Regards,

-- 
Nicolas Goaziou

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

* Re: [feature request] org-insert-heading
  2012-02-11  9:23 ` Nicolas Goaziou
@ 2012-02-11 17:43   ` Achim Gratz
  2012-02-11 18:00     ` Bernt Hansen
  2012-02-12  8:19     ` Nicolas Goaziou
  0 siblings, 2 replies; 6+ messages in thread
From: Achim Gratz @ 2012-02-11 17:43 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:
> By default, M-RET is allowed to split lines, and therefore contents.

Let me re-formulate my request:

If the point is at EOL, there actually is no line to split and it would be far
more logical if the new heading/item would simply be inserted after the
current one (including any subtree that belongs to the current item).

> You may use the following to achieve the desired effect:
>
> (setq org-M-RET-may-split-line '((item) (default . t)))

I actually like the ability to split lines with M-RET, especially since
there doesn't seem to be a sane way to tell org that "yes I want to
split the line this time".  What I want is that "point at EOL" is
recognized as a special situation, much like "point at BOL" already is.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf Blofeld V1.15B11:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: [feature request] org-insert-heading
  2012-02-11 17:43   ` Achim Gratz
@ 2012-02-11 18:00     ` Bernt Hansen
  2012-02-11 18:17       ` Achim Gratz
  2012-02-12  8:19     ` Nicolas Goaziou
  1 sibling, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2012-02-11 18:00 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> By default, M-RET is allowed to split lines, and therefore contents.
>
> Let me re-formulate my request:
>
> If the point is at EOL, there actually is no line to split and it
> would be far
> more logical if the new heading/item would simply be inserted after
> the
> current one (including any subtree that belongs to the current item).

Hi Achim,

I use C-RET for inserting new headings and respecting content.
M-RET should NOT respect content in my setup so I think your suggestion
would make that inconsistent.

Regards,
Bernt

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

* Re: [feature request] org-insert-heading
  2012-02-11 18:00     ` Bernt Hansen
@ 2012-02-11 18:17       ` Achim Gratz
  0 siblings, 0 replies; 6+ messages in thread
From: Achim Gratz @ 2012-02-11 18:17 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:
> I use C-RET for inserting new headings and respecting content.

That _only_ works for headings, not items.  C-RET always inserts a new
heading (and BTW, it does treat BOL specially, too).

> M-RET should NOT respect content in my setup so I think your
> suggestion would make that inconsistent.

If C-RET was also working on lists like M-RET does then I might concur
with this view.  So maybe the inconsistency is that org-insert-heading
works on list items, but org-insert-heading-respect-content does not?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: [feature request] org-insert-heading
  2012-02-11 17:43   ` Achim Gratz
  2012-02-11 18:00     ` Bernt Hansen
@ 2012-02-12  8:19     ` Nicolas Goaziou
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2012-02-12  8:19 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Hello,

Achim Gratz <Stromeko@nexgo.de> writes:

> I actually like the ability to split lines with M-RET, especially since
> there doesn't seem to be a sane way to tell org that "yes I want to
> split the line this time".  What I want is that "point at EOL" is
> recognized as a special situation, much like "point at BOL" already
> is.

Excepted that, unlike to headlines, EOL is _not_ a special position in
an item. Remember that an headline has to fit on a single line, whereas
an item may span over multiple paragraphs, tables, and even plain lists.

Look at the following example:

#+begin_src org
- first line of the first item

  another paragraph in the item

  one last paragraph

- second item
#+end_src

If I use M-RET with point between "first" and "item", I get ("|" being
the point):

#+begin_src org
- first line of the first

- |item

  another paragraph in the item

  one last paragraph

- second item
#+end_src

If I use M-RET with point a word further, that is after "item",
I logically have:

#+begin_src org
- first line of the first item

- |

  another paragraph in the item

  one last paragraph

- second item
#+end_src

It will be the same if I use M-RET before "another". I can also go on
with point after "another":

#+begin_src org
- first line of the first item

  another

- |paragraph in the item

  one last paragraph

- second item
#+end_src

It is very predictable, isn't it?

On the other hand, it isn't consistent to allow, at every EOL in the
item, to jump below contents and add a new item there.

Now, perhaps the variable's name is misleading, as it isn't really about
splitting lines, which make no sense in items, but splitting contents.

Note that you can easily obtain what you want with M-RET M-DOWN at
beginning of item, or even write a function to do with even less
keystrokes.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2012-02-12  8:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 20:40 [feature request] org-insert-heading Achim Gratz
2012-02-11  9:23 ` Nicolas Goaziou
2012-02-11 17:43   ` Achim Gratz
2012-02-11 18:00     ` Bernt Hansen
2012-02-11 18:17       ` Achim Gratz
2012-02-12  8:19     ` Nicolas Goaziou

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