unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Some performance questions.
Date: Thu, 9 Feb 2023 16:45:02 +0100	[thread overview]
Message-ID: <20230209154502.li4r26vxpfkjtshe@Ergus> (raw)
In-Reply-To: <831qmzlzna.fsf@gnu.org>

Hi Eli:

On Thu, Feb 09, 2023 at 03:46:49PM +0200, Eli Zaretskii wrote:
>> Date: Thu, 9 Feb 2023 12:49:28 +0100
>> From: Ergus <spacibba@aol.com>
>>
>> 1) The new c-ts-mode-indent-style is a bit confusing for a cc-mode
>> user...,
>
>That is strange, since it's supposed to support (a subset of) the same
>styles that CC mode support, including the default GNU style.
>
Yes, but in cc-mode it was possible (and pretty simple) to modify or
create new styles. There are plenty of styles around modifying existing
ones (google-c-style for example).

In the new ts-mode looks like it is possible to do so, but the syntax
and the names are a bit tricky. For example in cc-mode there was the
c-set-offset command, very useful for small changes and to know which
indentation syntactic element was at point. So with that information the
user only needs:

(c-offsets-alist (inline-open . 0)
		 (arglist-close . 0)
		 (innamespace . [0])
		 (access-label '-)
		 )

to increase, decrease or set the indentation to zero.

That's why just some equivalences or examples may be very helpful to
ease the transition.

>> could you add some similar/equivalent examples than the ones in the
>> cc-mode documentation in order to extrapolate/translate?
>>
>>   OR
>>
>> Is it possible to use add examples of equivalent implementations between
>> c-offsets-alist and c-ts-mode-indent-style.
>
>This is supposed to work via indentation styles, see below.
>
The idea is to modify one of the existing styles or create new ones. Se
above

>> 2) In case the user wants to modify an indentation style, is it possible
>> to use another existing style and use it as base template like
>> c-add-style does?
>
>See c-ts-mode-set-style (bound to "C-c .", as in CC mode) and
>c-ts-mode-set-global-style.
>
I mean, tweak details... like the inheritance we do in c-add-style, not
set a completely different one.

(c-add-style "mylinux"
	       '("linux"              <-
		 (tab-width . 4)
		 (c-basic-offset . 4)
                  (fill-column . 80)
                  ...

>> 3) Which of the cc-hooks (c-hanging-braces-alist, c-cleanup-list and
>> c-hanging-semi&comma-criteria) is already possible to reproduce with ts?
>> some example please :(
>
>Please describe the behavior you want to see and didn't see in
>c-ts-mode, the CC mode variables are not used in c-ts-mode.
>
I know they are not. I asked for some kind of equivalence (if available)
because I don't know if they were already implemented somehow.

c-hanging-braces-alist: Controls the insertion of newlines before and after braces

c-cleanup-list: Basically for the opposite, to remove some auto inserted
new lines next to braces (for example to have things like '} else {' or
'{}')

c-hanging-semi&comma-criteria For a similar behavior but with
semi-colons and other cases.

>> 4) Is it possible already (I am sure that in the future they will), to
>> create behaviors like c-lineup-arglist,
>> c-lineup-arglist-intro-after-paren, or c-snug-do-while?
>
>Again, please request features.  I'm not sure I even know what these
>do.

Thanks. I will do, but there are multiple things and I don't want to be
too (even more) pedantic, so I one by one...

Best,
Ergus




      reply	other threads:[~2023-02-09 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230208190819.z7xwgxm5gpbzmjrz.ref@Ergus>
2023-02-08 19:08 ` Some performance questions Ergus
2023-02-08 20:09   ` Eli Zaretskii
2023-02-08 20:15     ` Eli Zaretskii
2023-02-08 20:56       ` Ergus
2023-02-09  6:17         ` Eli Zaretskii
2023-02-09 13:14           ` Ergus
     [not found]           ` <20230209114928.eqpojruluur42hur@Ergus>
2023-02-09 13:46             ` Eli Zaretskii
2023-02-09 15:45               ` 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=20230209154502.li4r26vxpfkjtshe@Ergus \
    --to=spacibba@aol.com \
    --cc=eliz@gnu.org \
    --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).