emacs-devel
[Top][All Lists]
Advanced

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

Re: Feature proposal/request: Indentation driven by display engine


From: Carsten Dominik
Subject: Re: Feature proposal/request: Indentation driven by display engine
Date: Sat, 24 May 2008 22:22:46 +0200

Hi Stefan, thanks for your reply.

On May 24, 2008, at 8:48 PM, Stefan Monnier wrote:

I have been trying to implement this using display properties
on each newline characters, displaying "\n   " instead of
just "\n".  This basically works, but it interacts badly
with outlining:  If I fold the text below a headline, the
first indentation is still displayed.

Can't you remove the display property when you fold to avoid the problem?

I could, but then I would have to add and remove text properties during
each fold/unfold, quite some unnecessary overhead.

The next thing I tried was using overlays over each "\n",
with an after-string property carrying the indentations.
This works correctly with outline, but when I add thousands
of overlays to a buffer this becomes slow and redisplay and
editing become sluggish, probably because to the huge
amount of markers in the buffer.

Yes, we need to improve the implementation of markers to eliminate the
O(N) complexity.  Ideally, there'd be some clever way to store the
markers directly inside the text-properties tree.

Yes, it would certainly be nice to get rid of this old problem.



It then occurred to me that it might be useful to support
such a feature directly in the display engine.
For example, if the line contains text with an `indentation'
property, the display engine would add this amount of white
space to before the beginning of the line, maybe also a vertical
line indicating the location of the margin.

This property would still need to be added to every line. So basically
all you're asking is a "before-string" text-property, maybe?

Hmm, nice translation of my request.  Yes, basically what I am
asking for is a working before-string text property.  I know
that adding the property sounds like a lot of effort, but I could
use the font-lock/jit-lock setup to get this done efficiently,
only for the pieces that actually get displayed.

Or are there other comments, for example how this dynamic
indentation could be implemented in a different way?

How 'bout modifying the actual buffer text directly?

Yes, this is in fact what I am doing now, I use TAB, and
wrapping/paragraph-fill support to get fill prefixes.  I also modify
indentation during promotion and demotion of entries.

However, there are some disadvantages to this.  One obvious one is
this:  Org contains a publishing part, and for publishing
we allow examples like code snippets, where indentation might be
important.  So the

#+BEGIN_EXAMPLE

#+END_EXAMPLE

construct should be flush to the left margin.

Are we going to get a before-string property?  WOuld be cool.

- Carsten
















       Stefan





reply via email to

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