emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Semantics of 'C-c -' and massively-indented lists


From: Huy
Subject: [O] Semantics of 'C-c -' and massively-indented lists
Date: Fri, 27 May 2011 04:59:42 -0700

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]