From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Renato Fernandes de Queiroz Newsgroups: gmane.emacs.bugs Subject: bug#73800: 30.0.91; infinite loop in c-ts-mode--anchor-prev-sibling Date: Mon, 14 Oct 2024 00:53:56 -0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40239"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: 73800@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 14 10:16:16 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 1t0GFT-000AHY-Nt for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Oct 2024 10:16:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0GFA-0006Z6-7p; Mon, 14 Oct 2024 04:15:56 -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 1t0GF2-0006Yb-QH for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 04:15:49 -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 1t0GF0-0004bR-C3 for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 04:15:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:MIME-Version:Date:To:Subject; bh=FApbA2R1+TjhnoFs2B9zXc6aF5uMmQA6SmgseV+Ih48=; b=eqFtrEqc6SQHP/umQhcJmnIHpVLrd3MyEf5s6ZftH9f/+tZPJmvsie5I9pLLsW+HFHlGfQ34WTiKiWiMkjANP3+AGvX7lwmJQqMpJHFI6r+h7riEu+k5L4CaZL/07W/wHaq0lQc5HR9XEwiAuCleuDXLiyiEYL5mKYmxm2S/mgQPSezVXk4QkBridKqThPdzPBWwtZipH1PG2edkQMXJ02Af09a/TVA6HpfN9d72JxuVvzcLh/vOdnm6PmPA2AhQvUIBk8J843HqA/0y3DE9t7jGKww87Sbe/oEGwbBK6jL+SJawBfDALfU5L7CNuxejXpPymUcJPW/Kux84v9GJZA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t0GFG-0002ZU-Pn for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 04:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Renato Fernandes de Queiroz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Oct 2024 08:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73800 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17288937619868 (code B ref -1); Mon, 14 Oct 2024 08:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Oct 2024 08:16:01 +0000 Original-Received: from localhost ([127.0.0.1]:35231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0GFE-0002Z2-Tf for submit@debbugs.gnu.org; Mon, 14 Oct 2024 04:16:01 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:60456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0CA2-0004G1-BS for submit@debbugs.gnu.org; Sun, 13 Oct 2024 23:54:23 -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 1t0C9l-0002oy-8U for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2024 23:54:05 -0400 Original-Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t0C9j-0008M0-BK for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2024 23:54:05 -0400 Original-Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7ae3d7222d4so3221885a12.3 for ; Sun, 13 Oct 2024 20:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728878040; x=1729482840; darn=gnu.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FApbA2R1+TjhnoFs2B9zXc6aF5uMmQA6SmgseV+Ih48=; b=ekP40yROOFT77bJROZQAM+qhtqOnPWLfx7p7iMjlrQHhjHqzl6DEfZhTJOc81HWQwM H+eLfUqWn7FcoOmW1vxuwKym5b3WCNO3yWn1DoHk6DawRHUHkyjNRaTpDv3jRz8SUd+c ZDPbeoDOn7895Zoh6luaLBRjNtn745QG3o67g272cL0CMf1B1B4JeGJfHD8GmxGDNvid TGQrokdy1Zw39Sy7RE/QstEhkwsnBdhRu+0CqZmca35R5Wq0ifuq8Iipkc/3//7xdwmK UpV3DUe556pYr0Q4gMro29WdB3C+g4+jYYAIpRJy27O+NFElFGk2iD+So2gLjfWhxb5F xDIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728878040; x=1729482840; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=FApbA2R1+TjhnoFs2B9zXc6aF5uMmQA6SmgseV+Ih48=; b=vFYZUDLMb0VsFgaAT+TKH82sx9XDxtWpinKeBTkEZKkYvTVmHEeHPa6DWkIDyfZz4C k7sZYgF92B0FwZBv82P96knEn953vmmaGYcUoxtq2S7hb4vUC99Twin2UllEa4ZfzKVe +p+/jtfyE6bWBx8F/ksbOR0bNB6orsfypX7DtwB92eidr+XZQl/+2+Uch08a4U+mkKvP jhxYuAC0FNQoxn8Oi+5SipbUrGAwlxkENCR2y7giiB8YiqY6guZp0WoU2U3InvyVhfrL Jj1ToLzjYQt6H0jeaDXGQfoCZvJeJR0QaFZFtppIeNyl5LQQsI/aqq5ampYHdoKhNEKU kUnQ== X-Gm-Message-State: AOJu0YzUjTjsqnJ70mNtrUXW9IkShpPREnmV9LKXC5CDt9zcoSrEocBB v+Cnr2AbhU2C+2GGERsxQPfR4sYg6JzOwPPWhFVME7hFm+pAEIUIs7ryNw== X-Google-Smtp-Source: AGHT+IEs+nw2vpYcZApRS6GHBKae9Kq+hWy30dg93usAnfoYtWgl4RWsj0WwtcF3crwkLfZrJv9ynw== X-Received: by 2002:a05:6a20:e18a:b0:1d4:e4c9:99d with SMTP id adf61e73a8af0-1d8bcefcbadmr14937009637.7.1728878040143; Sun, 13 Oct 2024 20:54:00 -0700 (PDT) Original-Received: from ?IPV6:2804:7f74:b1c:4e00:ec3f:811f:1e4:bd82? ([2804:7f74:b1c:4e00:ec3f:811f:1e4:bd82]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e6818a0e2sm775324b3a.31.2024.10.13.20.53.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Oct 2024 20:53:59 -0700 (PDT) Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=renatofq@gmail.com; helo=mail-pg1-x530.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-Mailman-Approved-At: Mon, 14 Oct 2024 04:15:59 -0400 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:293563 Archived-At: Steps to reproduce: 1. Open a new buffer and load c-ts-mode 2. insert the following code int main (int argc, char *argv[]) { int x; a } 3. Move point past 'a' 4. Hit TAB Emacs enters a infinite loop. I've set debug-on-quit to t and got Debugger entered--Lisp error: (quit) looking-back("^[[:space:]]*" 283) c-ts-mode--anchor-prev-sibling(# # 304) treesit--simple-indent-eval((c-ts-mode--anchor-prev-sibling # # 304)) treesit-simple-indent(# # 304) apply(treesit-simple-indent (# # 304)) #[128 "\301\302\300!\2\"\207" [treesit-indent-function apply default-value] 4 advice--forward](# # 304) apply(#[128 "\301\302\300!\2\"\207" [treesit-indent-function apply default-value] 4 advice--forward] (# # 304)) #f(advice c-ts-base--before-indent :filter-args #[128 "\301\302\300!\2\"\207" [treesit-indent-function apply default-value] 4 advice--forward])(# # 304) treesit--indent-1() treesit-indent() indent--funcall-widened(treesit-indent) indent-for-tab-command(nil) funcall-interactively(indent-for-tab-command nil) command-execute(indent-for-tab-command) Looking at the function code I saw that a form that shoud be inside the condition. Probably a typo. The fix is trivial: diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 576d715510d..9003201c651 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -329,8 +329,8 @@ c-ts-mode--anchor-prev-sibling ;; and starting the items on the same line as {. (_ (goto-char (treesit-node-start prev-sibling)) (if (or (looking-back (rx bol (* whitespace)) - (line-beginning-position))) - (null (treesit-node-prev-sibling prev-sibling t)) + (line-beginning-position)) + (null (treesit-node-prev-sibling prev-sibling t))) (setq continue nil) (setq prev-sibling (treesit-node-prev-sibling prev-sibling))))))) This bug was introduced at e49b479f869. In GNU Emacs 30.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) of 2024-10-13 built on carcara Repository revision: ae75ea62324598654b32ed28bf644ec2bc4c04b2 Repository branch: emacs-30 System Description: Arch Linux Configured using: 'configure --with-pgtk --without-gconf --with-sound=no --without-gpm --without-xaw3d --with-tree-sitter --with-modules --without-libotf --without-m17n-flt --with-native-compilation' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB Important settings: value of $LANG: pt_BR.UTF-8 locale-coding-system: utf-8-unix Major mode: C/* Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils dired-aux dired dired-loaddefs cl-print debug backtrace find-func cus-edit pp wid-edit cus-start cus-load time-date c++-ts-mode c-ts-mode c-ts-common treesit cl-extra noutline outline help-fns radix-tree help-mode vc-git diff-mode track-changes easy-mmode vc-dispatcher cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs compile text-property-search comint ansi-osc ansi-color ring comp-run comp-common rx ffap thingatpt url-parse auth-source cl-seq eieio eieio-core cl-macs icons cl-loaddefs cl-lib password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd 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 dynamic-setting system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty move-toolbar make-network-process native-compile emacs) Memory information: ((conses 16 170635 186225) (symbols 48 13031 15) (strings 32 39676 2329) (string-bytes 1 1551295) (vectors 16 21497) (vector-slots 8 267270 42860) (floats 8 55 133) (intervals 56 1333 679) (buffers 992 18))