emacs-devel
[Top][All Lists]
Advanced

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

Re: Variable-width font indentation


From: Eli Zaretskii
Subject: Re: Variable-width font indentation
Date: Tue, 06 Mar 2018 18:36:25 +0200

> From: Clément Pit-Claudel <address@hidden>
> Date: Mon, 5 Mar 2018 20:40:14 -0500
> 
> The following code gives a preview of what the algorithm that we've been 
> discussing produces:

Thanks, but I still don't see why we couldn't simply "adjust" the
width of white space using the 'space' display property.

Your implementation has a few issues.  First, if you move the cursor
vertically at column zero, do you see "ghost" characters displayed at
cursor position?  Hiding characters by displaying them with foreground
color identical to the background color has its limits ;-)

Also, with this implementation, the braces in the 'if' and 'else'
blocks no longer align.  E.g., try to indent this snippet:

foo ()
{
  if (something)
    {
      do (anything);
    }
  else
    {
      do (something-else);
    }
}

I think this misalignment will be annoying.

> I do agree that it doesn't look too bad, and presumably a C implementation of 
> the algorithm above would be very fast, since it could build the "spine" 
> above during redisplay.

Indenting during redisplay is a bad idea, because it will disable
almost every redisplay optimization.

I actually don't understand why you worry about performance: the
function you wrote is the morel equivalent of C-\, and that one is not
fast with the current implementation.  We never modify indentation of
non-current lines anyway, we expect the user to type TAB or some
electric character to reindent a line, and we expect them to use C-\
to reindent more than one line.  Automatic adjustment of indentation
might be a good feature, but it would be a separate feature.

In any case, I'd suggest to reindent via buffer-modification hooks,
not as part of redisplay.



reply via email to

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