From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Newsgroups: gmane.emacs.bugs 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 Message-ID: <0fe501d9-ca6f-a115-5813-f51eb0b3b45b@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8599"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: 64792@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 22 18:43:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qNFhP-00022M-1y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jul 2023 18:43:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNFh9-00013i-Fg; Sat, 22 Jul 2023 12:43:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNFh8-00013a-JF for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 12:43:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNFh8-0006We-BS for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 12:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qNFh7-0003fF-VD for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 12:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jul 2023 16:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64792 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.169004412614019 (code B ref -1); Sat, 22 Jul 2023 16:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jul 2023 16:42:06 +0000 Original-Received: from localhost ([127.0.0.1]:37507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNFgD-0003e2-Lm for submit@debbugs.gnu.org; Sat, 22 Jul 2023 12:42:06 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:38284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNFgB-0003dW-QY for submit@debbugs.gnu.org; Sat, 22 Jul 2023 12:42:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNFg6-000102-3l for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 12:41:58 -0400 Original-Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNFg1-0006Qq-PK for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 12:41:57 -0400 Original-Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9926623e367so493315166b.0 for ; Sat, 22 Jul 2023 09:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690044104; x=1690648904; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=EZDlTecR9XYdKhaZsW6uRQRE2WzDFUu/jcZJx+1TPzg=; b=szgODtCaU4aYhUY0ErusrcsHszDCvM0BtRDe59L4Ny9GKiVDlkTDXxYo1040ymbE+C mMLPwsSzouofL5IPU8NfM6+bYmB70+xO5mLx9vBObEGD8Vx5TdHFlnS+9cevBzFLkjlX /hFlMxOOgxZSxLrjWF9Fm9nkwrC+f0klNRDL6Aqla7IdJ0SXQRcaSCU5vIS28iVjMvHZ Kp5uybkAR5g7N/6/i3BBXSAmW6Wpneit6LJPhChxCkHCmIePOXMgpaQ06hjp8YWstlA0 QJ3OM+9Q4KcVigcL7GEvOvKRqNko/+wLOAMlAS0BJiJYODpzsZpKRaya+Cjr4dPX2tv7 SACw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690044104; x=1690648904; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=EZDlTecR9XYdKhaZsW6uRQRE2WzDFUu/jcZJx+1TPzg=; b=chMVeK374bQbRpRI1TLzxHiznAMce+HuV/bkYOmZHB3P14wYQTXrWvc9vDL72Lic6C fQyU6FPdq6a9K9QztaBxjBC3KGSr9/rxQVg0wigltp7F1xJ8pPa6JBOGSjoLrBq6cWYp FIhTpfJFKqCgFcRzloFRwJRdiAPqhPcacgal5VSWojDiVLDRSuD0VFJYVRWHLL0+Rpcb JCP7ONnDU7x2CSPDqOiP1Nm0ixG6qDIJmvfNOlgxLudkant1w8GWRHr4pQeoxFtMxeIJ E/zdxqyPZE+1gqz5G/S0PQRA0RTha/Z5FVhDvMLwjbiAYCDxJysQOFtDw+wanLUDHUOl 5xKg== X-Gm-Message-State: ABy/qLaQK3X2zhc07WzU2CrVrDBojoxNhqUbm2DT4HTh8N0zz4q3TT1r gjQLQpzK8sQX5WU0SHknAuvBcpU9UddSaw== X-Google-Smtp-Source: APBJJlEpX2AOv6PAONlScXpophP45kB3gcoLzkWZcN4YSZIXr+MnikfV9dGnPstrcKNzjfddqHU8Fg== X-Received: by 2002:a17:906:748c:b0:973:ff8d:2a46 with SMTP id e12-20020a170906748c00b00973ff8d2a46mr4854900ejl.3.1690044104103; Sat, 22 Jul 2023 09:41:44 -0700 (PDT) Original-Received: from [192.168.178.20] ([195.48.35.61]) by smtp.gmail.com with ESMTPSA id l23-20020a1709065a9700b00997e00e78e6sm3744085ejq.112.2023.07.22.09.41.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Jul 2023 09:41:43 -0700 (PDT) Content-Language: fr, en-US Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=cpitclaudel@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265832 Archived-At: 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.