all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: 64792@debbugs.gnu.org
Subject: bug#64792: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting
Date: Sat, 22 Jul 2023 18:41:42 +0200	[thread overview]
Message-ID: <0fe501d9-ca6f-a115-5813-f51eb0b3b45b@gmail.com> (raw)

Hi all,

The following code prints "Hello," and "world!" in JavaScript:

//
console.debug("Hello,");
//
console.debug("world!");

There is a LINE SEPARATOR after the first //, and a PARAGRAPH SEPARATOR after the second //.  Both of these are valid line terminators in ECMAScript (https://262.ecma-international.org/10.0/#table-33), but since js-mode does not recognize them, it displays the whole buffer in comment face (the only indication that something fishy is going on is a thin box around each character).

Other editors handle this in various ways.  gedit treats LS and PS as line breaks, but still displays the first call to console.debug in comment face.  vscode displays both LS and PS as question marks but warns about them and highlights the code correctly.

Is there an easy way to make Emacs treat LS and PS as newlines in js-mode?  Ideally it would display the calls to console.debug on their own separate lines, like this:

//[LS]
console.debug("Hello,");
//[PS]
console.debug("world!");

… but it would already be nice to fix the syntax highlighting to not use the comment font.  For that these characters could be marked as comment enders.  There may be additional work to do to check uses of \n of "^" and "$" in regular expressions, too.

Clément.





             reply	other threads:[~2023-07-22 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 16:41 Clément Pit-Claudel [this message]
2023-07-22 16:52 ` bug#64792: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fe501d9-ca6f-a115-5813-f51eb0b3b45b@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=64792@debbugs.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.