Package: emacs;
Reported by: João Távora <joaotavora <at> gmail.com>
Date: Thu, 7 Sep 2023 17:46:02 UTC
Severity: normal
Found in version 30.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65810 in the body.
You can then email your comments to 65810 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org:bug#65810; Package emacs.
(Thu, 07 Sep 2023 17:46:02 GMT) Full text and rfc822 format available.João Távora <joaotavora <at> gmail.com>:bug-gnu-emacs <at> gnu.org.
(Thu, 07 Sep 2023 17:46:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: João Távora <joaotavora <at> gmail.com> To: bug-gnu-emacs <at> gnu.org Cc: eliz <at> gnu.org Subject: 30.0.50; C-M-f and related functions error out in c++-ts-mode Date: Thu, 07 Sep 2023 18:48:07 +0100
Hi maintainers,
This is simple to reproduce, I think:
> ~/Source/Emacs/emacs/src/emacs --version
GNU Emacs 30.0.50
Development version 59c35bf16fbe on master branch; build date 2023-09-04.
> ~/Source/Emacs/emacs/src/emacs -nw -Q ~/tmp/simple.cpp -f c++-ts-mode
Now just type C-M-f or any C-M-something command.
Debugger entered--Lisp error: (treesit-invalid-predicate nil)
treesit-node-match-p(#<treesit-node "{" in 1-2> sexp t)
#f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>)(#<treesit-node "{" in 1-2>)
treesit-node-match-p(#<treesit-node "{" in 1-2> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>) t)
treesit-node-top-level(#<treesit-node "{" in 1-2> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>) t)
treesit--things-around(5 sexp)
treesit--navigate-thing(5 -1 beg sexp restricted)
treesit-beginning-of-thing(sexp 1 restricted)
treesit-forward-sexp(-1)
forward-sexp(-1 nil)
forward-sexp(-1 5)
backward-sexp(1 5)
funcall-interactively(backward-sexp 1 5)
call-interactively(backward-sexp nil nil)
command-execute(backward-sexp)
simple.cpp can be any C++ file, from a simple
int main() {return 0;}
to a completely empty file.
When debug-on-error is nil, there is an further error message in
*Messages*, but I don't know what it means:
Invalid predicate, see `treesit-thing-settings' for valid forms for a predicate: nil [4 times]
I installed my C++ grammar with M-x treesit-install-language-grammar,
entered 'cpp' (treesit's nickname for C++) and everything else default.
The grammar and treesitter seems to be working, I get indentation and
font-locking, for example.
Furthermore I can confirm this same behavior with a version of the
grammar installed today and installed some months ago.
Thanks,
João
In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
3.24.36, cairo version 1.17.8) of 2023-09-04 built on krug
Repository revision: 40514ebf7de644bad984acaeb3ea72b973dae18f
Repository branch: master
System Description: Arch Linux
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_CTYPE: en_US.UTF-8
value of $LANG: C
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: C++//
Minor modes in effect:
whitespace-mode: t
server-mode: t
yas-global-mode: t
yas-minor-mode: t
savehist-mode: t
windmove-mode: t
winner-mode: t
fido-vertical-mode: t
icomplete-vertical-mode: t
icomplete-mode: t
fido-mode: t
electric-pair-mode: t
delete-selection-mode: t
global-auto-revert-mode: t
global-company-mode: t
company-mode: t
xclip-mode: t
xterm-mouse-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
window-divider-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
hs-minor-mode: t
Features:
(shadow emacsbug c-ts-mode descr-text ob-ditaa ob-plantuml org-clock
org-colview org-crypt org-ctags org-habit org-mouse org-plot
org-protocol mhtml-mode css-mode sgml-mode facemenu rst htmlize
yas-doc-helper htmlize-autoloads loaddefs-gen lisp-mnt tar-mode arc-mode
archive-mode mm-archive ox-odt rng-loc rng-uri rng-parse rng-match
rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util
ox-latex ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox
pcmpl-unix pcmpl-gnu markdown-mode novice edebug js-flymake-eslint js
c-ts-common edmacro kmacro org-element org-persist org-id org-refile
avl-tree oc-basic ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb
ol-w3m ol-doi org-link-doi yasnippet-tests org ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete
org-list org-footnote org-faces org-entities noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs cal-menu calendar cal-loaddefs
org-version org-compat org-macs ert-x ruby-mode yaml-mode vc-hg vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc-dir tramp-cache
time-stamp tramp-sh tramp trampver tramp-integration tramp-message
tramp-compat tramp-loaddefs tabify eglot external-completion jsonrpc ert
ewoc debug backtrace timezone quail gnus-cite gnus-bcklg sh-script smie
treesit shell pcomplete gnus-async qp gnus-ml disp-table nndraft nnmh
utf-7 nnfolder nnnil gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig
nntp gnus-cache gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range gnus-win mailalias smtpmail sort mail-extr shr-color textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
parse-time iso8601 gnutls network-stream url-http url-gw nsm url-cache
url-auth eww xdg url-queue shr pixel-fill kinsoku url-file svg xml dom
mm-url gnus nnheader range ffap bug-reference dired-aux cl-print
find-func shortdoc comp comp-cstr help-fns radix-tree log-edit message
sendmail yank-media puny dired-x dired dired-loaddefs rfc822 mml mml-sec
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util hippie-exp add-log misearch multi-isearch
smerge-mode diff vc display-line-numbers cc-mode cc-fonts cc-guess
cc-menus cc-cmds breadcrumb imenu term/xterm xterm time-date
flymake-proc flymake hideshow whitespace executable vc-git diff-mode
vc-dispatcher cus-edit pp cus-start cus-load wid-edit diminish
git-rebase-mode server yow cookie1 yasnippet wombat-theme hyperspec
sly-autoloads rust-utils rust-mode rx rust-rustfmt rust-playpen
rust-compile rust-cargo epa-file epa derived epg rfc6068 epg-config
savehist windmove ediff ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-init ediff-util winner icomplete elec-pair delsel
autorevert filenotify erc format-spec erc-backend erc-networks
erc-common erc-compat compat erc-loaddefs ibuf-ext ibuffer
ibuffer-loaddefs auth-source-pass company-oddmuse company-keywords
make-mode company-etags etags fileloop generator xref project
company-gtags files-x company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company cc-styles cc-align cc-engine
cc-vars cc-defs beardbolt pulse disass aggressive-indent easy-mmode ack
thingatpt pcase compile text-property-search comint ansi-osc ansi-color
ring cl-extra help-mode warnings icons xclip finder-inf xt-mouse color
mule-util holy color-theme-sanityinc-tomorrow-autoloads
corfu-terminal-autoloads corfu-autoloads compat-autoloads
debbugs-autoloads diminish-autoloads dts-mode-autoloads
go-mode-autoloads lua-mode-autoloads lv-autoloads
markdown-mode-autoloads popon-autoloads pos-tip-autoloads
pyvenv-autoloads reformatter-autoloads rust-mode-autoloads
spinner-autoloads info transient-autoloads xclip-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process emacs)
Memory information:
((conses 16 1068497 236334) (symbols 48 55213 15)
(strings 32 280969 46949) (string-bytes 1 7753809)
(vectors 16 147167) (vector-slots 8 2762875 94473)
(floats 8 1059 16219) (intervals 56 23001 4930) (buffers 992 102))
bug-gnu-emacs <at> gnu.org:bug#65810; Package emacs.
(Thu, 07 Sep 2023 18:10:02 GMT) Full text and rfc822 format available.Message #8 received at 65810 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: João Távora <joaotavora <at> gmail.com>, Yuan Fu <casouri <at> gmail.com> Cc: 65810 <at> debbugs.gnu.org Subject: Re: bug#65810: 30.0.50; C-M-f and related functions error out in c++-ts-mode Date: Thu, 07 Sep 2023 21:09:33 +0300
> From: João Távora <joaotavora <at> gmail.com>
> Cc: eliz <at> gnu.org
> Date: Thu, 07 Sep 2023 18:48:07 +0100
>
> Now just type C-M-f or any C-M-something command.
>
> Debugger entered--Lisp error: (treesit-invalid-predicate nil)
> treesit-node-match-p(#<treesit-node "{" in 1-2> sexp t)
> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>)(#<treesit-node "{" in 1-2>)
> treesit-node-match-p(#<treesit-node "{" in 1-2> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>) t)
> treesit-node-top-level(#<treesit-node "{" in 1-2> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>) t)
> treesit--things-around(5 sexp)
> treesit--navigate-thing(5 -1 beg sexp restricted)
> treesit-beginning-of-thing(sexp 1 restricted)
> treesit-forward-sexp(-1)
> forward-sexp(-1 nil)
> forward-sexp(-1 5)
> backward-sexp(1 5)
> funcall-interactively(backward-sexp 1 5)
> call-interactively(backward-sexp nil nil)
> command-execute(backward-sexp)
>
> simple.cpp can be any C++ file, from a simple
>
> int main() {return 0;}
>
> to a completely empty file.
With the above sample file I can indeed reproduce the error. But not
with real-life files I tried, where functions are larger and there's
usually more than one function.
Yuan, could you please look into this?
Yuan Fu <casouri <at> gmail.com>:João Távora <joaotavora <at> gmail.com>:Message #13 received at 65810-done <at> debbugs.gnu.org (full text, mbox):
From: Yuan Fu <casouri <at> gmail.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: João Távora <joaotavora <at> gmail.com>, 65810-done <at> debbugs.gnu.org Subject: Re: bug#65810: 30.0.50; C-M-f and related functions error out in c++-ts-mode Date: Thu, 7 Sep 2023 16:12:13 -0700
> On Sep 7, 2023, at 11:09 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: João Távora <joaotavora <at> gmail.com>
>> Cc: eliz <at> gnu.org
>> Date: Thu, 07 Sep 2023 18:48:07 +0100
>>
>> Now just type C-M-f or any C-M-something command.
>>
>> Debugger entered--Lisp error: (treesit-invalid-predicate nil)
>> treesit-node-match-p(#<treesit-node "{" in 1-2> sexp t)
>> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>)(#<treesit-node "{" in 1-2>)
>> treesit-node-match-p(#<treesit-node "{" in 1-2> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>) t)
>> treesit-node-top-level(#<treesit-node "{" in 1-2> #f(compiled-function (node) #<bytecode 0x1a160a6a590699e2>) t)
>> treesit--things-around(5 sexp)
>> treesit--navigate-thing(5 -1 beg sexp restricted)
>> treesit-beginning-of-thing(sexp 1 restricted)
>> treesit-forward-sexp(-1)
>> forward-sexp(-1 nil)
>> forward-sexp(-1 5)
>> backward-sexp(1 5)
>> funcall-interactively(backward-sexp 1 5)
>> call-interactively(backward-sexp nil nil)
>> command-execute(backward-sexp)
>>
>> simple.cpp can be any C++ file, from a simple
>>
>> int main() {return 0;}
>>
>> to a completely empty file.
>
> With the above sample file I can indeed reproduce the error. But not
> with real-life files I tried, where functions are larger and there's
> usually more than one function.
>
> Yuan, could you please look into this?
That’s due to some new stuff I added recently. I’ve pushed a fix to master. Sorry for the chaos guys :-(
Yuan
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org.
(Fri, 06 Oct 2023 11:24:06 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.