From: Ergus <spacibba@aol.com>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Supporting tabs for indentation, spaces for alignment
Date: Sat, 13 Apr 2019 17:56:09 +0200 [thread overview]
Message-ID: <87d0lp9a4k.fsf@Ergus.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <20190413135446.GD13636@ACM>
On Sat, Apr 13, 2019 at 01:54:46PM +0000, Alan Mackenzie wrote:
>Hello, Davis.
>
>On Fri, Apr 12, 2019 at 16:39:16 +0000, Herring, Davis wrote:
>> [Sent off-list because I don't know whether my DMARC issues have been
>> addressed. Feel free to share it there if you'd like to make a public
>> reply.]
>
>I'm doing this. I believe these mail issues, as they interact with
>mailing lists, are a Hard Problem. I'm not sure how much progress has
>been made on this by the admins, but they certainly haven't been
>disregarding the problem.
>
>> > 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).
>
>> I'm not saying your description in terms of CC Mode internals was
>> incorrect, but I'd like to provide an implementation-independent
>> description that can be easily verified. (Also, in case it hasn't
>> been posted recently, the Emacs Wiki discusses this idea in some depth
>> <https://www.emacswiki.org/emacs/SmartTabs>.)
>
>Thanks, I've read that. I've also downloaded the pertinent Elisp file.
>I'm not quite sure how smart-tabs-mode works, yet, so I'm also not sure
>what a secific CC Mode implementation could add.
>
>> The definition of "continuation" is simply that tabs are used whenever
>> the user chooses the width of indentation and spaces are used whenever
>> the editor chooses it (by comparing column positions in the text).
>
>So, roughly speaking, if a CC Mode "offset" is + or ++, then tabs would
>be appropriate, otherwise spaces.
>
>> There is a tacit assumption here that the amounts of indentation
>> chosen by the user are expressed in units of tabs. Conveniently, CC
>> Mode already defines indentation in terms of levels, so this just
>> means that a level equals a tab--i.e., that c-basic-offset and
>> tab-width are not independent. It probably makes sense to, when this
>> style is engaged, (setq tab-width c-basic-offset) after computing the
>> latter from whatever other style information since it is more specific
>> than any global setting of tab-width.
>
>Yes. I'll work out the precise details.
>
>But I'm now wondering why I should want to write a CC Mode specific
>implementation.
>
>> Hope this helps,
>
>Very much so, thanks!
>
>> Davis
>
>--
>Alan Mackenzie (Nuremberg, Germany).
>
I agree that a general implementation could be a better approach,
because other modes could take advantage of it. At least the basic
infrastructure. But also because different modes will need to support
different customizable variants of this in the future and every mode
shouldn't reinvent the well ever time.
Nevertheless CC-mode will require a specific implementation any way
because there is more complexity with syntax analysis, but also because
most of the programming languages that exposes this issue needs cc-mode
in emacs.
Maybe we should first agree about what is the basic functionality that
needs to be added in the emacs core and then we could consider
specializations for cc-mode if they are needed (pretty sure they'll do).
I don't know if the other modes in emacs are implemented like cc-mode,
but the approach you mentioned yesterday is something that maybe fits
for most of them. So a basic infraestructure for the "continuation array"
may be language/mode independent.
Languages like python or julia where mixing tabs with spaced is
dangerous; probably need to assert to use only spaces or tabs (pep 8
recommends spaces only and it is kind of standard now... similar happens
in Fortran, most compilers support to use tabs, but not all). Pascal on
the other hand uses tabs, but the tab-width is usually 3 or 4. So, at
the end, every prog-mode will need a sort of specialization.
prev parent reply other threads:[~2019-04-13 15:56 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
2019-04-12 17:00 ` Ergus
[not found] ` <b483d42ddde945b3a479800566aa257c@lanl.gov>
2019-04-13 13:54 ` Alan Mackenzie
2019-04-13 15:56 ` Ergus [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=87d0lp9a4k.fsf@Ergus.i-did-not-set--mail-host-address--so-tickle-me \
--to=spacibba@aol.com \
--cc=acm@muc.de \
--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).