Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode

From: Philip Kaludercic <[email-masked]>
Date: Fri, 17 Mar 2023 09:52:39 +0000

X-Debbugs-CC: Theodor Thornhill <[email-masked]>, Yuan Fu <[email-masked]>

Take this code block, where | is the position of the point.

if (foo)|{
  bar;
  baz;
}

When I press C-M-SPC to mark a "S-expression" (knowing that C doesn't
consist of S-Expressions), then I would assume that the region from the
current point until the closing bracket would be selected.  Instead I
get the region from the point up until after the first semicolon.

When I press C-M-SPC again, I get the second one as well, but a third
press refuses to go on.  So I never get the entire block.

I do not know if this is intentional, but it also applies to movement
and killing.  This is also particularly unintuitive when matching pairs
are highlighted (in this case the brackets), which always (?) matches
the interpretation of sexp-commands.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.36, cairo version 1.16.0) of 2023-03-15 built on quetzal
Repository revision: a798a29f7519244b47ffc3035fcd8bf7bafea4d5
Repository branch: master
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-pgtk --with-imagemagick --with-native-compilation
 --with-tree-sitter --with-json CC=gcc 'CFLAGS=-O2 -march=native -pipe'
 LDFLAGS=-flto'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: 
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: C/*

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  jit-spell-mode: t
  flymake-mode: t
  yas-minor-mode: t
  editorconfig-mode: t
  repeat-mode: t
  display-battery-mode: t
  display-time-mode: t
  diff-hl-flydiff-mode: t
  diff-hl-mode: t
  winner-mode: t
  windmove-mode: t
  corfu-history-mode: t
  corfu-mode: t
  electric-pair-mode: t
  recentf-mode: t
  save-place-mode: t
  savehist-mode: t
  pixel-scroll-precision-mode: t
  pixel-scroll-mode: t
  xterm-mouse-mode: t
  which-function-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-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:
/home/philip/.config/emacs/elpa/transient-0.3.7/transient hides /home/philip/Source/emacs/lisp/transient

Features:
(shadow ecomplete emacsbug two-column c-ts-mode dictionary
dictionary-connection java-ts-mode ffap rst mule-util face-remap
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
git-commit log-edit add-log magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process with-editor server
magit-mode magit-git magit-section magit-utils crm dash grep
bug-reference find-func sort smiley gnus-cite mail-extr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
gnus-bcklg gnus-async gnus-ml disp-table nndraft nnmh utf-7 nnfolder
epa-file network-stream gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls
dig nntp gnus-cache gnus-sum gnus-group gnus-undo gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message rfc822 mml mml-sec epa mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader gnus-win url-http url-auth mail-parse
rfc2231 url-gw nsm epg rfc6068 epg-config display-line-numbers quail
copyright geiser-mode geiser-xref geiser-compile geiser-guile transient
edmacro kmacro geiser-debug geiser-mit info-look geiser geiser-repl
geiser-image geiser-capf geiser-doc geiser-menu geiser-autodoc
geiser-edit etags fileloop generator xref geiser-completion geiser-eval
geiser-connection tq geiser-syntax geiser-log geiser-popup view
geiser-impl help-fns radix-tree geiser-custom geiser-base scheme vc-hg
vc-bzr vc-backup flymake-proselint writegood-mode yank-media mhtml-mode
css-mode smie eww xdg url-queue shr pixel-fill kinsoku url-file svg puny
mm-url color js c-ts-common treesit cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-langs cc-vars cc-bytecomp
cc-defs sgml-mode facemenu dom dired-aux gnus-dired dired-x dired
desktop frameset dired-loaddefs char-fold misearch multi-isearch vc-git
buffer-env tramp-cmds tramp-sh tramp tramp-cache time-stamp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
pcomplete parse-time iso8601 ls-lisp jit-spell ispell checkdoc
flymake-proc flymake yasnippet-snippets yasnippet noutline outline
editorconfig editorconfig-core editorconfig-core-handle
editorconfig-fnmatch init repeat project format-spec battery dbus xml
shell-command+ thingatpt time sendmail rfc2047 rfc2045 ietf-drums gnus
nnheader gnus-util time-date mail-utils range mm-util mail-prsvr
diff-hl-flydiff diff diff-hl log-view pcvs-util vc-dir ewoc diff-mode
easy-mmode hippie-exp winner windmove corfu-history corfu compat
elec-pair recentf tree-widget saveplace savehist pixel-scroll cua-base
xt-mouse cus-edit pp wid-edit which-func imenu package-vc vc
vc-dispatcher lisp-mnt cus-load setup finder-inf
shell-command+-autoloads corfu-autoloads haskell-mode-autoloads
macrostep-autoloads flymake-proselint-autoloads focus-autoloads
buffer-env-autoloads avy-autoloads yasnippet-snippets-autoloads
magit-autoloads jit-spell-autoloads geiser-mit-autoloads
bash-completion-autoloads vc-backup-autoloads setup-autoloads
auctex-autoloads tex-site proof-general-autoloads proof-site
proof-autoloads git-commit-autoloads with-editor-autoloads
compat-autoloads inspector-autoloads geiser-guile-autoloads
geiser-autoloads transient-autoloads magit-section-autoloads
0x0-autoloads sp-tutor-autoloads diff-hl-autoloads debbugs-autoloads
package-lint-autoloads xkcd-autoloads editorconfig-autoloads
rcirc-color-autoloads yasnippet-autoloads markdown-mode-autoloads
writegood-mode-autoloads sly-autoloads go-mode-autoloads info
dash-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 eieio eieio-core
password-cache json map byte-opt comp comp-cstr warnings bytecomp
byte-compile rx derived pcase cl-seq cl-macs gv subr-x compile
text-property-search comint ansi-osc ansi-color ring url-vars cl-extra
help-mode icons cl-loaddefs cl-lib 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 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 make-network-process native-compile emacs)

Memory information:
((conses 16 1085291 119447)
 (symbols 48 41414 1)
 (strings 32 191733 12247)
 (string-bytes 1 5822782)
 (vectors 16 109526)
 (vector-slots 8 2681949 80394)
 (floats 8 565 1531)
 (intervals 56 20198 1681)
 (buffers 984 46))