emacs-devel
[Top][All Lists]
Advanced

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

Re: Supporting tabs for indentation, spaces for alignment


From: Ergus
Subject: Re: Supporting tabs for indentation, spaces for alignment
Date: Fri, 12 Apr 2019 19:00:44 +0200
User-agent: NeoMutt/20180716

On Fri, Apr 12, 2019 at 03:54:42PM +0000, Alan Mackenzie wrote:

Hi again:

Hello, Ergus.

On Thu, Apr 11, 2019 at 12:24:05 +0200, Ergus wrote:

All of what you have just written is far more vague and abstract than
your previous posts.

Getting concrete again, my understanding (please correct me if I am
wrong) of what you are suggesting is: "continuation" CC Mode source
lines should be indented with tabs up to the indent position of the
"main" line, and spaces after that.  For some value of "continuation"
and "main" (see below).

Yes, I have seen only 3 alternatives so far (in my short experience)
which are:

1) The actual emacs default.

2) Add an extra tab to continuation lines and no align with spaces at
all (some projects don't like to mix tabs with spaces, so they prefer
to ignore align)

3) Indent-with-tabs align with spaces.

This might not be all that difficult to implement.  First the
"continuation" CC Mode syntactic symbols (e.g. arglist-cont-nonempty)
will need to be firmly identified, and a list made of them, say
c-continuation-syntactic-symbols.

Ok, there are not too many right? For C++ I only remember
arglist-cont-nonempty, stream-op and template-args-cont.

Then the writer of the CC Mode style will need to set a flag (which
might be called c-limit-indentation-tabs or something like that) to
non-nil in the style.  Also she will need to set indent-tabs-mode to
non-nil.

Could we just add special values to indent-tabs-mode? So t is the
default (like now) and "limit-indentation-tabs" (or similar) will be
this policy? So for other possible future policies we just need to add
other values right? As it is buffer local should not affect other
modes.

At run time, if the main symbol in the syntactic context is a member of
c-continuation-syntactic-symbols, the column number of its anchor
position will be determined.

This is what is not clear to me how to do it right. For example in case
of using templates.

The CC Mode indenting function will not
permit the initial sequence of tabs to extend beyond this anchor
position, replacing such tabs with spaces beyond that point.

So the users could find their needs without writing 40 lisp lines and
read 20 manual pages full of therms that makes sense only after reading
1000 previous pages. Or needing to install an external package that
potentially gets abandon.

I think you're exaggerating just a little bit; it was only 27 lines of
Lisp.  ;-)  But I take the point.  That workaround was only really
suitable for a Lisp hacker.

Yes, maybe a little bit, I am from Latin America so it is normal for
us. We also use to write long emails and talk a lot :P

Have you any views on my above proposed strategy?

If you give me the hints where in the code to implement the changes (As
Eli did for display-fill-column), maybe I can start with a draft
version. It will take a while because am not very lispy :(. But I think
these small features are very important and make the difference.
--
Alan Mackenzie (Nuremberg, Germany).

Very thanks for replying.
Ergus.



reply via email to

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