unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Ergus <spacibba@aol.com>
Cc: emacs-devel@gnu.org
Subject: Re: Supporting tabs for indentation, spaces for alignment
Date: Fri, 12 Apr 2019 15:54:42 +0000	[thread overview]
Message-ID: <20190412155442.GD4588@ACM> (raw)
In-Reply-To: <20190411102405.vcwdygrz36cjt3ld@Ergus>

Hello, Ergus.

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

> Very thanks for replying. I will try to implement your solution for now
> in my config.

> But I'm wondering if after 11 years, with much better machines, improved
> emacs with many new functionalities (most of them nothing to do with a
> text editor) and the constant growing of languages that uses cc-mode as
> a base (rust || C++>=11 for example).

> But also with new indentation styles (like the google's one which is
> by far the most popular package in melpa). 

> And this package which seems to work; so some experience already:

> https://github.com/jcsalomon/smarttabs

> And the increase in popularity of other editors/ides which use different
> policies (from vim, kdevelop, eclipse, notepad++, visual-studio-code);
> so a emacs user (like me) needs to attach and don't break the global
> project schema. Maybe it makes sense to think how to add other
> tab-indent-policies and styles in the c-indent-alist list. Even if they
> are not the defaults.

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).

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.

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.

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.  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.

Have you any views on my above proposed strategy?

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2019-04-12 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  9:02 Supporting tabs for indentation, spaces for alignment Alan Mackenzie
2019-04-11 10:24 ` Ergus
2019-04-11 13:29   ` Eli Zaretskii
2019-04-11 14:43     ` Ergus
2019-04-12 15:54   ` Alan Mackenzie [this message]
2019-04-12 17:00     ` Ergus
     [not found]     ` <b483d42ddde945b3a479800566aa257c@lanl.gov>
2019-04-13 13:54       ` Alan Mackenzie
2019-04-13 15:56         ` Ergus

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=20190412155442.GD4588@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.com \
    /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).