unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: btuin@mailo.com, 66152@debbugs.gnu.org
Subject: bug#66152: 30.0.50; Missing indent rules in c-ts-mode
Date: Sun, 10 Dec 2023 18:16:49 -0800	[thread overview]
Message-ID: <e2a4d081-4fc5-42b5-83d1-04b2520a1b5e@gmail.com> (raw)
In-Reply-To: <83lech4jz6.fsf@gnu.org>



On 10/5/23 12:16 AM, Eli Zaretskii wrote:
> Ping!  Yuan, I would really like to use the first patch in Emacs 29.2,
> if it looks OK to you.
>
>> Cc: 66152@debbugs.gnu.org
>> Date: Fri, 29 Sep 2023 10:17:29 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>>
>>> Date: Tue, 26 Sep 2023 14:29:07 +0200
>>> From: Augustin Chéneau (BTuin) <btuin@mailo.com>
>>>
>>> I found some more issues.
>>>
>>> First, there is no rule for an element in an else clause:
>>>
>>>
>>> if (true)
>>>     do_something();
>>> else
>>> do_something_else();
>>>
>>>
>>> "do_something_else" is not indented.
>>>
>>> There is also something weird with the bsd indent style.  It indents
>>> do_something and do_something_else to parent-bol with 0 offset, so the
>>> result is:
>>>
>>> if (true)
>>> do_something();
>>> else
>>> do_something_else();
>>>
>>>
>>> It is very different from the bsd style from c-mode, which produces this:
>>>
>>> if (true)
>>> 	do_something();
>>> else
>>> 	do_something_else();
>>>
>>> By looking at random files from OpenBSD, they do indent their
>>> expressions inside if and else:
>>>
>>> <https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/net/bsd-comp.c?rev=1.17&content-type=text/plain>
>>> (lines 277, 484, and 527)
>>>
>>>
>>>
>>> Also there is a second patch which tries to handle specific types of
>>> comments.  I don't know how popular it is, but some people use these
>>> kind of comments:
>>>
>>> /*---------.
>>> | %param.  |
>>> `---------*/
>>>
>>> Here we want the vertical bar ("|") to be indented at the same column as
>>> the first "/".
>>>
>>> Currently the result is this:
>>>
>>> /*---------.
>>>     | %param.  |
>>>     `---------*/
>>>
>>> This patch is a just proof of concept.  If this new behavior is indeed
>>> wanted, I would clean it up and adapt other modes.
>> Yuan, any comments?  If the first patch looks good to you, I'd like to
>> install it on the release branch.
LGTM, I applied the first patch to emacs-29.

Yuan





  reply	other threads:[~2023-12-11  2:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 11:23 bug#66152: 30.0.50; Missing indent rules in c-ts-mode Augustin Chéneau
2023-09-26 12:29 ` Augustin Chéneau
2023-09-29  7:17   ` Eli Zaretskii
2023-10-05  7:16     ` Eli Zaretskii
2023-12-11  2:16       ` Yuan Fu [this message]
2024-01-10 21:31         ` Stefan Kangas
2024-01-11  6:24           ` Eli Zaretskii
2024-01-13  7:07             ` Yuan Fu
2024-01-14  5:33               ` Stefan Kangas
2024-01-14  7:09                 ` Eli Zaretskii
2024-01-14 10:21                 ` Augustin Chéneau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-11  2:41   ` Yuan Fu

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=e2a4d081-4fc5-42b5-83d1-04b2520a1b5e@gmail.com \
    --to=casouri@gmail.com \
    --cc=66152@debbugs.gnu.org \
    --cc=btuin@mailo.com \
    --cc=eliz@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).