unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Rasmus Villemoes via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Alan Mackenzie <acm@muc.de>, Eli Zaretskii <eliz@gnu.org>
Cc: 67173@debbugs.gnu.org
Subject: bug#67173: 27.1; support raw string literals in C mode (a GNU C extension)
Date: Thu, 16 Nov 2023 09:25:58 +0100	[thread overview]
Message-ID: <f57309a1-437b-4876-9577-2fe269a626e7@prevas.dk> (raw)
In-Reply-To: <ZVVE08ou8mW89b-4@ACM>

On 15/11/2023 23.23, Alan Mackenzie wrote:
> Hello, Eli and Rasmus.
> 
> On Wed, Nov 15, 2023 at 15:03:39 +0200, Eli Zaretskii wrote:
>>> Date: Tue, 14 Nov 2023 11:30:53 +0100
>>> From:  Rasmus Villemoes via "Bug reports for GNU Emacs,
>>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
>>> gcc, when using -std=gnu99 or newer, supports using raw string literals
>>> in C code. But emacs' C mode does not do proper syntax highlighting for
>>> that case.
> 
> Thanks!  I didn't know about that.  I can't find any mention of raw
> strings in C in the GCC manual for version 10.3.0.

No, it's not mentioned anywhere, and I don't know why they don't
document it, but it's most definitely deliberate (see the
lang_defaults[] table in libcpp/init.cc).

>>> I do not know if that can be fixed by simply adding
>>> c-before-change-check-raw-strings to C mode's
>>> c-get-state-before-change-functions.
> 
> That's the basic idea, yes, with another function to be added to
> c-before-font-lock-functions.  But there are several detailed changes
> necessary, too.

That explains why my quick hacking didn't work...

>> Alan, are you looking into this?
> 
> I am now.  What's bothering me at the moment is that this is going to
> make C Mode slower.  

Urgh, I didn't think about that. I agree that it's probably not very
widely used (probably partly due to not being documented...). I myself
only use it very rarely, and for now just use C++ mode for the file in
question where I noticed this.

So if "slower" is actually noticeable, I would probably prefer to
retract this bug report or ask that support becomes some explicit
opt-in, because 99.99% of the .c files I touch do not use raw strings.

Regardless, thanks for taking this up so quickly.

Rasmus






      parent reply	other threads:[~2023-11-16  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 10:30 bug#67173: 27.1; support raw string literals in C mode (a GNU C extension) Rasmus Villemoes via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-15 13:03 ` Eli Zaretskii
2023-11-15 22:23   ` Alan Mackenzie
2023-11-16  5:57     ` Eli Zaretskii
2023-11-16  8:25     ` Rasmus Villemoes via Bug reports for GNU Emacs, the Swiss army knife of text editors [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=f57309a1-437b-4876-9577-2fe269a626e7@prevas.dk \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67173@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=ravi@prevas.dk \
    /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).