emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Automatic indentation of org tree
@ 2009-07-27 20:04 User
  2009-07-27 20:47 ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: User @ 2009-07-27 20:04 UTC (permalink / raw)
  To: emacs-orgmode

I put this package here too if someone's interested in developing
it, because it's unlikely I will have the time to work on it.

http://www.emacswiki.org/emacs/orgindent.el


Once loaded M-x orgindent-activate activates indentation in the
current buffer, so everything under a header is indented
according to level. Default indent size is 2
(configurable).

There are some unpolished parts in it (e.g. the header regexp is
hardcoded), but aside from those, it seemed to work well in the
few tests I run.

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

* Re: Automatic indentation of org tree
  2009-07-27 20:04 Automatic indentation of org tree User
@ 2009-07-27 20:47 ` Bastien
  2009-07-28  4:25   ` User
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2009-07-27 20:47 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> I put this package here too if someone's interested in developing
> it, because it's unlikely I will have the time to work on it.
>
> http://www.emacswiki.org/emacs/orgindent.el

Is this supposed to fix a problem or to provide a new functionality?

If it is a new functionality, so far so good.  But if it fixes a
problem, better to say what the problem is and try to solve it in Org.

Thanks!

-- 
 Bastien

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

* Re: Automatic indentation of org tree
  2009-07-27 20:47 ` Bastien
@ 2009-07-28  4:25   ` User
  2009-07-28 12:05     ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: User @ 2009-07-28  4:25 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastienguerry <at> googlemail.com> writes:

> 
> User <spamfilteraccount <at> gmail.com> writes:
> 
> > I put this package here too if someone's interested in developing
> > it, because it's unlikely I will have the time to work on it.
> >
> > http://www.emacswiki.org/emacs/orgindent.el
> 
> Is this supposed to fix a problem or to provide a new functionality?
> 
> If it is a new functionality, so far so good.  But if it fixes a
> problem, better to say what the problem is and try to solve it in Org.

It is a possible solution to the clean view problem mentioned in
the org manuual:

  Indentation of text below headlines

  You may indent text below each headline to make the left
  boundary line up with the headline, like

            *** 3rd level
                more text, now indented


  A good way to get this indentation is by hand, and Org supports
  this with paragraph filling, line wrapping, and structure
  editing99 preserving or adapting the indentation as
  appropriate. A different approach would be to have a way to
  automatically indent lines according to outline structure by
  adding overlays or text properties. But I have not yet found a
  robust and efficient way to do this in large files.

http://orgmode.org/manual/#Clean-view


The solution I posted implements that different approach, so you
don't have to do the indentation by hand.

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

* Re: Re: Automatic indentation of org tree
  2009-07-28  4:25   ` User
@ 2009-07-28 12:05     ` Bastien
  2009-07-28 19:32       ` User
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2009-07-28 12:05 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> It is a possible solution to the clean view problem mentioned in
> the org manuual:
>
>   Indentation of text below headlines
>
>   You may indent text below each headline to make the left
>   boundary line up with the headline, like
>
>             *** 3rd level
>                 more text, now indented
>
>
>   A good way to get this indentation is by hand, and Org supports
>   this with paragraph filling, line wrapping, and structure
>   editing99 preserving or adapting the indentation as
>   appropriate. A different approach would be to have a way to
>   automatically indent lines according to outline structure by
>   adding overlays or text properties. But I have not yet found a
>   robust and efficient way to do this in large files.
>
> http://orgmode.org/manual/#Clean-view
>
>
> The solution I posted implements that different approach, so you
> don't have to do the indentation by hand.

Okay, I see.

I tested your code but there are several problems: it is not usable on
big files, and even on small files the auto-indentation is confusing.
For example, stars get indented while there should not.  

I guess this is still work-in-progress -- hope you'll find ways to fix
the problems above!

-- 
 Bastien

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

* Re: Automatic indentation of org tree
  2009-07-28 12:05     ` Bastien
@ 2009-07-28 19:32       ` User
  2009-07-29  5:41         ` Bastien
  2009-08-03  4:36         ` Carsten Dominik
  0 siblings, 2 replies; 10+ messages in thread
From: User @ 2009-07-28 19:32 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastienguerry <at> googlemail.com> writes:
> 
> I tested your code but there are several problems: it is not usable on
> big files, 

The size of the file shouldn't matter, since only lines in the
current window are indented. Probably, some trivial bug remained
in it which my tests didn't cover.

> and even on small files the auto-indentation is confusing.
> For example, stars get indented while there should not.  

It's a matter of taste. I didn't find it confusing. But it's
trivial to change it to avoid indenting header lines.

> I guess this is still work-in-progress -- hope you'll find ways
> to fix the problems above!

It's a proof-of-concept package, but I think the underlining
concept is solid. If someone motivated spends a little time on it
then I'm sure the problems can be ironed out quickly.

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

* Re: Re: Automatic indentation of org tree
  2009-07-28 19:32       ` User
@ 2009-07-29  5:41         ` Bastien
  2009-08-03  4:36         ` Carsten Dominik
  1 sibling, 0 replies; 10+ messages in thread
From: Bastien @ 2009-07-29  5:41 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> Bastien <bastienguerry <at> googlemail.com> writes:
>> 
>> I tested your code but there are several problems: it is not usable on
>> big files, 
>
> The size of the file shouldn't matter, since only lines in the
> current window are indented. Probably, some trivial bug remained
> in it which my tests didn't cover.

Okay.

>> and even on small files the auto-indentation is confusing.
>> For example, stars get indented while there should not.  
>
> It's a matter of taste. I didn't find it confusing. But it's
> trivial to change it to avoid indenting header lines.

"Confusing" was a polite version of "buggy" :)  

>> I guess this is still work-in-progress -- hope you'll find ways
>> to fix the problems above!
>
> It's a proof-of-concept package, but I think the underlining
> concept is solid. If someone motivated spends a little time on it
> then I'm sure the problems can be ironed out quickly.

As you already guessed, I try to make *you* spend a little more time on
it :)  Because I think the idea is nice and the code can be useful.

-- 
 Bastien

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

* Re: Re: Automatic indentation of org tree
  2009-07-28 19:32       ` User
  2009-07-29  5:41         ` Bastien
@ 2009-08-03  4:36         ` Carsten Dominik
  2009-08-03 16:49           ` Eric S Fraga
  1 sibling, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2009-08-03  4:36 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode


On Jul 28, 2009, at 9:32 PM, User wrote:

> Bastien <bastienguerry <at> googlemail.com> writes:
>>
>> I tested your code but there are several problems: it is not usable  
>> on
>> big files,
>
> The size of the file shouldn't matter, since only lines in the
> current window are indented. Probably, some trivial bug remained
> in it which my tests didn't cover.

Thanks for being interested in this functionality which I wanted
to have for a very long time, and which I have tried to
implement several times in the past, without success.

Bastien is right that your solution is not working in large files.
The reason for this is outline folding.  The current window can
contain an arbitrary number of lines if these are hidden under
a headline.  If you try your solution on such file, you will see
the large delay caused by the indentation.  In addition,
the huge number of markers produced to track the overlays will
bog down any editing attempts.

In fact, your package has just the same problems as my org-indent.el
that has been in the contrib directory for some time.

Incidentally, I have worked during my vacation on a solution that uses
text properties (line-prefix and wrap-prefix) and hooks into font-lock.
The reason why it uses font-lock is because the only the display  
engine is
fast enough to figure out which text will be indeed be displayed.
The reason why I am using text properties is because they do not seem
to use markers and do not slow down editing even if the entire buffer
has the properties attached.

I am also using a different approach for the headline stars, by
enforcing hidestars, and indenting the headline half as much as
the text lines to implement a complete clean view with a single
command (or startup option....)

This solution is for Emacs 23 only, but I believe it is more stable,
so I am shipping it now with Org.

If anyone wants to try before the next release, put

#+STARTUP: indent

into a file after pulling the latest git version.

- Carsten

>
>> and even on small files the auto-indentation is confusing.
>> For example, stars get indented while there should not.
>
> It's a matter of taste. I didn't find it confusing. But it's
> trivial to change it to avoid indenting header lines.
>
>> I guess this is still work-in-progress -- hope you'll find ways
>> to fix the problems above!
>
> It's a proof-of-concept package, but I think the underlining
> concept is solid. If someone motivated spends a little time on it
> then I'm sure the problems can be ironed out quickly.
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 10+ messages in thread

* Re: Re: Automatic indentation of org tree
  2009-08-03  4:36         ` Carsten Dominik
@ 2009-08-03 16:49           ` Eric S Fraga
  2009-08-04 15:08             ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2009-08-03 16:49 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: User, emacs-orgmode

At Mon, 3 Aug 2009 06:36:17 +0200,
Carsten Dominik wrote:
> 

[...]

> This solution is for Emacs 23 only, but I believe it is more stable,
> so I am shipping it now with Org.
> 
> If anyone wants to try before the next release, put
> 
> #+STARTUP: indent
> 
> into a file after pulling the latest git version.

I like it!  However, it obviously isn't intended for use for files
where only odd level headings are used?

In any case, I still have to use Emacs 22 on one computer so cannot
switch over (although would like to!).

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

* Re: Re: Automatic indentation of org tree
  2009-08-03 16:49           ` Eric S Fraga
@ 2009-08-04 15:08             ` Carsten Dominik
  2009-08-04 17:49               ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2009-08-04 15:08 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: User, emacs-orgmode


On Aug 3, 2009, at 6:49 PM, Eric S Fraga wrote:

> At Mon, 3 Aug 2009 06:36:17 +0200,
> Carsten Dominik wrote:
>>
>
> [...]
>
>> This solution is for Emacs 23 only, but I believe it is more stable,
>> so I am shipping it now with Org.
>>
>> If anyone wants to try before the next release, put
>>
>> #+STARTUP: indent
>>
>> into a file after pulling the latest git version.
>
> I like it!  However, it obviously isn't intended for use for files
> where only odd level headings are used?
>
> In any case, I still have to use Emacs 22 on one computer so cannot
> switch over (although would like to!).

Hmmm,

it would not be hard to make this work under odd-levels conditions.
However, when you are using odd levels and hidestars for clean view
under Emacs 22, I would suspect that you are also indenting text
under the headline by hand.  This will then look bad if you use
the same file under Emacs 23 with org-indent-mode turned on.

?

- Carsten

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

* Re: Re: Automatic indentation of org tree
  2009-08-04 15:08             ` Carsten Dominik
@ 2009-08-04 17:49               ` Eric S Fraga
  0 siblings, 0 replies; 10+ messages in thread
From: Eric S Fraga @ 2009-08-04 17:49 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: User, emacs-orgmode

At Tue, 4 Aug 2009 17:08:23 +0200,
Carsten Dominik wrote:
> 
> 
> On Aug 3, 2009, at 6:49 PM, Eric S Fraga wrote:
> 
> > At Mon, 3 Aug 2009 06:36:17 +0200,
> > Carsten Dominik wrote:
> >>
> >
> > [...]
> >
> >> This solution is for Emacs 23 only, but I believe it is more stable,
> >> so I am shipping it now with Org.
> >>
> >> If anyone wants to try before the next release, put
> >>
> >> #+STARTUP: indent
> >>
> >> into a file after pulling the latest git version.
> >
> > I like it!  However, it obviously isn't intended for use for files
> > where only odd level headings are used?
> >
> > In any case, I still have to use Emacs 22 on one computer so cannot
> > switch over (although would like to!).
> 
> Hmmm,
> 
> it would not be hard to make this work under odd-levels conditions.
> However, when you are using odd levels and hidestars for clean view
> under Emacs 22, I would suspect that you are also indenting text
> under the headline by hand.  This will then look bad if you use
> the same file under Emacs 23 with org-indent-mode turned on.
> 
> ?
> 
> - Carsten

Well, I do sometimes indent text but not often so this aspect is fine
with the org-indent-mode.

The odd-levels issue is really a non-issue.  Given the new
org-indent-mode, it's not really needed (if I correctly interpreted
the output I got!) so it would simply be a matter of converting my org
files to odd+even headings.

But I'll wait until I'm fully Emacs 23 before I even think about this!
And that might be a long time as it depends on somebody building Emacs
23 for the Nokia N8x0 tablets.

Thanks,
eric

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

end of thread, other threads:[~2009-08-04 17:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-27 20:04 Automatic indentation of org tree User
2009-07-27 20:47 ` Bastien
2009-07-28  4:25   ` User
2009-07-28 12:05     ` Bastien
2009-07-28 19:32       ` User
2009-07-29  5:41         ` Bastien
2009-08-03  4:36         ` Carsten Dominik
2009-08-03 16:49           ` Eric S Fraga
2009-08-04 15:08             ` Carsten Dominik
2009-08-04 17:49               ` Eric S Fraga

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