emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Two bugs in org-indent (plus a fix to correct one of them)
@ 2010-06-13  2:44 William Henney
  2010-06-15 11:02 ` David Maus
  2010-09-23 19:09 ` David Maus
  0 siblings, 2 replies; 6+ messages in thread
From: William Henney @ 2010-06-13  2:44 UTC (permalink / raw)
  To: emacs-org

Hi all

I have recently started using org-indent (together with word-wrap) for
new org files. In general, I love it. But there are a couple of small
problems:

1. If one sets org-indent-indentation-per-level to any value other
than the default of 2, then the indentation of lines following a
heading is not correct. I seem to have managed to fix this by changing
line 231 of org-indent.el from

		 n (* (or level 0) org-indent-indentation-per-level))))))))

to

		 n (+ 2 (* (1- (or level 0)) org-indent-indentation-per-level)))))))))

Tested with org-indent-indentation-per-level = 0, 1, 2, and 3.

2. org-indent fails to play nicely with org-inlinetask in two ways

   i) It destroys the special fontification of the inline task's
leading stars, even if org-indent-mode-turns-on-hiding-stars is set to
nil

   ii) Any text after an inline task's END statement is soft-indented
as though it were part of the inline task, whereas the indentation
should ideally return to what it was before the inline task. Of
course, this is also a problem when org-indent is turned off, if you
try to automatically hard-indent using TAB. However, in that case you
can adjust by hand the indentation of the first line after the inline
task, and then all the following lines will indent correctly. With
org-indent the problem is much worse since there is no way of
adjusting the soft indents by hand.

Cheers

Will

P.S. Has anyone successfully converted a pre-existing org file to a
form suitable for use with org-indent? By which I mean that the
pre-existing file was written with hard line breaks and hard indents.
The task is not trivial since one needs to remove the hard indents due
to the nesting of the org headings, but to leave alone the hard
indents due to the nesting of plain lists.

-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

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

* Re: Two bugs in org-indent (plus a fix to correct one of them)
  2010-06-13  2:44 Two bugs in org-indent (plus a fix to correct one of them) William Henney
@ 2010-06-15 11:02 ` David Maus
  2010-06-15 23:10   ` William Henney
  2010-09-23 19:09 ` David Maus
  1 sibling, 1 reply; 6+ messages in thread
From: David Maus @ 2010-06-15 11:02 UTC (permalink / raw)
  To: William Henney; +Cc: emacs-org


[-- Attachment #1.1: Type: text/plain, Size: 1723 bytes --]

William Henney wrote:
>Hi all

>1. If one sets org-indent-indentation-per-level to any value other
>than the default of 2, then the indentation of lines following a
>heading is not correct. I seem to have managed to fix this by changing
>line 231 of org-indent.el from

>		 n (* (or level 0) org-indent-indentation-per-level))))))))

>to

>		 n (+ 2 (* (1- (or level 0)) org-indent-indentation-per-level)))))))))

>Tested with org-indent-indentation-per-level = 0, 1, 2, and 3.

I don't understand this: The original formula sets the indentation
level of n times org-indent-indentation-per-level with n being the
outline level.  Why do you consider this not being correct?[1]

>2. org-indent fails to play nicely with org-inlinetask in two ways

>   i) It destroys the special fontification of the inline task's
>leading stars, even if org-indent-mode-turns-on-hiding-stars is set to
>nil

>   ii) Any text after an inline task's END statement is soft-indented
>as though it were part of the inline task, whereas the indentation
>should ideally return to what it was before the inline task. Of
>course, this is also a problem when org-indent is turned off, if you
>try to automatically hard-indent using TAB. However, in that case you
>can adjust by hand the indentation of the first line after the inline
>task, and then all the following lines will indent correctly. With
>org-indent the problem is much worse since there is no way of
>adjusting the soft indents by hand.

Yes, I can confirm these two things.

  -- Davie


[1] Besides, the suggested function does not consider no outline
level.  I.e. returns negative indentation.
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Two bugs in org-indent (plus a fix to correct one of them)
  2010-06-15 11:02 ` David Maus
@ 2010-06-15 23:10   ` William Henney
  2010-06-15 23:17     ` William Henney
  2010-06-18 15:42     ` David Maus
  0 siblings, 2 replies; 6+ messages in thread
From: William Henney @ 2010-06-15 23:10 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-org

Hi David

Thanks for looking at this.

On Tue, Jun 15, 2010 at 6:02 AM, David Maus <dmaus@ictsoc.de> wrote:
> William Henney wrote:
>>Hi all
>
>>1. If one sets org-indent-indentation-per-level to any value other
>>than the default of 2, then the indentation of lines following a
>>heading is not correct. I seem to have managed to fix this by changing
>>line 231 of org-indent.el from
>
>>                n (* (or level 0) org-indent-indentation-per-level))))))))
>
>>to
>
>>                n (+ 2 (* (1- (or level 0)) org-indent-indentation-per-level)))))))))
>
>>Tested with org-indent-indentation-per-level = 0, 1, 2, and 3.
>
> I don't understand this: The original formula sets the indentation
> level of n times org-indent-indentation-per-level with n being the
> outline level.  Why do you consider this not being correct?[1]
>

Consider what one would want to happen when
org-indent-indentation-per-level = 1 (which is what I prefer):

Indentation of 0
* Level one heading
  Indentation of 2
** Level two heading
   Indentation of 3
*** Level three heading
    Indentation of 4

So, the desired sequence of indentation is [0, 2, 3, 4, ...] whereas
the original formula gives the sequence [0, 1, 2, 3, ...]

> [1] Besides, the suggested function does not consider no outline
> level.  I.e. returns negative indentation.

Yes, you are quite right -- my function does indeed return garbage if
you are before the first headline.  However, in practice this is not a
problem since the line-prefix and wrap-prefix text properties only
seem to get applied to text after headlines. But I am sure that the
lisp experts on the list can come up with a more elegant function than
mine.

Cheers

Will


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

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

* Re: Two bugs in org-indent (plus a fix to correct one of them)
  2010-06-15 23:10   ` William Henney
@ 2010-06-15 23:17     ` William Henney
  2010-06-18 15:42     ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: William Henney @ 2010-06-15 23:17 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-org

On Tue, Jun 15, 2010 at 6:10 PM, William Henney <whenney@gmail.com> wrote:
> Indentation of 0
> * Level one heading
>  Indentation of 2
> ** Level two heading
>   Indentation of 3
> *** Level three heading
>    Indentation of 4

This is very odd - gmail ate my spaces! What I actually typed was the
following (spaces substituted by underscores this time):

Indentation of 0
* Level one heading
__Indentation of 2
** Level two heading
___Indentation of 3
*** Level three heading
____Indentation of 4

Cheers

Will


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

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

* Re: Two bugs in org-indent (plus a fix to correct one of them)
  2010-06-15 23:10   ` William Henney
  2010-06-15 23:17     ` William Henney
@ 2010-06-18 15:42     ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: David Maus @ 2010-06-18 15:42 UTC (permalink / raw)
  To: William Henney; +Cc: emacs-org


[-- Attachment #1.1: Type: text/plain, Size: 675 bytes --]

William Henney wrote:

>Consider what one would want to happen when
>org-indent-indentation-per-level = 1 (which is what I prefer):

>Indentation of 0
>* Level one heading
>  Indentation of 2
>** Level two heading
>   Indentation of 3
>*** Level three heading
>    Indentation of 4

>So, the desired sequence of indentation is [0, 2, 3, 4, ...] whereas
>the original formula gives the sequence [0, 1, 2, 3, ...]

Ah, so it boils down to the question what proper indentation looks
like.  Suppose this could only be 'solved' by providing
customization for the formula itself.

 -- David

--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Two bugs in org-indent (plus a fix to correct one of them)
  2010-06-13  2:44 Two bugs in org-indent (plus a fix to correct one of them) William Henney
  2010-06-15 11:02 ` David Maus
@ 2010-09-23 19:09 ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: David Maus @ 2010-09-23 19:09 UTC (permalink / raw)
  To: William Henney; +Cc: emacs-org


[-- Attachment #1.1: Type: text/plain, Size: 1255 bytes --]

William Henney wrote:
>Hi all

>I have recently started using org-indent (together with word-wrap) for
>new org files. In general, I love it. But there are a couple of small
>problems:


>2. org-indent fails to play nicely with org-inlinetask in two ways

>   i) It destroys the special fontification of the inline task's
>leading stars, even if org-indent-mode-turns-on-hiding-stars is set to
>nil

>   ii) Any text after an inline task's END statement is soft-indented
>as though it were part of the inline task, whereas the indentation
>should ideally return to what it was before the inline task. Of
>course, this is also a problem when org-indent is turned off, if you
>try to automatically hard-indent using TAB. However, in that case you
>can adjust by hand the indentation of the first line after the inline
>task, and then all the following lines will indent correctly. With
>org-indent the problem is much worse since there is no way of
>adjusting the soft indents by hand.

Not a fix yet, but kind of a bump.  Having the text below an
inline-task wrongly indented makes inline-tasks completely unusable
with `org-indent-mode' turned on.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-09-23 19:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-13  2:44 Two bugs in org-indent (plus a fix to correct one of them) William Henney
2010-06-15 11:02 ` David Maus
2010-06-15 23:10   ` William Henney
2010-06-15 23:17     ` William Henney
2010-06-18 15:42     ` David Maus
2010-09-23 19:09 ` David Maus

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