From unknown Sun Aug 17 09:09:00 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#78117 <78117@debbugs.gnu.org> To: bug#78117 <78117@debbugs.gnu.org> Subject: Status: Improve c-ts-mode--c-or-c++-regexp Reply-To: bug#78117 <78117@debbugs.gnu.org> Date: Sun, 17 Aug 2025 16:09:00 +0000 retitle 78117 Improve c-ts-mode--c-or-c++-regexp reassign 78117 emacs submitter 78117 Sergey Abdulov severity 78117 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 28 10:16:31 2025 Received: (at submit) by debbugs.gnu.org; 28 Apr 2025 14:16:31 +0000 Received: from localhost ([127.0.0.1]:58334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9PHa-0004P6-3l for submit@debbugs.gnu.org; Mon, 28 Apr 2025 10:16:30 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60204) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9HkZ-0006ne-ES for submit@debbugs.gnu.org; Mon, 28 Apr 2025 02:13:57 -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 1u9HkQ-0006QX-V3 for bug-gnu-emacs@gnu.org; Mon, 28 Apr 2025 02:13:46 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u9HkP-0002zs-73 for bug-gnu-emacs@gnu.org; Mon, 28 Apr 2025 02:13:46 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-2d54b936ad9so2099988fac.1 for ; Sun, 27 Apr 2025 23:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745820823; x=1746425623; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=4PVkns3SJOz1TpXGFLyeWO4x/unStXI59M5Suxt7vPg=; b=J+DE/PMkMS4bdOa+rzVQTnHl6pIFoJK6C1AFofVcyc/1UEhHq6oG0f4YO9vHaVLGKC 2+Wyz/FfLPRvLuLQpByWFnEk0cPLgDwttXYFJanMatP2hUKZOzi/vYqR96BQudr5oJBm VoId+aS9H4Xjk1541bt5h9WBTfKP53T0v7CZDOCw7GmhWDKZNjFco9LbiXHJ4rU0TyKI H8+anbICEa8a0dHkjoJaN79CjzzyrdtYUQRtazKd1ZlMsEDATnxe5KLE1xioT1Ssq61x mK7HrJ53DHPgPGATvnBHg6nE1d4+osrzmzXDpht8ygY5+HdY1vMemvgC4O/fFUvLRm/f 182A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745820823; x=1746425623; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4PVkns3SJOz1TpXGFLyeWO4x/unStXI59M5Suxt7vPg=; b=EBEn/Ebuu+WFG2eb3NL9rj1W8OVKqf4hsynW2db2wkea7mIse2wXK3c2qo8HPutHHI Z/hFtzWnAKkjzHYCQ8KCdc2aejD5vul8YR/9qz3IE1Db1lAQKWJ5BOh9YGKrHKP+E6mM YHItihgbXygua7aK92txXH2j6iJQBmmaZzgLd7oUMC6GPQa4zp0xVhp5EqyjoSq2fPY0 d9ZK/e5AY0wfictnXg4J5I+O8veXM8jtiN6KtlIyfV+9YKcRUfj+gHKKkQ7SeCIBs+2r yBOlU28ocEjHvKbKo4aehLGhBF8SYXNpoQtToSHe8wgMW7tXZYvWRIywc7zSdHczbAbM TuFQ== X-Gm-Message-State: AOJu0YxY23MhC5ugzBsQc3MbjIzxPD5YAFJ/l2tm4284kUxz3GOde62n N+ExKfEp0xK8Ab3IM5pChq5ZVEON9CXUr42u3Y1TH6wsscXdolYufT2Y+iIVyO4mBgotxqV2XhE aMD4+l+AgEKBpWPKBv23ioia+J0H9f6Ucj4CndrCdyZk= X-Gm-Gg: ASbGncsJ6V6edKzYM9VTWl0dhpso7bU3il8yQHp3HQSKCADJ1NgY/jUZUEmuYQ7wSDj /KH83M9lRjmSXJAOJM6mfrydfubTlxiEn1Ugi7nVGqrnzWJ8tpuHMNCiUPvHTe0SoEv0lBB6E52 20nlNB6MELAIEzYBqdPPnLyA== X-Google-Smtp-Source: AGHT+IFvSvkSn/cWP+R5Jl9BWgX3/t+mRlw3DpI34ftL2c9D027cWcpmbkU/O3hCt0p1qkKehuorW5O1Iaorj8NBHcY= X-Received: by 2002:a05:6870:1647:b0:2d5:d5c:a851 with SMTP id 586e51a60fabf-2d99d74a845mr6110966fac.6.1745820822515; Sun, 27 Apr 2025 23:13:42 -0700 (PDT) MIME-Version: 1.0 From: Sergey Abdulov Date: Mon, 28 Apr 2025 11:13:31 +0500 X-Gm-Features: ATxdqUH5ncwYTgwkKsyhARYhSMhbNg-1gxR-B6tTp_HMQOWXewz6T9wtphbOEQs Message-ID: Subject: Improve c-ts-mode--c-or-c++-regexp To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2001:4860:4864:20::29; envelope-from=tidesmain@gmail.com; helo=mail-oa1-x29.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 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.7 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello! I ran into a header that uses C++ features but still opens in c-ts-mode. Link: https://raw.githubusercontent.com/HandmadeMath/HandmadeMath/refs/heads/master/HandmadeMath.h Therefore I suggest either: [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.1 URIBL_SBL_A Contains URL's A record listed in the Spamhaus SBL blocklist [URIs: raw.githubusercontent.com] 0.6 URIBL_SBL Contains an URL's NS IP listed in the Spamhaus SBL blocklist [URIs: raw.githubusercontent.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tidesmain[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 28 Apr 2025 10:16:26 -0400 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.7 (/) Hello! I ran into a header that uses C++ features but still opens in c-ts-mode. Link: https://raw.githubusercontent.com/HandmadeMath/HandmadeMath/refs/heads/master/HandmadeMath.h Therefore I suggest either: 1) Treat any mention of `__cplusplus` macro as a C++ file 2) Or add an `operatorX` pattern where X is one of the C++ operators (don't forget <=> etc) For now I'm enabling c++-ts-mode manually whenever I edit said header but it's still bad since some of the broken highlighting from c-ts-mode persists into c++-ts-mode after toggling and gets fixed after moving the cursor through affected areas. That's another bug though. Thanks! From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 28 11:53:34 2025 Received: (at 78117) by debbugs.gnu.org; 28 Apr 2025 15:53:34 +0000 Received: from localhost ([127.0.0.1]:60374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9QnV-0006of-K3 for submit@debbugs.gnu.org; Mon, 28 Apr 2025 11:53:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39296) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9QnO-0006n4-PD for 78117@debbugs.gnu.org; Mon, 28 Apr 2025 11:53:30 -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 1u9QnJ-0004nZ-77; Mon, 28 Apr 2025 11:53:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5BCn9eFjf0DyrERsN41q8hI+s20Iy2nUKzUiaNoE4pg=; b=gLCspLs2GjCT 2OfyBjOwqbqcQXHKeDMmolAfYyZ3JmbYtuCdfGDw5MMqCVLhcm/12FhWdqEc2s4czAT1ve8FH3TJz y2gGVsTtHF2ohh+i+8CZvX5NgkEzrGf38nSt7smkeybgEnHNkyyJRaLS/f2daaneQq5Jyi2t+yn8Q RtXFb+VUQ0dF6Mzj8killSO1X3AMJKUTAUklxOa5rTH3TFAgktF0knfBA0x/7BSsQWyJolSwGGIoE P1qyIQh481jA8C6icJqvx9t7pwiTnvaSCSPY3iXjoe4NSoDn7+AW6rnd1uBfJRTmKXgkjuCUWJSkV oVwS1g9N8L+CO19YEIamuw==; Date: Mon, 28 Apr 2025 18:52:40 +0300 Message-Id: <867c34qo53.fsf@gnu.org> From: Eli Zaretskii To: Sergey Abdulov In-Reply-To: (message from Sergey Abdulov on Mon, 28 Apr 2025 11:13:31 +0500) Subject: Re: bug#78117: Improve c-ts-mode--c-or-c++-regexp References: X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 78117 Cc: 78117@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: -2.6 (--) > From: Sergey Abdulov > Date: Mon, 28 Apr 2025 11:13:31 +0500 > > Hello! > > I ran into a header that uses C++ features but still opens in c-ts-mode. > Link: https://raw.githubusercontent.com/HandmadeMath/HandmadeMath/refs/heads/master/HandmadeMath.h > Therefore I suggest either: > 1) Treat any mention of `__cplusplus` macro as a C++ file That's not a good idea, because many header files are basically C code, but use __cplusplus condition to allow C++ code include the header file. > 2) Or add an `operatorX` pattern where X is one of the C++ operators > (don't forget <=> etc) That could be unreliable, I'm afraid. > For now I'm enabling c++-ts-mode manually whenever I edit said header The usual technique is to have // -*- c++ -*- on the first line of the file. > but it's still bad since some of the broken highlighting from > c-ts-mode persists into c++-ts-mode after toggling and gets fixed > after moving the cursor through affected areas. That's another bug > though. Please submit a separate bug about that, with the details: where in that file do you see the incorrect highlighting after switching the mode. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 28 13:46:22 2025 Received: (at 78117) by debbugs.gnu.org; 28 Apr 2025 17:46:22 +0000 Received: from localhost ([127.0.0.1]:34271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9SYg-00042b-42 for submit@debbugs.gnu.org; Mon, 28 Apr 2025 13:46:22 -0400 Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]:57490) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1u9SYc-00041J-LM for 78117@debbugs.gnu.org; Mon, 28 Apr 2025 13:46:19 -0400 Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-606440d92eeso2689335eaf.2 for <78117@debbugs.gnu.org>; Mon, 28 Apr 2025 10:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745862372; x=1746467172; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=v8ojxIVrZciGr1nO0h+LWEXokKp35iIIFX0Sz8ZCqvU=; b=lzH5esHjegPvjOXRRcftlwTMcsBBL+1lxBG0qe5ezMo+XUdbhBXbBGoLcXjYFPFLFe TxdaSQF8TnaLSqDU5i7LXBulw34sITOPfMflcU/tZ0PoL7zRjukxis2JIzU4D6Qq2Bco 32VbJSECT0TaxClcbtEjAvmQbFLx+53X728W3n3kL9k6OPWDgOKCPufLskzB7WYWWlPp sxUEw9ozbbhUUf7flDkm76nuldMMvQWiskI+fAbeCxcTVfqtr/rcrEvYtph+5B9ssDQ9 SfOvnQs3jeFdKba7Gp9rRkyOM/VnRkf9aaQ2Q3P1EBU2BTiOklgaDUvRONVfpTWEZ+pZ e9Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745862372; x=1746467172; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v8ojxIVrZciGr1nO0h+LWEXokKp35iIIFX0Sz8ZCqvU=; b=VkvPDQNefzVg30xew+UHE2/GbFOU48xfh4VsyvF1BPSmzu+Hsy3N8Od8/MUpf/SbHk VhYzFHSvyHm4r8NB6yFHYSaQMKEUPYP/p8AOfG+u8WM8JPzZqjJhBY55LrHXouK714N8 1ltHpXEELE4uSUv9haFQW68E5YqS9tu/fhzjxB6qKRe3XiKZGbpYY3vXeU1uJYTTow4T npahDU0MnmT8iRN8QFL5DWE3QGOAVRkArHsKljqsP/ETxPTDjhKYGUGQQc+SyvXGoTdI fZp6Qyj1ybj6qrPsAVFZbZEOj4Tlw2OBz/MghYHhVGpCv0NI7/QqTDmCe3XDvh8jiEC4 lYCA== X-Gm-Message-State: AOJu0YxZp5vVzpDvlgDN8aV58HkwZkpCgPDgcC7jl5GrraWbFcjXRJfn YuTdvRr+lViCgu7MXMNtRx49ncFR0lS+M4lBu2M0pHs1GoT9tmeSM66JkjT/KfBV+xBBI6c4SQM MEd2w0SBd0Df2iSR3hw8D3FEM3TY= X-Gm-Gg: ASbGncvm1TUJ0y5LhRNkmvEhx5DLcw7Tko2LDDqjewC3mBEgmmLjCQDWGHgBh1nkhOG hvEVCsPIE+PlWLnpIll0waMSv/l44i4QreL8iqQpvu3BZy/RgaPAOo+lLs8MqDSGD0TaLGNLSw1 MK6gs//NrmcgNFTwgG+abckOu90Gf9Osxn X-Google-Smtp-Source: AGHT+IFtVgTS/1j7ufvAIOsHK2RYrDdW6jcUZZgWHggP+LUPykjjaS651Vt3Llg3W0tiLTLwTi3ZJNw/Lz5WTzWwObI= X-Received: by 2002:a05:6820:2019:b0:606:26bd:7208 with SMTP id 006d021491bc7-60683efd72dmr442792eaf.7.1745862372439; Mon, 28 Apr 2025 10:46:12 -0700 (PDT) MIME-Version: 1.0 References: <867c34qo53.fsf@gnu.org> In-Reply-To: From: Sergey Abdulov Date: Mon, 28 Apr 2025 22:46:01 +0500 X-Gm-Features: ATxdqUGaGRJXEcFvnCdHZpp490R7xDIx_QY3rVItLZtrZpUfUhC3M5zSE40CoKA Message-ID: Subject: Re: bug#78117: Improve c-ts-mode--c-or-c++-regexp To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 78117 Cc: 78117@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: -0.3 (/) > That's not a good idea, because many header files are basically C > code, but use __cplusplus condition to allow C++ code include the > header file. I mean, after `__cplusplus` check usually comes `extern "C"` which is not C and won't compile with GCC. But you have a point so I won't argue. > That could be unreliable, I'm afraid. Not sure why. Is there any conflict with C by matching, say, "operator<" in your opinion? > Please submit a separate bug about that, with the details: where in > that file do you see the incorrect highlighting after switching the > mode. Working on that. It turns out the issue is still there even if loading straight into c++-ts-mode. Random curly braces get `font-lock-warning-face` for no apparent reason. I'll try to narrow it down as much as possible and report it. Thanks. On Mon, Apr 28, 2025 at 10:39=E2=80=AFPM Sergey Abdulov wrote: > > > That's not a good idea, because many header files are basically C > > code, but use __cplusplus condition to allow C++ code include the > > header file. > > I mean, after `__cplusplus` check usually comes `extern "C"` > which is not C and won't compile with GCC. > But you have a point so I won't argue. > > > That could be unreliable, I'm afraid. > > Not sure why. Is there any conflict with C by > matching, say, "operator<" in your opinion? > > > Please submit a separate bug about that, with the details: where in > > that file do you see the incorrect highlighting after switching the > > mode. > > Working on that. It turns out the issue is still there even if loading > straight into c++-ts-mode. Random curly braces get > `font-lock-warning-face` for no apparent reason. > I'll try to narrow it down as much as possible and report it. > > Thanks. > > On Mon, Apr 28, 2025 at 8:53=E2=80=AFPM Eli Zaretskii wrot= e: > > > > > From: Sergey Abdulov > > > Date: Mon, 28 Apr 2025 11:13:31 +0500 > > > > > > Hello! > > > > > > I ran into a header that uses C++ features but still opens in c-ts-mo= de. > > > Link: https://raw.githubusercontent.com/HandmadeMath/HandmadeMath/ref= s/heads/master/HandmadeMath.h > > > Therefore I suggest either: > > > 1) Treat any mention of `__cplusplus` macro as a C++ file > > > > That's not a good idea, because many header files are basically C > > code, but use __cplusplus condition to allow C++ code include the > > header file. > > > > > 2) Or add an `operatorX` pattern where X is one of the C++ operators > > > (don't forget <=3D> etc) > > > > That could be unreliable, I'm afraid. > > > > > For now I'm enabling c++-ts-mode manually whenever I edit said header > > > > The usual technique is to have > > > > // -*- c++ -*- > > > > on the first line of the file. > > > > > but it's still bad since some of the broken highlighting from > > > c-ts-mode persists into c++-ts-mode after toggling and gets fixed > > > after moving the cursor through affected areas. That's another bug > > > though. > > > > Please submit a separate bug about that, with the details: where in > > that file do you see the incorrect highlighting after switching the > > mode. > > > > Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 29 01:15:58 2025 Received: (at 78117) by debbugs.gnu.org; 29 Apr 2025 05:15:58 +0000 Received: from localhost ([127.0.0.1]:44881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9dK2-0006vG-7Y for submit@debbugs.gnu.org; Tue, 29 Apr 2025 01:15:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50742) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9dJz-0006up-7d for 78117@debbugs.gnu.org; Tue, 29 Apr 2025 01:15:55 -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 1u9dJt-0008EQ-RG; Tue, 29 Apr 2025 01:15:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=QPi5NvcBkGgidE4NgtJ+NRuYDukQVE0WGBJT6umQGX0=; b=YOEGIeEcw7Hd XoO4tFX+kiO4kE2RIFM+4e993Bmha6rMoh3nE8qWfIvzeIBAN8DJng9RE8aOgIGDVIIPKC3EG9Fcd 02VYUQLFvCHTCqqElOCw2qPDKf2o1HLUSrORNesLt2FEZgKu/QeuT7kRoxizkR3oFrz2o28MKYz9a c1L5gbRPkRrNwOajboSR1Bn5TrPVIrXPH8Q3I9PgfKAY4QHYhQoxJEr3SV3S4vnzOnwmaCbQe2Zf0 mlhoVy7GCpuyPyFtNi/pUdWNdlNcq4A3DNYnef2FnicHJzBBCSaZi4qFGZrYwYuuGGptloMzqjI7D mZO/wuMgk43sCCV4Z0hy2A==; Date: Tue, 29 Apr 2025 08:15:44 +0300 Message-Id: <8634drr1j3.fsf@gnu.org> From: Eli Zaretskii To: Sergey Abdulov In-Reply-To: (message from Sergey Abdulov on Mon, 28 Apr 2025 22:46:01 +0500) Subject: Re: bug#78117: Improve c-ts-mode--c-or-c++-regexp References: <867c34qo53.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78117 Cc: 78117@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 (---) > From: Sergey Abdulov > Date: Mon, 28 Apr 2025 22:46:01 +0500 > Cc: 78117@debbugs.gnu.org > > > That's not a good idea, because many header files are basically C > > code, but use __cplusplus condition to allow C++ code include the > > header file. > > I mean, after `__cplusplus` check usually comes `extern "C"` > which is not C and won't compile with GCC. > But you have a point so I won't argue. > > > That could be unreliable, I'm afraid. > > Not sure why. Is there any conflict with C by > matching, say, "operator<" in your opinion? The search for this should take care not to produce false positives, which might not be easy. As a trivial example, it should not match inside comments and strings, and not inside preprocessor directives that are never true, like "#if 0" or somesuch. Feel free to submit patches which would search for patterns that are telltale C++, but I think it is not a coincidence that neither CC Mode nor c-ts-mode go beyond very simple checks, and leave the rest to the mode cookie. (Btw, you could also solve this for an entire directory using a .dir-locals.el file. GDB sources do that, for example.) > > Please submit a separate bug about that, with the details: where in > > that file do you see the incorrect highlighting after switching the > > mode. > > Working on that. It turns out the issue is still there even if loading > straight into c++-ts-mode. Random curly braces get > `font-lock-warning-face` for no apparent reason. > I'll try to narrow it down as much as possible and report it. This could be some issue with the version of the C++ grammar library you have. Maybe it's too old, or too new with changes that Emacs did not yet incorporate.