emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Semantics of 'C-c -' and massively-indented lists
@ 2011-05-27 11:59 Huy
  2011-05-28 12:29 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Huy @ 2011-05-27 11:59 UTC (permalink / raw)
  To: emacs-orgmode

Hello,
I'm a beginner, so please let me know if I'm completely off the mark.

The effects of converting from headline to list with 'C-c -' and back to 'C-c *' don't behave as I'd expect.  The indentation levels seem all wrong, no matter how you look at it.

My Setup
~~~~~~~~
I'm using org 7.5 with Cocoa emacs 23.3 on OSX
Note that I do not have the "odd" option on, I don't do visual-line-mode, and I rely on org-adapt-indentation to be on.

Converting from headline to list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If I have a LEVEL=5 headline and I convert it to a list with 'C-c -', I get too much indentation
***** Headline
***** Converted Line
becomes
***** Headline
        - Converted Line

After looking at the code, I have the impression that the intent is that the LEVEL of the line should remain 5; thus, the list is indented by 2 spaces for each level under 5, i.e. 8 spaces.
But who needs a LEVEL=5 list at this point?

Expected behavior
~~~~~~~~~~~~~~~~~
What I would like is a LEVEL=1 list, properly indented along with the rest of the body text.

If org-adapt-indentation is t, then I would expect to see:
***** Headline
      - Converted Line
where the '-' is aligned with the 'H' of the above headline, at the same column where any body text would start if I hit <TAB> in a line after Headline (if there were no list).

And if org-adapt-indentation is nil, then I would expect to see:
***** Headline
- Converted Line

Workaround
~~~~~~~~~~
Right now, what I have to do is manuallay remove the extra spaces to do the alignment myself.

Converting from list to headline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In fact, if I take the list and I try to convert it back to a headline with 'C-c *', it doesn't even matter how many spaces there are in front of the '-': it's always converted to a LEVEL=5 headline because the parent is LEVEL=4:

***** Headline
        - Converted Line
becomes
***** Headline
****** Converted Line

***** Headline
                   - Converted Line
also becomes
***** Headline
****** Converted Line

***** Headline
- Converted Line
also becomes
***** Headline
****** Converted Line

Well, at least 'C-c *' acts the way I'd expect it to: the line becomes a sub-heading of Headline.

Other modes
~~~~~~~~~~~
Things look especially weird when org-indent-mode is turned on, since you have a mixture of "visual" indentation and hard space indentation.  I would expect a 'C-c -' to insert no hard spaces at all and leave everything in column 0 and let the visual-line-mode adjust the display.

If you have 'odd' mode on, however, everything seems to look perfectly.  Why?  Sheer luck and maybe an off-by-1 bug.  The headlines go up by 2 columns, and '- ' also happens to be 2 characters long.  But also, if 'odd' mode is on, for some reason 1 is added to the resulting list level.  So after the conversion, the list just happens to lign up perfectly with the 'H' of Headline.

***** Headline LEVEL=3
***** Converted Line LEVEL=3
becomes
***** Headline LEVEL=3
      - Converted Line LEVEL=4

This might be the reason that some people haven't noticed this problem.  Maybe most users use 'odd' mode?

Acting relative to the parent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, what happens when we convert the previous example back by using 'C-c *'?  We get a LEVEL-4 headline.
***** Headline LEVEL=3
      - Converted Line LEVEL=4
becomes
***** Headline LEVEL=3
******* Converted Line LEVEL=4

The operations are not symmetric because somehow the LEVEL was incremented.
Well, this behavior actually makes sense.  When we converted from headline to list, we were saying that the headline should now be part of the body text of Headline, so it should be considered a child of Headline, i.e. LEVEL=4.  And going back, well, we might as well preserve LEVEL=4, keeping it as a child of Headline, instead of guessing the user's intent to be LEVEL=3, a sibling of Headline.

What doesn't make sense is what happens when do 'C-c -' once again.
***** Headline LEVEL=3
******* Converted Line LEVEL=4
becomes
***** Headline LEVEL=3
        - Converted Line LEVEL=5

Whoa, all we did was 'C-c -' then 'C-c *' then 'C-c -' and the line got demoted.
I bet at this time, you'd like to know what hapepns when you hit 'C-c *'.  Don't worry, I did it for you.  It comes back to LEVEL=4.  It actually stabilizes, thank god.
***** Headline LEVEL=3
        - Converted Line LEVEL=5
becomes
***** Headline LEVEL=3
******* Converted Line LEVEL=4

Expected behavior
~~~~~~~~~~~~~~~~~
For a given parent headline, there are several cases when applying 'C-c -'.
1)
***** Headline LEVEL=3
***** Converted Line LEVEL=3
2)
***** Headline LEVEL=3
******* Converted Line LEVEL=4
3)
***** Headline LEVEL=3
********* Converted Line LEVEL=5
4)
***** Headline LEVEL=3
*** Converted Line LEVEL=2

For any case, the resulting list should just be a LEVEL=1 list regardless of the level that it started, and it should be properly indented according to the parent headline.  That's because a list should become part of the body of the above headline, no matter what.

And when we go back to 'C-c *', what makes sense is for the line to become a sub-heading of Headline, as is the current behavior.

'C-c *' fringe case
~~~~~~~~~~~~~~~~~~~
In most cases, 'C-c *' acts sanely.
It acts weird when there is no Headline above a list item and you try to convert to a Headline.  Again, in 'odd' mode.
- Converted Line LEVEL=1 (alone without parent)
becomes
** Converted Line LEVEL=1.5 (alone without parent)

Yes, that's a decimal. It's trying to hide in the cracks.

Summary
~~~~~~~
'C-c *' mostly works right.  'C-c -' has strange behavior in all display styles, especially 'oddeven' and org-indent-mode modes and even in 'odd' mode.  The resulting indentation is not useful.

Thanks for responding,
Huy

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

end of thread, other threads:[~2011-05-28 17:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 11:59 Semantics of 'C-c -' and massively-indented lists Huy
2011-05-28 12:29 ` Nicolas Goaziou
2011-05-28 14:09   ` Huy
2011-05-28 15:24     ` Nicolas Goaziou
     [not found]   ` <20110528140906.GA31956@malachiarts.com>
2011-05-28 16:43     ` Huy
2011-05-28 17:49       ` 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).