unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <Stephen.Berman@gmx.net>
To: emacs-devel@gnu.org
Subject: Re: Feature proposal/request: Indentation driven by display engine
Date: Sun, 25 May 2008 01:02:53 +0200	[thread overview]
Message-ID: <8763t3e25e.fsf@escher.local.home> (raw)
In-Reply-To: 608B9795-0975-4472-89B0-CA78575496E4@gmail.com

On Sat, 24 May 2008 14:15:59 +0200 Carsten Dominik <carsten.dominik@gmail.com> wrote:

> Hi,
>
> I have a proposal to make:
>
> Recently, I have experimented with an idea, to create
> indentation on the Emacs display.
>
> For example, in an outline structure
>
> * level 1
> text under level 1
> ** Level 2
> text under level 1
>
>
> I would like to display this as:
>
> * level 1
>   text under level 1
> ** Level 2
>    text under level 1
>
> without actually inserting white space at the beginning of
> each line.  So effectively I would like to shift the location
> of the left margin on a per-line basis.
>
> 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.

This sounds reminiscent of a bug I reported a while ago; see
<http://permalink.gmane.org/gmane.emacs.devel/86019>.  

> 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.
>
> 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.
>
> Would that be something useful to add?  Anyone who would
> volunteer to implement this, because I frankly have no
> idea how the display engine works internally.
>
> Or are there other comments, for example how this dynamic
> indentation could be implemented in a different way?

I've attempted to develop a version of longlines-mode that implements
the same sort of left margin shifting you mention, also by means of a
similar display property (I use " \n" concatented with a customizable
string).  It works fairly well (also with adaptive filling, which does
not work with current longlines-mode) but among other problems suffers
from the display bug I referred to in the above URL, which sounds like
what you are also seeing.  In an earlier version I tried using
before-string overlays and also ran into scalability problems.  I don't
know if a before-string property would solve all issues, but it would be
nice to have the possibility.

Steve Berman





      parent reply	other threads:[~2008-05-24 23:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-24 12:15 Feature proposal/request: Indentation driven by display engine Carsten Dominik
2008-05-24 18:48 ` Stefan Monnier
2008-05-24 20:22   ` Carsten Dominik
2008-05-26 21:02     ` Stefan Monnier
2008-05-27  8:24       ` Carsten Dominik
2008-05-24 23:02 ` Stephen Berman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8763t3e25e.fsf@escher.local.home \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).