emacs-devel
[Top][All Lists]
Advanced

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

Re: highlight-indent-guides in display engine


From: Ergus
Subject: Re: highlight-indent-guides in display engine
Date: Mon, 15 Jul 2019 16:11:07 +0200
User-agent: NeoMutt/20180716

On Mon, Jul 15, 2019 at 08:58:00AM -0400, Stefan Monnier wrote:
But with this minimal support at least there will be something "good
enough" for C and all the derived from cc-mode (Java, C++, Ruby, Perl,
Lua) plus Python, Latex, Makefiles, Bash, Tcl, SQL, Assembly, Rust. So,
many users will be benefited... I think it is still a good deal right?.

Hi Stefan:

First, what I propose is not a general solution for all the cases,
actually it is VERY restrictive, but we don't have anything better and
efficient enough.

Your example is a typical example of indent + align and the emacs align
policy to mix spaces and tabs is actually the worst possible (in my very
modest opinion) I suppose there is an historical reason for it... But I
won't argue about it (there is a recent thread I started about that and
Alan gave a nice workaround (which for me should be like the default
when using tabs)).

In the general situation the indent will be a fix number of spaces >=2
|| a tab. And no lines will start, for example, in the half of the
indentation which in lisp happens very often (for example when there are
two opening parenthesis together).

Your example actually breaks very short lines into pieces, but it will
look like this more or less:

int main ()
{
 sfgasfgasfg(tot(x
 |  |  |  |  |  |+ 3),
 |  |  |  |  |y);
}

But even in this way it is better than nothing and it is not much
different than what most of the other editors do right now. And in
python it is specially useful because a typical error is to mix spaces
with tabs due to opening a file edited somewhere else.

But also there are some people doing the same just setting:

whitespace-style '(face tabs tab-mark trailing)
whitespace-display-mappings     '((tab-mark 9 [?\u2502 9] [?\u2502 9])))

In whitespace mode, because it works and don't kills performance.

In any case, I just made a proposal, any improvement you think works
better is very very welcome.

Thanks for putting some interest on this,
Ergus

I'm not sure I understand the problem that makes it work for those modes
but not for Lisp.

E.g. in C mode by default we get indentation of this form:

   int main ()
     {
       sfgasfgasfg(tot(x
                     + 3),
                 y);
     }

How is this fundamentally different from what happens in Lisp?


       Stefan




reply via email to

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