From unknown Wed Jun 18 00:24:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#64792 <64792@debbugs.gnu.org> To: bug#64792 <64792@debbugs.gnu.org> Subject: Status: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting Reply-To: bug#64792 <64792@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:24:26 +0000 retitle 64792 js-mode doesn't recognize LS and PS line endings, leading to = incorrect syntax highlighting reassign 64792 emacs submitter 64792 Cl=C3=A9ment Pit-Claudel severity 64792 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 12:42:06 2023 Received: (at submit) by debbugs.gnu.org; 22 Jul 2023 16:42:06 +0000 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 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 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 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 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) 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) Message-ID: <0fe501d9-ca6f-a115-5813-f51eb0b3b45b@gmail.com> Date: Sat, 22 Jul 2023 18:41:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: fr, en-US To: bug-gnu-emacs From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Subject: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 12:52:10 2023 Received: (at 64792) by debbugs.gnu.org; 22 Jul 2023 16:52:10 +0000 Received: from localhost ([127.0.0.1]:37517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNFpy-0003xs-Em for submit@debbugs.gnu.org; Sat, 22 Jul 2023 12:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNFpw-0003xf-Q0 for 64792@debbugs.gnu.org; Sat, 22 Jul 2023 12:52:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNFpq-00027L-2w; Sat, 22 Jul 2023 12:52:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=qr9lpy6FPTxIzvl0t2w00sanlQbr6Eh/aLS0EJTkCLs=; b=ZbHU8LQhSLXvB0MZJ5MC i3SAp57Ca9Ko5FkA9b/sIyPW8LSYFe+s+ZpqE3ppWv5Dy5IJ5hTtHXNFlZYJ1+UkGF3DxKR/J3YTP saHfCSDMRYyGGE3e20io7wnLeNWS8+T/RhcRz9Y9LlN4qr/K/VcBT9jOYeSMPe8UN1JAbgRJORX60 odz02m4hLdzMGEGdXR0GFt+YfqDQTcaEcHeRLC0FMLTroIHvluIcPkgv9vVtqmblaTPCLMaigR07m ccpdVmRR+W5Z0qarLAa1nq+5KUhCEdO3Zc9/xmCaduEMUoSkfbjFN6pSE0JfdfbYjgOnDgtFhZDWh S4kVFCNfeH30Vg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNFpp-0000XA-Id; Sat, 22 Jul 2023 12:52:01 -0400 Date: Sat, 22 Jul 2023 19:52:40 +0300 Message-Id: <83y1j77usn.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel In-Reply-To: <0fe501d9-ca6f-a115-5813-f51eb0b3b45b@gmail.com> (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Sat, 22 Jul 2023 18:41:42 +0200) Subject: Re: bug#64792: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting References: <0fe501d9-ca6f-a115-5813-f51eb0b3b45b@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64792 Cc: 64792@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 22 Jul 2023 18:41:42 +0200 > From: Clément Pit-Claudel > > 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!"); This can be accomplished via the display-table, but I doubt that it would satisfy you. > … 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. AFAIU, this requires either changes to the font-lock regexps or low-level change to regex-emacs.c such that it considers these two separator characters as equivalents of a newline. (If you ask me, Unicode made a heck of a mess by introducing these characters, witness the problems editors out there have to this day with handling them.)