GNU bug report logs - #64917
30.0.50; c-ts-mode throws warnings about missing cpp support

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Fri, 28 Jul 2023 09:16:02 UTC

Severity: normal

Tags: notabug

Found in version 30.0.50

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64917 <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>
Subject: bug#64917: 30.0.50; c-ts-mode throws warnings about missing cpp support
Date: Sat, 29 Jul 2023 10:46:18 -0700

> On Jul 28, 2023, at 5:11 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> tags 64917 notabug
> thanks
> 
>> From: Robert Pluim <rpluim <at> gmail.com>
>> Date: Fri, 28 Jul 2023 11:14:15 +0200
>> 
>> I built master with tree-sitter support, and installed the c-language
>> grammar using M-x treesit-install-language-grammar. I have
>> libtree-sitter-c.so in ~/.emacs.d/tree-sitter
>> 
>> I restarted emacs, visited src/xdisp.c, and did M-x c-ts-mode, which
>> popped up a *Warnings* buffer containing:
>> 
>> ⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for cpp is unavailable (not-found): (libtree-sitter-cpp libtree-sitter-cpp.0 libtree-sitter-cpp.0.0 libtree-sitter-cpp.so libtree-sitter-cpp.so.0 libtree-sitter-cpp.so.0.0) No such file or directory
>> ⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for cpp is unavailable (not-found): (libtree-sitter-cpp libtree-sitter-cpp.0 libtree-sitter-cpp.0.0 libtree-sitter-cpp.so libtree-sitter-cpp.so.0 libtree-sitter-cpp.so.0.0) No such file or directory
>> 
>> which is less than desirable (althoug `major-mode' is c-ts-mode, so I
>> guess things worked)
> 
> Please install the C++ grammar as well.  Those two go together because
> some *.h files could be C or C++, and we can only test that at run
> time.

For future reference, that’s true but not the whole picture. The warning is caused by the call to (treesit-ready-p ‘cpp) at the end of c-ts-mode.el:

(if (treesit-ready-p 'cpp)
    (add-to-list 'auto-mode-alist
                 '("\\(\\.ii\\|\\.\\(CC?\\|HH?\\)\\|\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\|\\.\\(cc\\|hh\\)\\)\\'"
                   . c++-ts-mode)))

There was a discussion on whether we want to use (treesit-ready-p ‘cpp t) which tests for the availability of cpp grammar but doesn’t raise a warning. And your decision was to keep the warning, IIRC.

And my understanding is that these code that modifies auto-mode-alist whenever c-ts-mode.el is loaded are temporary for Emacs 29, and in the future might be removed. If they are removed, the warning will be gone.

Yuan



This bug report was last modified 2 years and 14 days ago.

Previous Next


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