From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64830: 30.0.50 C++ treesitter mode no coloration Date: Wed, 28 Aug 2024 15:33:28 +0300 Message-ID: <86wmk0hlnr.fsf@gnu.org> References: <86h6bk5nnu.fsf@gnu.org> <3C502C2B-829D-42C3-A74A-2A783F5880CE@gmail.com> <868qwjjhq3.fsf@gnu.org> <78DD1528-A12B-4199-9822-157852080027@gmail.com> <86wmk2i2vp.fsf@gnu.org> <29FFAE70-8B01-47CF-A45A-D01C82C56247@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39249"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64830@debbugs.gnu.org, acm@muc.de, stefankangas@gmail.com To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 28 14:34:34 2024 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 1sjHsg-000A2P-01 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Aug 2024 14:34:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjHsI-0007bR-QQ; Wed, 28 Aug 2024 08:34:10 -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 1sjHsG-0007WI-MS for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2024 08:34:08 -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 1sjHsG-0002ko-56 for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2024 08:34:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=xJVtIjOZ0+1GgxoqDl5uEUk2Q2z00sr1Yokwsk+hW3Y=; b=f3gvsjaKuNajfHx1K0q3qHU3Pq3eT/me1Cl8YOZLvqNTp2hMvMNGgSC3W2ID+JR1U1HTZXkmR1AtyEWxeNuJCnmjBsKQV0g3olCB7A6sdjTUjqgChQ4KZEDRNBu9JBTUhb5GBlx/eQA1wZm1vF8nxV+A0VFVSmsAKDnWHN8++eBxVrklikf+zt/blxLg27p7DjvnpE8I4xlyeysDmT7fSKhhNPE9/FcwkJxtF2mmgrtdTtwYxflO936DFjMqP8iYeyNf+iSr5idL5q6Wg8AadqENDVNRjkQnd8e2IFF5Dik8xAeAV+U+DjwB8PY/NfSXTeyjrl/Cq+2mD6LPqjwnBw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sjHt7-0002hE-Jd for bug-gnu-emacs@gnu.org; Wed, 28 Aug 2024 08:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Aug 2024 12:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64830 X-GNU-PR-Package: emacs Original-Received: via spool by 64830-submit@debbugs.gnu.org id=B64830.172484849810354 (code B ref 64830); Wed, 28 Aug 2024 12:35:01 +0000 Original-Received: (at 64830) by debbugs.gnu.org; 28 Aug 2024 12:34:58 +0000 Original-Received: from localhost ([127.0.0.1]:48396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjHt4-0002gv-AT for submit@debbugs.gnu.org; Wed, 28 Aug 2024 08:34:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjHt1-0002gf-Vx for 64830@debbugs.gnu.org; Wed, 28 Aug 2024 08:34:56 -0400 Original-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 1sjHs4-0002iF-2d; Wed, 28 Aug 2024 08:33:56 -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=xJVtIjOZ0+1GgxoqDl5uEUk2Q2z00sr1Yokwsk+hW3Y=; b=mdI0tP2/hfGd 0yiYjVMW7KtLayC6o4Hpv/UML4FC8oz+Jy1ZZCKn0iwOTY/RuMDGpFRZiT2/KLQkFMQyhTNVih+gU xI7AJbKadER9Z1vZvq1n/a4rPoGUR/jijVHcQZPFEh5xsxYtIGTvxMfEuNyUC6mg3IBb1GUJoPagf YJwrYJ3K8/ysXm7BKBqvfVwHpd0kdpiuSL26Tj2m/pBRPJFG4ByzyIDu9PiV7LpKrusbqmTkUyBqZ s3pbQw+xV3ILHkY2iq/P1jkPQ2T7P6Ky8YqxDdfnIFSkDzLLs8NJGiqOtq8lDUz3cE1uGJY8hA795 0ZI3xVRBVeYEfOdTRi3xTA==; In-Reply-To: <29FFAE70-8B01-47CF-A45A-D01C82C56247@gmail.com> (message from Yuan Fu on Tue, 27 Aug 2024 22:36:46 -0700) 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:290863 Archived-At: > From: Yuan Fu > Date: Tue, 27 Aug 2024 22:36:46 -0700 > Cc: Stefan Kangas , > Alan Mackenzie , > 64830@debbugs.gnu.org > > +struct treesit_loaded_lang > +{ > + /* The language object. */ > + TSLanguage *lang; > + /* The path of the shared library. */ > + const char *path; Gnu Coding Standard frowns on using "path" for anything except PATH-style directory lists. Please use "filename" or "fname" or something like that instead. > + Dl_info info; > + if (dladdr(langfn, &info)) > + loaded_lang.path = info.dli_fname; dladdr is non-portable. We have dynlib_addr instead, and since treesit.c correctly uses dynlib.c functions already, using dynlib_addr is only natural. > + if (!lang.lang || !lang.path) return Qnil; > + > + return build_string (lang.path); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I think we should do return DECODE_FILE (make_unibyte_string (lang.filename, strlen (lang.filename)); instead, because dynlib_addr (and dladdr as well) return encoded file names.