all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73800: 30.0.91; infinite loop in c-ts-mode--anchor-prev-sibling
@ 2024-10-14  3:53 Renato Fernandes de Queiroz
  2024-10-14 13:12 ` Charalampos Mitrodimas
  2024-10-19  8:26 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Renato Fernandes de Queiroz @ 2024-10-14  3:53 UTC (permalink / raw)
  To: 73800

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(#<treesit-node expression_statement in 
304-337> #<treesit-node compound_statement in 281-390> 304)
   treesit--simple-indent-eval((c-ts-mode--anchor-prev-sibling 
#<treesit-node expression_statement in 304-337> #<treesit-node 
compound_statement in 281-390> 304))
   treesit-simple-indent(#<treesit-node expression_statement in 304-337> 
#<treesit-node compound_statement in 281-390> 304)
   apply(treesit-simple-indent (#<treesit-node expression_statement in 
304-337> #<treesit-node compound_statement in 281-390> 304))
   #[128 "\301\302\300!\2\"\207" [treesit-indent-function apply 
default-value] 4 advice--forward](#<treesit-node expression_statement in 
304-337> #<treesit-node compound_statement in 281-390> 304)
   apply(#[128 "\301\302\300!\2\"\207" [treesit-indent-function apply 
default-value] 4 advice--forward] (#<treesit-node expression_statement 
in 304-337> #<treesit-node compound_statement in 281-390> 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])(#<treesit-node expression_statement in 304-337> 
#<treesit-node compound_statement in 281-390> 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))






^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-19 10:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14  3:53 bug#73800: 30.0.91; infinite loop in c-ts-mode--anchor-prev-sibling Renato Fernandes de Queiroz
2024-10-14 13:12 ` Charalampos Mitrodimas
2024-10-19  8:26 ` Eli Zaretskii
2024-10-19  9:36   ` Renato Fernandes de Queiroz
2024-10-19 10:15     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.