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

2011-05-28 Thread Nicolas Goaziou
Hello,

Huy list-orgm...@reml.org writes:

 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.

I have pushed a patch that should go in the right direction. See below.

 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

Fixed.


 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:

This is the intended behavior.

 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.

Fixed. It's the same as the first case, as org-indent-mode sets
org-adapt-indentation to nil.

 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.

Operations are not symmetric because lists and headlines are not
equivalent objects.


 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.

Fixed.

Please report back if something is still wrong. Thank you.

Regards,

-- 
Nicolas Goaziou



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

2011-05-28 Thread Huy
On Sat, May 28, 2011 at 02:29:07PM +0200, Nicolas Goaziou wrote:
 Hello,
 
 Huy list-orgm...@reml.org writes:
 
  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.
 
 I have pushed a patch that should go in the right direction. See below.
 
  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
 
 Fixed.
 
 
  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:
 
 This is the intended behavior.
 
  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.
 
 Fixed. It's the same as the first case, as org-indent-mode sets
 org-adapt-indentation to nil.
 
  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.
 
 Operations are not symmetric because lists and headlines are not
 equivalent objects.
 
 
  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.
 
 Fixed.
 
 Please report back if something is still wrong. Thank you.

Perfect behavior! Exactly what I was expecting.

The only problem is a typo 'skip-blank' instead of 'skip-blanks'

Thanks a lot for the quick turnaround!

 
 Regards,
 
 -- 
 Nicolas Goaziou
 




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

2011-05-28 Thread Nicolas Goaziou
Huy list-orgm...@reml.org writes:

 The only problem is a typo 'skip-blank' instead of 'skip-blanks'

Oops. Fixed that too.

Regards,

-- 
Nicolas Goaziou



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

2011-05-28 Thread Huy
On Sat, May 28, 2011 at 07:09:06AM -0700, Huy wrote:
 On Sat, May 28, 2011 at 02:29:07PM +0200, Nicolas Goaziou wrote:
  Fixed.
  
  Please report back if something is still wrong. Thank you.
 
 Perfect behavior! Exactly what I was expecting.
 
 The only problem is a typo 'skip-blank' instead of 'skip-blanks'
 
 Thanks a lot for the quick turnaround!

Actually, I found a few more problems

Multiple Lines
~~
I had forgotten to test when invoking 'C-c -' on multiple lines.

If I have (with oddeven and org-adapt-indentation on) the following:
** Headline 2
** Converting 2
*** Converting 3
* Converting 1
** Converting 2
*** Converting 3
and I try to do 'C-c -' on the 5 bottom lines, I get:
** Headline 2
   - Converting 1
 - Converting 2
   - Converting 1
   - Converting 1
 - Converting 2

I would hope to get the following instead:
** Headline 2
   - Converting 1
 - Converting 2
   - Converting 1
 - Converting 2
   - Converting 3

Whenever possible, the converted lines should preserve their relative levels 
with their parent.
In the above example, we have 2 subtrees that should be preserved separately.
Of course, we can't keep all 5 items with levels relative to each other, 
otherwise we'd get the nonsensical effect:
  - orphan
- parent
But in other cases, entire subtrees can be preserved.

Strange region behavior and 'C-c *'
~~~
When highlighting a region and then applying 'C-c -', all the lines that have 
at least one character highlighted (anywhere on the line) will be converted.  
That's good and as expected.

But the same doesn't happen with 'C-c *'.  There, it actually matters where the 
region starts/ends in the line.

For example, if you have
** Headline 2
   - Converting 1
If you triple-mouse-click Converting 1 or if you just single-click the cursor 
on Converting 1, then 'C-c *' will convert the line fine.
However, if you only select any of the letters on that line, e.g. the letter 
'v', and then 'C-c *', then you get this:
** Headline 2
*** Con
verting 1


I have other problems that involve vimpulse and its visual mode, but I won't 
bother you with that :)

Thanks,
Huy




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

2011-05-28 Thread Nicolas Goaziou
Huy list-orgm...@reml.org writes:

 Whenever possible, the converted lines should preserve their relative
 levels with their parent. In the above example, we have 2 subtrees
 that should be preserved separately.
 Of course, we can't keep all 5 items with levels relative to each
 other, otherwise we'd get the nonsensical effect:

   - orphan
 - parent

 But in other cases, entire subtrees can be preserved.

Fixed.

 For example, if you have

 ** Headline 2
- Converting 1

 If you triple-mouse-click Converting 1 or if you just single-click
 the cursor on Converting 1, then 'C-c *' will convert the line fine.
 However, if you only select any of the letters on that line, e.g. the
 letter 'v', and then 'C-c *', then you get this:

 ** Headline 2
 *** Con
 verting 1

Fixed too.

 I have other problems that involve vimpulse and its visual mode, but
 I won't bother you with that :)

I can't help there. But, if something is still wrong about toggling
headlines and items, please keep telling me.

Regards,

-- 
Nicolas Goaziou



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

2011-05-27 Thread Huy
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