GNU bug report logs - #64830
29.1; C++ treesitter mode no coloration

Previous Next

Package: emacs;

Reported by: David Come <david.come <at> ageagle.com>

Date: Mon, 24 Jul 2023 10:34:01 UTC

Severity: normal

Merged with 64818

Found in versions 29.1, 30.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #88 received at 64830 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 64830 <at> debbugs.gnu.org, acm <at> muc.de, stefankangas <at> gmail.com
Subject: Re: bug#64830: 30.0.50 C++ treesitter mode no coloration
Date: Wed, 28 Aug 2024 15:33:28 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Tue, 27 Aug 2024 22:36:46 -0700
> Cc: Stefan Kangas <stefankangas <at> gmail.com>,
>  Alan Mackenzie <acm <at> muc.de>,
>  64830 <at> 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.




This bug report was last modified 254 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.