From unknown Sat Aug 16 23:42:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Aug 2024 14:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 72525@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172312840619639 (code B ref -1); Thu, 08 Aug 2024 14:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 Aug 2024 14:46:46 +0000 Received: from localhost ([127.0.0.1]:37039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sc4Pd-00056h-75 for submit@debbugs.gnu.org; Thu, 08 Aug 2024 10:46:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:48372) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sc4Pb-00056Z-1d for submit@debbugs.gnu.org; Thu, 08 Aug 2024 10:46:43 -0400 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 1sc4P9-00061t-Pf for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2024 10:46:16 -0400 Received: from sonic317-26.consmr.mail.bf2.yahoo.com ([74.6.129.81]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sc4P5-00087L-DT for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2024 10:46:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1723128355; bh=Zi1+JP/LmhgL7RE7VCL8NqTcvDjH4xdeUYvLCWXllqk=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=NoM2sQhboORr8uVsCyRBjuh0QHfmkSF/tzWMB2vfhKPme8LJCifPc/VXv6qQ40Siyi1qvefBX5ObyHb8yoGkqh8O68wVu5x+6NAL5Nev4NR1Ij8SGNJp9pIcOGewTRg5uKLGP5l3eAjddRTRp0z0Pxb0z0ss+xAPbPSWy7d86HS1mB4Lk9C/TWJwJXWCD3lfvHAXvGqxfj1YJXpr1+PgflaPkDY+yywYZvUr7lMlV/ISjpKJqgZZFi4Z76746I2xcjysx/sHm7qInU/ZdAOOTfavS1ym5NqZAl9IGBiA5YlbwUPgbeI3X8+AhBXiAXxb1a478OyyNIlph8dPcmCHbg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1723128355; bh=yQ0QpnVqNSUlbFkOb6zM2Wxqu26HOGiP2yX4wsvdLfj=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Mem77yB1YScyIsFzCHxHsqfC/VPy7PhA0DgtEM8tljhhxcVgwMn2ajQWb/8CA37kdSI1kMtDAipClZbMcipL3agKE230ZOUK9aA30H3rpbJ01BUxli/AwDU4TIrZ6VInQemrNW3ooD5JA7LltLM/Sm2lDXpuyG0cFrtHqx0jLSKp9tHascIKMSLCZO9GXwuJL00+5uWEm9oSB8wYLjSHsjRrvVZcFgoT/LrVoRhA7KcusFRE5NBoAOnpdJoMKxdoFJWUME+To++fT/esB1girMASU64/hUydcxzkoMxuaSti6GWZSliGE2zmR8IWphV6xlFZSajdMB7hczsErN86Cw== X-YMail-OSG: f5EBoPwVM1lhrbl3Qj9BTsInaqTf.EP4cHlEWNkE8eqoTYt75aIC08iUcKdPPC2 TlIu1yR.rBVQGvQRv3tKN6.iynFwuLASpWLHar097WgVQHogxTHBKPM9xJJ__bDaJ8EQy896MVf9 v23q4Gf0OkwYA3ODjgzU4ZZjPhwUTxHyaTElx2q.ZVZZCkyROV7ljy.BT0w1ih26JX2bXDbEB0AJ PDGAiBvOYUcfao9XaMTLj0OY2In_Fzxc_fQxdCLD02ktndxJp9k1By2jdUteVOvnJXQ84UXsDyvw QZf3booFyKnxW0LyYfitJnAT9gZu1I.lQ9cxYprud1PYTDuYNgvPhKxAhUf.aEkj_QD3DOftx.R6 u6_T5e3oAGrMm6_fPYD3aK8US2YcWtUJX_idcsjTaiOWA09pEZ0njVEF3N8rvH54LMBjOnEF9CIy wDgnTgqhU5QxrOFrehRZdN1cnEr_7P77qHtTdydMHt3iYb2.mNC4NKb9Oh0uWew3R4Kpx6klxwcW aTW5iATdg_PKFzGJNJvChM.Yk7aGduQUWMSIU428f2IWngtr8ZRaPlbjQT5UuMm8zS2pts8rKCbj rtz3UQrQHFjj2q2gVLe0B5SSjEzflqyjJfiYjq1Ve30Qlw3MVi_zTrLAC_8tgXSjfmljAWPeAFUI gYxf2N_6UGNiR89J4uMDNqZ0GyPk6.pk.JjnPtqL.MKRX1ZTvUJ1armQ5Azbw9YC24_9n_Sq7JYb B5rBbbp82v2W7KrfKBjRvN0IItRtu8pLcq6RZLQxVc3b2VTysrLqbaCbOoIxkb1RyEQEcekZvhHJ px34VnWF5H6XdCEjvCg21qXpnQRr97GuGXxG1cKcLprGXXKtvqi3KDAjsV7KuoXqwu9Fwsou14DK vJykj77pELU_.addPrthj4QCmQtbJPT3Pf_kinJfolnAthOAZOpZ9lTc.B6b7BTHIVNHe.h7raHd ZGFPcXcM1phIWk9D0vmEqht6GMW69qQnQxH_.KohrzEMopXerx4by9Oj3B6Sz5ZC0MTJStkyaUVf 18Y6FgF8G2QndyZS1iwNigzMER7yRK16FglnsPupXk862R0zkReBRXRn63wSdn6cz71SW2se5hmi kT4s_OboytbFOzSwkAojB0gIAuGoohjAvQ6Zu9nn1f6_r_clka88HTeHbdE9lXCWw.ruwcJAVFFL mjlpezav6PE7l6SmIuueBrUCf.C7s1y_f2MqTcPVGXvxXv88j1D3vpgRlaBv4KWqPlTTrsjms94D 3v64YS0CaZSUeOCN1Tl0n4EmFJhIm9FVuz_F_neusBPwxS.DWoo2dDfPIniC.hw0vhrhJtGFzfbX Uu0wsHu5Q6lR4Z4O02FU2PUQ2LAyzjcqxpgKMeEvXBDUviO3b9kAE4lhaeU1QWrVYsboqWWd9d7d CxkOiDVdyamCfQntUGADaM9XCS8sNkvduxF.FkEn0Lvv4mCJ9w9PZWLRWd5LLjrLiiOSRpabuFPa zGH7yMp2tqvmytD.RkIKBNOHxOU6x.HCCVEOI62pZIyLCIwu7l9wJunYYEGMBESsdzmQ_OU9jAS8 edwJH_yKCw6YDndK_kI9xlaeRDVYY.VT_mwOSLzNH4tcl356bQd_63mKjS2B8otlk3Wur7kewIar 2f0hHNCdFrsn6mrgQISswGMY.Dvi1osf_V474M8Ibt8H2xUjf79eSA_Z6fBWvtjdu_GGkreA7QFX ctE3rNbaacZ.Xu3RJkvMzaq1QqRoAbaI1iGiIN7zpqrrBMKS1URxv4DtzrYg6gyfAIjhDCPJtnb4 bfQHHx5rPJZON7SreP4ENcSO10.O57QB42gyGb1Ule5g8wXisQbqWXaEBtdWggamp7j3aEovBf5x folSH4piB5tnK8Sifj0E86RlGRDZqffoF_mfYZin3ZlryuYM72yjF8wNTeeH97Jr8kphPTMnBYs3 MJIljNjAlLOdMyo4K3LQZmHufDy6nJoZ_FuqynBrtCM3ito5z1R0jbqvxKU7MYsieuXYb6XDUnlK Oo1o4Cy0QW5Y7fl5g.fOT94hNSJQSuVuPhj9EtgXRJZebC2UFOYeDU28fjM06y2a_byqm.LhwxzK ZgGM0RjcLtsjvlO1Bm7iyPqugAO.I0WWtrHAzWy65OV_E37SHwIY1GfZ9IB5ZkwbGFS7_O9h4yAT v3TAGLyWhmWb0sP1LKm9QpUM_bw4xxRpuyNa6UNSlxEaVry4C.vQewTeSG4pT.PrEsrr021ySt8H 0ezzZMcAz9N12iSy4rZX5Q0iIDY9ExQ-- X-Sonic-MF: X-Sonic-ID: 11976334-b941-4c96-b9b3-c8eef40e7e7c Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Thu, 8 Aug 2024 14:45:55 +0000 Received: by hermes--production-ir2-6664f499fc-j2js5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 25862a63562059d8a4ebf4931a5927c3; Thu, 08 Aug 2024 14:45:51 +0000 (UTC) From: Ergus Date: Thu, 08 Aug 2024 16:45:42 +0200 Message-ID: <87sevfxecp.fsf@aol.com> MIME-Version: 1.0 Content-Type: text/plain References: <87sevfxecp.fsf.ref@aol.com> X-Mailer: WebService/1.1.22544 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 9020 Received-SPF: pass client-ip=74.6.129.81; envelope-from=spacibba@aol.com; helo=sonic317-26.consmr.mail.bf2.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hi: Using this code: ``` int main() { abort(); /* 1 */ abort(); /* 1 */ } ``` There is an inconsistency in the c++-ts-mode behavior of `forward-sexp`. When there is a comment at the end of the line, if I do `mark-sexp` (C-M-SPC) consecutively I get this selected regions: ----------------------------- 1. abort(); 2. abort(); /* 1 */ 3. abort(); /* 1 */ abort 4. abort(); /* 1 */ abort() 5. abort(); /* 1 */ abort(); 6. abort(); /* 1 */ abort(); /* 1 */ ------------------------------- But when there is NOT trailing comment ``` int main() { abort(); abort(); } ``` ------------------------------- 1. abort(); 2. abort(); abort(); ------------------------------- It looks like in the fist example after 3 the sexp definition is more fine grained (similar to the previous c++-mode behavior) and it selects separately: the function name, the arguments the semicolon the comment But if there is no comment at the end, it always considers the complete line as a sexp (including the ;). For my use case I would prefer the old behavior because it is consistent with the current sexp definition in all emacs (with maybe the exception of python-mode). Because it is easier to copy function names or function calls with a few movements. However, if it is too difficult to reproduce the old behavior; then the new one may be implemented consistently. Best, Ergus In GNU Emacs 31.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-08-07 built on RTX Repository revision: dd93c32c82c65f7c7b26e8c7a8e4fa8425cdbfe0 Repository branch: project System Description: Arch Linux Configured using: 'configure --prefix=/home/ergo/.local/ --with-mailutils --with-pgtk --with-modules --with-cairo --with-harfbuzz --with-native-compilation=aot '--program-transform-name=s/^ctags$/ctags.emacs/'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 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 $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: C++// Minor modes in effect: fancy-compilation-mode: t global-auto-revert-mode: t electric-pair-mode: t whitespace-mode: t flyspell-mode: t completion-preview-mode: t diff-hl-margin-local-mode: t diff-hl-margin-mode: t diff-hl-mode: t corfu-terminal-mode: t global-corfu-mode: t corfu-mode: t project-multi-mode: t gtags-mode: t repeat-mode: t xterm-mouse-mode: t xclip-mode: t override-global-mode: t winner-mode: t save-place-mode: t delete-selection-mode: t savehist-mode: t global-display-fill-column-indicator-mode: t display-fill-column-indicator-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t which-key-mode: t show-paren-mode: t mouse-wheel-mode: t file-name-shadow-mode: t context-menu-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t size-indication-mode: t column-number-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: /mnt/casa/gits/emacs_clones/cuda-mode/cuda-mode hides /home/ergo/.config/emacs/elpa/cuda-mode-20240716.1936/cuda-mode /mnt/casa/gits/emacs_clones/gtags-mode/gtags-mode hides /home/ergo/.config/emacs/elpa/gtags-mode-1.8/gtags-mode /home/ergo/.config/emacs/elpa/transient-20240805.1231/transient hides /home/ergo/.local/share/emacs/31.0.50/lisp/transient Features: (shadow sort mail-extr fancy-compilation compile comint ansi-osc ansi-color comp-run comp-common emacsbug message mailcap yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils autorevert filenotify ffap thingatpt url-parse auth-source eieio eieio-core icons password-cache json map url-vars elec-pair whitespace flyspell-correct flyspell ispell completion-preview diff-hl-margin diff-hl-dired citre-lang-fileref citre-tags citre-ctags citre-readtags citre-readtags-tables citre-backend-interface citre-common-tag rx citre-common-util dired-x dired dired-loaddefs diff-hl log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode track-changes corfu-terminal popon corfu project-multi-mode gtags-mode cl-macs files-x xref project c++-ts-mode c-ts-mode c-ts-common term/tmux term/xterm xterm init repeat markdown-ts-mode subr-x treesit cape compat use-package-ensure use-package-diminish xt-mouse xclip edmacro kmacro byte-opt gv use-package-bind-key bind-key cl-extra help-mode simple-16-theme winner ring saveplace delsel savehist easy-mmode display-fill-column-indicator display-line-numbers diminish which-key cl-seq use-package-core cl-loaddefs cl-lib bytecomp byte-compile disp-table info 0blayout-autoloads ac-emoji-autoloads ac-haskell-process-autoloads ac-html-autoloads arduino-cli-mode-autoloads auctex-autoloads tex-site auto-complete-autoloads avy-zap-autoloads avy-autoloads better-shell-autoloads caml-autoloads cape-autoloads citre-autoloads clang-format-autoloads cobol-mode-autoloads compile-multi-autoloads corfu-terminal-autoloads corfu-autoloads crdt-autoloads csv-mode-autoloads cuda-mode-autoloads d-mode-autoloads deadgrep-autoloads debbugs-autoloads diff-hl-autoloads diminish-autoloads dired-sidebar-autoloads dired-subtree-autoloads dired-hacks-utils-autoloads dumb-jump-autoloads e2ansi-autoloads emamux-autoloads esup-autoloads evil-collection-autoloads annalist-autoloads evil-leader-autoloads evil-autoloads face-explorer-autoloads fancy-compilation-autoloads flx-autoloads flycheck-julia-autoloads flycheck-rust-autoloads flycheck-autoloads flymake-nasm-autoloads flymake-quickdef-autoloads flyspell-correct-autoloads git-modes-autoloads git-timemachine-autoloads gnuplot-autoloads google-c-style-autoloads goto-chg-autoloads groovy-mode-autoloads gtags-mode-autoloads haskell-mode-autoloads highlight-indent-guides-autoloads i3wm-config-mode-autoloads ibuffer-sidebar-autoloads iedit-autoloads imenu-list-autoloads julia-ts-mode-autoloads julia-mode-autoloads languagetool-autoloads lice-autoloads lorem-ipsum-autoloads lua-mode-autoloads magit-autoloads git-commit-autoloads magit-section-autoloads markdown-mode-autoloads markdown-ts-mode-autoloads modern-cpp-font-lock-autoloads move-dup-autoloads multiple-cursors-autoloads mutt-mode-autoloads nasm-mode-autoloads neotree-autoloads nftables-mode-autoloads nginx-mode-autoloads notmuch-autoloads objed-autoloads opencl-mode-autoloads paradox-autoloads phi-search-autoloads pkg-info-autoloads epl-autoloads pkgbuild-mode-autoloads platformio-mode-autoloads async-autoloads popon-autoloads popup-autoloads projectile-autoloads projection-autoloads protobuf-mode-autoloads protobuf-ts-mode-autoloads ptemplate-templates-autoloads ptemplate-autoloads scopeline-autoloads shell-command+-autoloads slime-autoloads macrostep-autoloads sphinx-mode-autoloads f-autoloads dash-autoloads s-autoloads spinner-autoloads ssh-config-mode-autoloads string-inflection-autoloads sudo-edit-autoloads systemd-autoloads tmux-mode-autoloads transient-autoloads tsc-autoloads urgrep-autoloads vdiff-autoloads hydra-autoloads lv-autoloads vterm-toggle-autoloads vterm-autoloads vundo-autoloads with-editor-autoloads xclip-autoloads yasnippet-snippets-autoloads yasnippet-autoloads early-init 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 185298 34784) (symbols 48 15017 0) (strings 32 50296 12386) (string-bytes 1 1766229) (vectors 16 19239) (vector-slots 8 220612 9451) (floats 8 95 112) (intervals 56 967 0) (buffers 992 13)) From unknown Sat Aug 16 23:42:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Aug 2024 07:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ergus , Yuan Fu Cc: 72525@debbugs.gnu.org Received: via spool by 72525-submit@debbugs.gnu.org id=B72525.172327664823600 (code B ref 72525); Sat, 10 Aug 2024 07:58:01 +0000 Received: (at 72525) by debbugs.gnu.org; 10 Aug 2024 07:57:28 +0000 Received: from localhost ([127.0.0.1]:38998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scgye-00068a-0p for submit@debbugs.gnu.org; Sat, 10 Aug 2024 03:57:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1scgyc-00068G-Ae for 72525@debbugs.gnu.org; Sat, 10 Aug 2024 03:57:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scgy3-0002aM-Vv; Sat, 10 Aug 2024 03:56:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zzYAI755ClxGbDPPhEcuxLihuiEhVj3MqCRYfEtWIJ0=; b=prZbEgd0ZujO AuxtB71CBxHpygx3dselcEwPadBs4h1+MIKAjWOaChYNy3wq+xFWdMKXTFVTEMDpaZE64iP6KzBB5 Io0w2K2PPzCjnW8KckNStctRiZ06OhBL+//ucPIMFOQoPIw7pfHm5iglkGW/tJ90pc/lgD+Xy4nTZ s2wmP3CwWmvU4Doi3TefItNCuXCJ+JPu/36ufCz5Yj7wSLEw+9C6KOsKdIwNl9NuggrgldaLRvjcG nivNkAohyXQAEIz9hXFoEtLexCAcrFSK9WpsFutJScNvNrIQKJ7kb+TwMCcsxzBsUJxOTTaBBJKlE SHtRCemqrPQLWu6pPW8BEw==; Date: Sat, 10 Aug 2024 10:56:48 +0300 Message-Id: <86le14kdz3.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87sevfxecp.fsf@aol.com> (bug-gnu-emacs@gnu.org) References: <87sevfxecp.fsf.ref@aol.com> <87sevfxecp.fsf@aol.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 08 Aug 2024 16:45:42 +0200 > From: Ergus via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > > Hi: > > Using this code: > > ``` > int main() > { > abort(); /* 1 */ > abort(); /* 1 */ > } > ``` > > There is an inconsistency in the c++-ts-mode behavior of `forward-sexp`. > > When there is a comment at the end of the line, if I do `mark-sexp` > (C-M-SPC) consecutively I get this selected regions: > > ----------------------------- > 1. > abort(); > > 2. > abort(); /* 1 */ > > 3. > abort(); /* 1 */ > abort > > 4. > abort(); /* 1 */ > abort() > > 5. > abort(); /* 1 */ > abort(); > > 6. > abort(); /* 1 */ > abort(); /* 1 */ > > ------------------------------- > > > > But when there is NOT trailing comment > > ``` > int main() > { > abort(); > abort(); > } > ``` > > ------------------------------- > 1. > abort(); > > 2. > abort(); > abort(); > ------------------------------- > > > It looks like in the fist example after 3 the sexp definition is more fine > grained (similar to the previous c++-mode behavior) and it selects > separately: > the function name, > the arguments > the semicolon > the comment > > But if there is no comment at the end, it always considers the complete > line as a sexp (including the ;). > > For my use case I would prefer the old behavior because it is consistent > with the current sexp definition in all emacs (with maybe the exception > of python-mode). Because it is easier to copy function names or > function calls with a few movements. > > However, if it is too difficult to reproduce the old behavior; then the > new one may be implemented consistently. Yuan, any comments or suggestions? FWIW, I'm not sure this is a bug: what constitutes a "sexp" in C++ source code is not well-defined. From unknown Sat Aug 16 23:42:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Aug 2024 05:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Ergus , 72525@debbugs.gnu.org Received: via spool by 72525-submit@debbugs.gnu.org id=B72525.172335311329524 (code B ref 72525); Sun, 11 Aug 2024 05:12:01 +0000 Received: (at 72525) by debbugs.gnu.org; 11 Aug 2024 05:11:53 +0000 Received: from localhost ([127.0.0.1]:40559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd0rx-0007g8-Dn for submit@debbugs.gnu.org; Sun, 11 Aug 2024 01:11:53 -0400 Received: from mail-oi1-f169.google.com ([209.85.167.169]:57547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd0rt-0007ft-Uv for 72525@debbugs.gnu.org; Sun, 11 Aug 2024 01:11:52 -0400 Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3d9e13ef8edso2463421b6e.2 for <72525@debbugs.gnu.org>; Sat, 10 Aug 2024 22:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723353014; x=1723957814; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QezJ5E3PoEhoQ09IKOZByl5iGZ9RuhXRbq94sxCtrVM=; b=LmdRjW0UqsmupgPqSzxQGZ0MXP3bTeFyZp+oK2ihAWFUw865ZXcYGPu52F5OIeFmuC D5luv9IHoT1dtkG/D/TPz4zyFv1CebhC0DhB435Fgz078d2ekvWCfdUYn+NvJ5qi41Xk GUUApade4yHaLgRghLw6BoG2DwQsv0kGr/ql1ztIZl2AwyrutDC9WTwKA0SKBxV2GZD5 IhJSFITXECxubGfgmkAfYSP2ufh3eBjKBb5w3P3QNgTbp90fK9vgXKjU0PBWuarKrCVO 8yhNPa5hoDUtAOMjiWyUKs5OpQmxaEosHJDAVlZHOWzoUVHaBlo0emWBb7r5X/TfuIeE WfRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723353014; x=1723957814; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QezJ5E3PoEhoQ09IKOZByl5iGZ9RuhXRbq94sxCtrVM=; b=GAVkIEpk2XnyC66l3d5OyjElL1ndsihC1aMwYLv8xLymhzTHFS4J4ARj1RS/oJmAqR Kf4FclHAg+rsM8yWzPLlWI3kBiYk2jpvujCfN/NJh/pRuyIVD7e9+jnB5AlSxPnO3V50 1fcrWBAhLG1XVrhmJdSXYvpNx4njIrdaNfRdGaUi7TgTL7d5frYuOmrrKZYW91V3t/Ff iEyuCPk1aPyEMnpKU89y6TOePc0EavKhZ11gLUX/YFT42YYrJHcmyUMBE4S7wZx7OvwQ Nr6VGw5HwEqWRDrjMiaXqfoDVRx350swM2OvV5aXuJ51wkccmyWfyK9B6aSNJ4nZBqMf q/iA== X-Forwarded-Encrypted: i=1; AJvYcCWU8eC4wPamnFIxpkmQFCngZjgULppL6npMBnkzx4wlOFnGjQ3J+/c4+Vs3bBGhZJOuQjta2bz9UDnu7TXYpJ414OOCqcs= X-Gm-Message-State: AOJu0YyNHIuOQyoJL5xMFfGckz1yKQVRcvRTIGs3tjilDBfZL3LW3ms8 a0SH4OwI7w849vCl+Y2PawU9QCxnpdgqDvyjqIX0+jFf0aqaJm+7 X-Google-Smtp-Source: AGHT+IFCt1sWHpRdT/IiArqS43MdTh+DHnMKH2iSlP1pn0flg7nIpG46wmLsaBuoP/437AMW6ugIBw== X-Received: by 2002:a05:6808:188c:b0:3d9:245c:4224 with SMTP id 5614622812f47-3dc416da6eamr8465435b6e.40.1723353013835; Sat, 10 Aug 2024 22:10:13 -0700 (PDT) Received: from smtpclient.apple ([2601:646:8f81:6120:313a:c2af:d5cc:6671]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-710e5ac36f7sm1903614b3a.212.2024.08.10.22.10.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Aug 2024 22:10:13 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) From: Yuan Fu In-Reply-To: <86le14kdz3.fsf@gnu.org> Date: Sat, 10 Aug 2024 22:10:01 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <83A0F72A-F41C-4965-8648-9E3C2DDA2BF7@gmail.com> References: <87sevfxecp.fsf.ref@aol.com> <87sevfxecp.fsf@aol.com> <86le14kdz3.fsf@gnu.org> X-Mailer: Apple Mail (2.3774.600.62) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Aug 10, 2024, at 12:56=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> Date: Thu, 08 Aug 2024 16:45:42 +0200 >> From: Ergus via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >>=20 >>=20 >> Hi: >>=20 >> Using this code: >>=20 >> ``` >> int main() >> { >> abort(); /* 1 */ >> abort(); /* 1 */ >> } >> ``` >>=20 >> There is an inconsistency in the c++-ts-mode behavior of = `forward-sexp`. >>=20 >> When there is a comment at the end of the line, if I do `mark-sexp` >> (C-M-SPC) consecutively I get this selected regions: >>=20 >> ----------------------------- >> 1. >> abort(); >>=20 >> 2. >> abort(); /* 1 */ >>=20 >> 3. >> abort(); /* 1 */ >> abort >>=20 >> 4. >> abort(); /* 1 */ >> abort() >>=20 >> 5. >> abort(); /* 1 */ >> abort(); >>=20 >> 6. >> abort(); /* 1 */ >> abort(); /* 1 */ >>=20 >> ------------------------------- >>=20 >>=20 >>=20 >> But when there is NOT trailing comment >>=20 >> ``` >> int main() >> { >> abort(); >> abort(); >> } >> ``` >>=20 >> ------------------------------- >> 1. >> abort(); >>=20 >> 2. >> abort(); >> abort(); >> ------------------------------- >>=20 >>=20 >> It looks like in the fist example after 3 the sexp definition is more = fine >> grained (similar to the previous c++-mode behavior) and it selects >> separately: >> the function name, >> the arguments >> the semicolon >> the comment >>=20 >> But if there is no comment at the end, it always considers the = complete >> line as a sexp (including the ;). >>=20 >> For my use case I would prefer the old behavior because it is = consistent >> with the current sexp definition in all emacs (with maybe the = exception >> of python-mode). Because it is easier to copy function names or >> function calls with a few movements. >>=20 >> However, if it is too difficult to reproduce the old behavior; then = the >> new one may be implemented consistently. >=20 > Yuan, any comments or suggestions? >=20 > FWIW, I'm not sure this is a bug: what constitutes a "sexp" in C++ > source code is not well-defined. Yeah I=E2=80=99ll look into this. And yeah there were some discussion = around how should we define sexp in c++-ts-mode but there wasn=E2=80=99t = a concrete conclusion (I don=E2=80=99t think it=E2=80=99s possible to = come up with a concrete one anyway.) Still, if it can be made more = convenient for common use-cases I=E2=80=99m more than happy to improve = it. Just be aware that I=E2=80=99ll be super busy next week (and I still = haven=E2=80=99t done the parse string feature) so it might take me a = while to get back. Yuan= From unknown Sat Aug 16 23:42:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Aug 2024 08:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: spacibba@aol.com, 72525@debbugs.gnu.org Received: via spool by 72525-submit@debbugs.gnu.org id=B72525.172448815126703 (code B ref 72525); Sat, 24 Aug 2024 08:30:02 +0000 Received: (at 72525) by debbugs.gnu.org; 24 Aug 2024 08:29:11 +0000 Received: from localhost ([127.0.0.1]:40416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shm91-0006wc-9u for submit@debbugs.gnu.org; Sat, 24 Aug 2024 04:29:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1shm8z-0006wL-8G for 72525@debbugs.gnu.org; Sat, 24 Aug 2024 04:29:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1shm87-0006S3-EC; Sat, 24 Aug 2024 04:28:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=IxI0ItUvUrU8Yv26rv0Y8mcw0HgLY4QKBLEmGEneoQM=; b=NxgkF6j+tUSsxbVvUgZQ wxRlcWOFqVHJwA2GLZUVNGTCMdrjKL4hVKjuX0/x3jlIs/fSZ2DFDihj1z9rfnIHAsf+HznutXtKD qtSAhxngKEN/4+ssgUPpX7Ma2Kw2nfnW4YSpXh54mfm+6cHlW/zmSCjidImTR1nqJwQqOzF7IafzC SeEu85CtHqc2l48kYYURXyXJXf2FJFvmE3j8/miNvsjZO2r3Ba2K/CaCeKOHbH+j6eeB4KBGnqABM o4Ok4x1AUaT04QrBaDo6WGN6CpIKpkflr2Hkp7JaaBxS5i3JTaQ/mHfvhoWHl/XonxRkQ2Hytyn1t 9A19FSf+BkrAzw==; Date: Sat, 24 Aug 2024 11:28:12 +0300 Message-Id: <86le0mnx43.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <83A0F72A-F41C-4965-8648-9E3C2DDA2BF7@gmail.com> (message from Yuan Fu on Sat, 10 Aug 2024 22:10:01 -0700) References: <87sevfxecp.fsf.ref@aol.com> <87sevfxecp.fsf@aol.com> <86le14kdz3.fsf@gnu.org> <83A0F72A-F41C-4965-8648-9E3C2DDA2BF7@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Any progress with this? > From: Yuan Fu > Date: Sat, 10 Aug 2024 22:10:01 -0700 > Cc: Ergus , > 72525@debbugs.gnu.org > > > > > On Aug 10, 2024, at 12:56 AM, Eli Zaretskii wrote: > > > >> Date: Thu, 08 Aug 2024 16:45:42 +0200 > >> From: Ergus via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" > >> > >> > >> Hi: > >> > >> Using this code: > >> > >> ``` > >> int main() > >> { > >> abort(); /* 1 */ > >> abort(); /* 1 */ > >> } > >> ``` > >> > >> There is an inconsistency in the c++-ts-mode behavior of `forward-sexp`. > >> > >> When there is a comment at the end of the line, if I do `mark-sexp` > >> (C-M-SPC) consecutively I get this selected regions: > >> > >> ----------------------------- > >> 1. > >> abort(); > >> > >> 2. > >> abort(); /* 1 */ > >> > >> 3. > >> abort(); /* 1 */ > >> abort > >> > >> 4. > >> abort(); /* 1 */ > >> abort() > >> > >> 5. > >> abort(); /* 1 */ > >> abort(); > >> > >> 6. > >> abort(); /* 1 */ > >> abort(); /* 1 */ > >> > >> ------------------------------- > >> > >> > >> > >> But when there is NOT trailing comment > >> > >> ``` > >> int main() > >> { > >> abort(); > >> abort(); > >> } > >> ``` > >> > >> ------------------------------- > >> 1. > >> abort(); > >> > >> 2. > >> abort(); > >> abort(); > >> ------------------------------- > >> > >> > >> It looks like in the fist example after 3 the sexp definition is more fine > >> grained (similar to the previous c++-mode behavior) and it selects > >> separately: > >> the function name, > >> the arguments > >> the semicolon > >> the comment > >> > >> But if there is no comment at the end, it always considers the complete > >> line as a sexp (including the ;). > >> > >> For my use case I would prefer the old behavior because it is consistent > >> with the current sexp definition in all emacs (with maybe the exception > >> of python-mode). Because it is easier to copy function names or > >> function calls with a few movements. > >> > >> However, if it is too difficult to reproduce the old behavior; then the > >> new one may be implemented consistently. > > > > Yuan, any comments or suggestions? > > > > FWIW, I'm not sure this is a bug: what constitutes a "sexp" in C++ > > source code is not well-defined. > > Yeah I’ll look into this. And yeah there were some discussion around how should we define sexp in c++-ts-mode but there wasn’t a concrete conclusion (I don’t think it’s possible to come up with a concrete one anyway.) Still, if it can be made more convenient for common use-cases I’m more than happy to improve it. Just be aware that I’ll be super busy next week (and I still haven’t done the parse string feature) so it might take me a while to get back. > > Yuan From unknown Sat Aug 16 23:42:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Aug 2024 02:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72525 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Ergus , 72525@debbugs.gnu.org Received: via spool by 72525-submit@debbugs.gnu.org id=B72525.172472736310831 (code B ref 72525); Tue, 27 Aug 2024 02:57:01 +0000 Received: (at 72525) by debbugs.gnu.org; 27 Aug 2024 02:56:03 +0000 Received: from localhost ([127.0.0.1]:45744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1simNG-0002oc-Vf for submit@debbugs.gnu.org; Mon, 26 Aug 2024 22:56:03 -0400 Received: from mail-pl1-f176.google.com ([209.85.214.176]:55709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1simNF-0002o6-9D for 72525@debbugs.gnu.org; Mon, 26 Aug 2024 22:56:02 -0400 Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-202146e9538so44516645ad.3 for <72525@debbugs.gnu.org>; Mon, 26 Aug 2024 19:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724727243; x=1725332043; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dNjNfLYX1v5nLuBrsxkYWLSo5F47B47APhSKCaOXtck=; b=Gak4D9F7qiNDzskuXn2Wpmb81ZXEtkbYeUVMuEhLMzXLWooNchh8ourb8bV5b7m3jP f/9LecdYkIwf8duVvR3Xk2lHzIU/Qof0TJ54u3sbbYgv3yxxGa0qHuM4CPiH9m6yRMTP wWiL5G+bfhAy197Uxg9VQzK+OzInjovZDqGnKXdlCoKmPR2lYkDfV9QR6J/tAUsBSTBI ban+t6BuzdGwk7lGiHHv6a45ezbPHrlW3MRFjC5zSgBU5ubVsxi92+j4m7wuASunmDWS nW1NNprU5zYvVG2OHhP2xD9rOs4SUd7anMXowZJE/A2b43Iex+2YJz4SLlrHGZ/mtm6V o4KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724727243; x=1725332043; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dNjNfLYX1v5nLuBrsxkYWLSo5F47B47APhSKCaOXtck=; b=UbiKfZJzwRwM4Dwqtw6i4s6cI7NYPgHY8ONvyXBQcXWT+1AsZWUv06LIfIDs6HG12a ZxUe7E3HvngKIFToNhXo+W/w2ZDsf+g6PEdRcxP4iyFSQVo7UbAnaE4vRHfE3qNr/j13 iU+Nw809XvnaQOHLvA7m8rm++8B2b/OepFwKIzsgjhloIs9IHqlJCEzYMFm9fb1x+d3h ySD7vgH8XnKt8V2Fbj4LUEFhWgGwp9QlD8Ljd5HIau9cbSEdW8t2MCzoej5d1W299Tk9 /7UxTvv/ArOBlZ/VGB5NVBycUiVJFJ+HeArHXwpBDM92ugQW98VppsGU0qAhFgYrflSW lQ2Q== X-Forwarded-Encrypted: i=1; AJvYcCUL3zp+psIQanCVnx1cOFSJ2dVIXUcK6Xzk/SG1M+B+lEd6ifdaazhG/soQlcTRRu2CslEenA==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yzt5bAx+cZiJaEnigLhshXaUDTNWqTC2UbN0yZH+ipaI25zZ8qm FrVu1c/C07vHO2mKZSzjvkzCnd5mFPu8qzr9WtfSPJ/UgLewvWuy X-Google-Smtp-Source: AGHT+IGPTfL61VqlozeOS4+9cA/ScLo6RfKQMU06bUzF4USAF/hrcDmy5ZZXqZMGOtVx+0WinxHnRw== X-Received: by 2002:a17:902:d489:b0:202:bc3:3e6e with SMTP id d9443c01a7336-2039e4a778dmr93992105ad.33.1724727243013; Mon, 26 Aug 2024 19:54:03 -0700 (PDT) Received: from smtpclient.apple ([2601:646:8f81:6120:fd58:c8a8:ed8f:39fa]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-203855811fcsm73812695ad.103.2024.08.26.19.54.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2024 19:54:02 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) From: Yuan Fu In-Reply-To: <86le0mnx43.fsf@gnu.org> Date: Mon, 26 Aug 2024 19:53:51 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <87sevfxecp.fsf.ref@aol.com> <87sevfxecp.fsf@aol.com> <86le14kdz3.fsf@gnu.org> <83A0F72A-F41C-4965-8648-9E3C2DDA2BF7@gmail.com> <86le0mnx43.fsf@gnu.org> X-Mailer: Apple Mail (2.3776.700.51) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Aug 24, 2024, at 1:28=E2=80=AFAM, Eli Zaretskii = wrote: >=20 > Ping! Any progress with this? >=20 >> From: Yuan Fu >> Date: Sat, 10 Aug 2024 22:10:01 -0700 >> Cc: Ergus , >> 72525@debbugs.gnu.org >>=20 >>=20 >>=20 >>> On Aug 10, 2024, at 12:56=E2=80=AFAM, Eli Zaretskii = wrote: >>>=20 >>>> Date: Thu, 08 Aug 2024 16:45:42 +0200 >>>> From: Ergus via "Bug reports for GNU Emacs, >>>> the Swiss army knife of text editors" >>>>=20 >>>>=20 >>>> Hi: >>>>=20 >>>> Using this code: >>>>=20 >>>> ``` >>>> int main() >>>> { >>>> abort(); /* 1 */ >>>> abort(); /* 1 */ >>>> } >>>> ``` >>>>=20 >>>> There is an inconsistency in the c++-ts-mode behavior of = `forward-sexp`. >>>>=20 >>>> When there is a comment at the end of the line, if I do `mark-sexp` >>>> (C-M-SPC) consecutively I get this selected regions: >>>>=20 >>>> ----------------------------- >>>> 1. >>>> abort(); >>>>=20 >>>> 2. >>>> abort(); /* 1 */ >>>>=20 >>>> 3. >>>> abort(); /* 1 */ >>>> abort >>>>=20 >>>> 4. >>>> abort(); /* 1 */ >>>> abort() >>>>=20 >>>> 5. >>>> abort(); /* 1 */ >>>> abort(); >>>>=20 >>>> 6. >>>> abort(); /* 1 */ >>>> abort(); /* 1 */ >>>>=20 >>>> ------------------------------- >>>>=20 >>>>=20 >>>>=20 >>>> But when there is NOT trailing comment >>>>=20 >>>> ``` >>>> int main() >>>> { >>>> abort(); >>>> abort(); >>>> } >>>> ``` >>>>=20 >>>> ------------------------------- >>>> 1. >>>> abort(); >>>>=20 >>>> 2. >>>> abort(); >>>> abort(); >>>> ------------------------------- >>>>=20 >>>>=20 >>>> It looks like in the fist example after 3 the sexp definition is = more fine >>>> grained (similar to the previous c++-mode behavior) and it selects >>>> separately: >>>> the function name, >>>> the arguments >>>> the semicolon >>>> the comment >>>>=20 >>>> But if there is no comment at the end, it always considers the = complete >>>> line as a sexp (including the ;). >>>>=20 >>>> For my use case I would prefer the old behavior because it is = consistent >>>> with the current sexp definition in all emacs (with maybe the = exception >>>> of python-mode). Because it is easier to copy function names or >>>> function calls with a few movements. >>>>=20 >>>> However, if it is too difficult to reproduce the old behavior; then = the >>>> new one may be implemented consistently. >>>=20 >>> Yuan, any comments or suggestions? >>>=20 >>> FWIW, I'm not sure this is a bug: what constitutes a "sexp" in C++ >>> source code is not well-defined. >>=20 >> Yeah I=E2=80=99ll look into this. And yeah there were some discussion = around how should we define sexp in c++-ts-mode but there wasn=E2=80=99t = a concrete conclusion (I don=E2=80=99t think it=E2=80=99s possible to = come up with a concrete one anyway.) Still, if it can be made more = convenient for common use-cases I=E2=80=99m more than happy to improve = it. Just be aware that I=E2=80=99ll be super busy next week (and I still = haven=E2=80=99t done the parse string feature) so it might take me a = while to get back. >>=20 >> Yuan I know the reason for the inconsistency now. Treesit-forward-sexp first = checks whether point is in a =E2=80=9Ctext=E2=80=9D node, ie, comment or = string; if so, it uses the default/normal forward-sexp function; if not, = it uses the parse tree to go over sexp. In the first example, because there=E2=80=99s a comment right before = point, treesit-forward-sexp thinks it=E2=80=99s in a text node, and used = the normal forward-sexp function, which moved point after the next = symbol. In the second example, because there=E2=80=99s no comment anymore, = treesit-forward-sexp uses the parse tree to move the point; and since = the next node after point is the statement line, it moves point over the = whole line. When using the parse tree to move point, = treesit-forward-sexp always moves in the same =E2=80=9Clevel=E2=80=9D in = which that point is. Eg, when point is between two lines, = treesit-forward-sexp moves over lines; if point is inside an argument = list between two arguments, treesit-forward-sexp moves over each = argument. If you want to just select the identifier or other more fine-grained = movement, IMHO it=E2=80=99s probably better to use forward-word. I fixed the inconsistency so now treesit-forward-sexp in both example = moves over the whole line. The fix is pushed to emacs-30. Yuan= From unknown Sat Aug 16 23:42:32 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ergus Subject: bug#72525: closed (Re: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode) Message-ID: References: <86a5gjzzhx.fsf@gnu.org> <87sevfxecp.fsf@aol.com> X-Gnu-PR-Message: they-closed 72525 X-Gnu-PR-Package: emacs Reply-To: 72525@debbugs.gnu.org Date: Sat, 07 Sep 2024 07:37:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1725694623-5514-1" This is a multi-part message in MIME format... ------------=_1725694623-5514-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 72525@debbugs.gnu.org. --=20 72525: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72525 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1725694623-5514-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 72525-done) by debbugs.gnu.org; 7 Sep 2024 07:36:51 +0000 Received: from localhost ([127.0.0.1]:54707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smq03-0001QR-3R for submit@debbugs.gnu.org; Sat, 07 Sep 2024 03:36:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smq01-0001QD-DD for 72525-done@debbugs.gnu.org; Sat, 07 Sep 2024 03:36:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smpzv-0007iP-KR; Sat, 07 Sep 2024 03:36:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=syYlE/ixnGHhtnMKdHY0rZ6QehUYfi5563WWHfJsJ/k=; b=kh24Rir0wY0/fQ5EOLN1 7N9JINsSv9meo7b9EAU5UIrTo4Do9Z923f9Xy63wBdLuCAoJ35SEiRw484jtlbfJF0ykxTTgU6Qgw SH6Edby4iQRcOMP6FxSE+qQCzRxrqIUt5XKCegYIAKkwCQ0UfLyvhqbGrB1So1oN0TnX6kIfABE0J npyNOyOOeEoYYcq8/lS5w/LR3idh24wRUKpGaCxGymWXz0JODhfYaqVANQYj1nKv15OxbVtAVNGWS nFmyntRzsB1PhedQDGyeUzxJBUa30+f+Hh2uCV4HSKaY1xGiKJNlgngcpgzbV2HFuYxFVH3wMRO2r 9wZ/xE0W3RcchQ==; Date: Sat, 07 Sep 2024 10:36:42 +0300 Message-Id: <86a5gjzzhx.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: (message from Yuan Fu on Mon, 26 Aug 2024 19:53:51 -0700) Subject: Re: bug#72525: 31.0.50; Forward sexp inconsistency issue c++-ts-mode References: <87sevfxecp.fsf.ref@aol.com> <87sevfxecp.fsf@aol.com> <86le14kdz3.fsf@gnu.org> <83A0F72A-F41C-4965-8648-9E3C2DDA2BF7@gmail.com> <86le0mnx43.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72525-done Cc: spacibba@aol.com, 72525-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Mon, 26 Aug 2024 19:53:51 -0700 > Cc: Ergus , > 72525@debbugs.gnu.org > > > > > On Aug 24, 2024, at 1:28 AM, Eli Zaretskii wrote: > > > > Ping! Any progress with this? > > > >> From: Yuan Fu > >> Date: Sat, 10 Aug 2024 22:10:01 -0700 > >> Cc: Ergus , > >> 72525@debbugs.gnu.org > >> > >> > >> > >>> On Aug 10, 2024, at 12:56 AM, Eli Zaretskii wrote: > >>> > >>>> Date: Thu, 08 Aug 2024 16:45:42 +0200 > >>>> From: Ergus via "Bug reports for GNU Emacs, > >>>> the Swiss army knife of text editors" > >>>> > >>>> > >>>> Hi: > >>>> > >>>> Using this code: > >>>> > >>>> ``` > >>>> int main() > >>>> { > >>>> abort(); /* 1 */ > >>>> abort(); /* 1 */ > >>>> } > >>>> ``` > >>>> > >>>> There is an inconsistency in the c++-ts-mode behavior of `forward-sexp`. > >>>> > >>>> When there is a comment at the end of the line, if I do `mark-sexp` > >>>> (C-M-SPC) consecutively I get this selected regions: > >>>> > >>>> ----------------------------- > >>>> 1. > >>>> abort(); > >>>> > >>>> 2. > >>>> abort(); /* 1 */ > >>>> > >>>> 3. > >>>> abort(); /* 1 */ > >>>> abort > >>>> > >>>> 4. > >>>> abort(); /* 1 */ > >>>> abort() > >>>> > >>>> 5. > >>>> abort(); /* 1 */ > >>>> abort(); > >>>> > >>>> 6. > >>>> abort(); /* 1 */ > >>>> abort(); /* 1 */ > >>>> > >>>> ------------------------------- > >>>> > >>>> > >>>> > >>>> But when there is NOT trailing comment > >>>> > >>>> ``` > >>>> int main() > >>>> { > >>>> abort(); > >>>> abort(); > >>>> } > >>>> ``` > >>>> > >>>> ------------------------------- > >>>> 1. > >>>> abort(); > >>>> > >>>> 2. > >>>> abort(); > >>>> abort(); > >>>> ------------------------------- > >>>> > >>>> > >>>> It looks like in the fist example after 3 the sexp definition is more fine > >>>> grained (similar to the previous c++-mode behavior) and it selects > >>>> separately: > >>>> the function name, > >>>> the arguments > >>>> the semicolon > >>>> the comment > >>>> > >>>> But if there is no comment at the end, it always considers the complete > >>>> line as a sexp (including the ;). > >>>> > >>>> For my use case I would prefer the old behavior because it is consistent > >>>> with the current sexp definition in all emacs (with maybe the exception > >>>> of python-mode). Because it is easier to copy function names or > >>>> function calls with a few movements. > >>>> > >>>> However, if it is too difficult to reproduce the old behavior; then the > >>>> new one may be implemented consistently. > >>> > >>> Yuan, any comments or suggestions? > >>> > >>> FWIW, I'm not sure this is a bug: what constitutes a "sexp" in C++ > >>> source code is not well-defined. > >> > >> Yeah I’ll look into this. And yeah there were some discussion around how should we define sexp in c++-ts-mode but there wasn’t a concrete conclusion (I don’t think it’s possible to come up with a concrete one anyway.) Still, if it can be made more convenient for common use-cases I’m more than happy to improve it. Just be aware that I’ll be super busy next week (and I still haven’t done the parse string feature) so it might take me a while to get back. > >> > >> Yuan > > I know the reason for the inconsistency now. Treesit-forward-sexp first checks whether point is in a “text” node, ie, comment or string; if so, it uses the default/normal forward-sexp function; if not, it uses the parse tree to go over sexp. > > In the first example, because there’s a comment right before point, treesit-forward-sexp thinks it’s in a text node, and used the normal forward-sexp function, which moved point after the next symbol. > > In the second example, because there’s no comment anymore, treesit-forward-sexp uses the parse tree to move the point; and since the next node after point is the statement line, it moves point over the whole line. When using the parse tree to move point, treesit-forward-sexp always moves in the same “level” in which that point is. Eg, when point is between two lines, treesit-forward-sexp moves over lines; if point is inside an argument list between two arguments, treesit-forward-sexp moves over each argument. > > If you want to just select the identifier or other more fine-grained movement, IMHO it’s probably better to use forward-word. > > I fixed the inconsistency so now treesit-forward-sexp in both example moves over the whole line. The fix is pushed to emacs-30. Thanks. No further comments, so I assume the bug is fixed, and I'm therefore closing it. ------------=_1725694623-5514-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 8 Aug 2024 14:46:46 +0000 Received: from localhost ([127.0.0.1]:37039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sc4Pd-00056h-75 for submit@debbugs.gnu.org; Thu, 08 Aug 2024 10:46:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:48372) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sc4Pb-00056Z-1d for submit@debbugs.gnu.org; Thu, 08 Aug 2024 10:46:43 -0400 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 1sc4P9-00061t-Pf for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2024 10:46:16 -0400 Received: from sonic317-26.consmr.mail.bf2.yahoo.com ([74.6.129.81]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sc4P5-00087L-DT for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2024 10:46:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1723128355; bh=Zi1+JP/LmhgL7RE7VCL8NqTcvDjH4xdeUYvLCWXllqk=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=NoM2sQhboORr8uVsCyRBjuh0QHfmkSF/tzWMB2vfhKPme8LJCifPc/VXv6qQ40Siyi1qvefBX5ObyHb8yoGkqh8O68wVu5x+6NAL5Nev4NR1Ij8SGNJp9pIcOGewTRg5uKLGP5l3eAjddRTRp0z0Pxb0z0ss+xAPbPSWy7d86HS1mB4Lk9C/TWJwJXWCD3lfvHAXvGqxfj1YJXpr1+PgflaPkDY+yywYZvUr7lMlV/ISjpKJqgZZFi4Z76746I2xcjysx/sHm7qInU/ZdAOOTfavS1ym5NqZAl9IGBiA5YlbwUPgbeI3X8+AhBXiAXxb1a478OyyNIlph8dPcmCHbg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1723128355; bh=yQ0QpnVqNSUlbFkOb6zM2Wxqu26HOGiP2yX4wsvdLfj=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Mem77yB1YScyIsFzCHxHsqfC/VPy7PhA0DgtEM8tljhhxcVgwMn2ajQWb/8CA37kdSI1kMtDAipClZbMcipL3agKE230ZOUK9aA30H3rpbJ01BUxli/AwDU4TIrZ6VInQemrNW3ooD5JA7LltLM/Sm2lDXpuyG0cFrtHqx0jLSKp9tHascIKMSLCZO9GXwuJL00+5uWEm9oSB8wYLjSHsjRrvVZcFgoT/LrVoRhA7KcusFRE5NBoAOnpdJoMKxdoFJWUME+To++fT/esB1girMASU64/hUydcxzkoMxuaSti6GWZSliGE2zmR8IWphV6xlFZSajdMB7hczsErN86Cw== X-YMail-OSG: f5EBoPwVM1lhrbl3Qj9BTsInaqTf.EP4cHlEWNkE8eqoTYt75aIC08iUcKdPPC2 TlIu1yR.rBVQGvQRv3tKN6.iynFwuLASpWLHar097WgVQHogxTHBKPM9xJJ__bDaJ8EQy896MVf9 v23q4Gf0OkwYA3ODjgzU4ZZjPhwUTxHyaTElx2q.ZVZZCkyROV7ljy.BT0w1ih26JX2bXDbEB0AJ PDGAiBvOYUcfao9XaMTLj0OY2In_Fzxc_fQxdCLD02ktndxJp9k1By2jdUteVOvnJXQ84UXsDyvw QZf3booFyKnxW0LyYfitJnAT9gZu1I.lQ9cxYprud1PYTDuYNgvPhKxAhUf.aEkj_QD3DOftx.R6 u6_T5e3oAGrMm6_fPYD3aK8US2YcWtUJX_idcsjTaiOWA09pEZ0njVEF3N8rvH54LMBjOnEF9CIy wDgnTgqhU5QxrOFrehRZdN1cnEr_7P77qHtTdydMHt3iYb2.mNC4NKb9Oh0uWew3R4Kpx6klxwcW aTW5iATdg_PKFzGJNJvChM.Yk7aGduQUWMSIU428f2IWngtr8ZRaPlbjQT5UuMm8zS2pts8rKCbj rtz3UQrQHFjj2q2gVLe0B5SSjEzflqyjJfiYjq1Ve30Qlw3MVi_zTrLAC_8tgXSjfmljAWPeAFUI gYxf2N_6UGNiR89J4uMDNqZ0GyPk6.pk.JjnPtqL.MKRX1ZTvUJ1armQ5Azbw9YC24_9n_Sq7JYb B5rBbbp82v2W7KrfKBjRvN0IItRtu8pLcq6RZLQxVc3b2VTysrLqbaCbOoIxkb1RyEQEcekZvhHJ px34VnWF5H6XdCEjvCg21qXpnQRr97GuGXxG1cKcLprGXXKtvqi3KDAjsV7KuoXqwu9Fwsou14DK vJykj77pELU_.addPrthj4QCmQtbJPT3Pf_kinJfolnAthOAZOpZ9lTc.B6b7BTHIVNHe.h7raHd ZGFPcXcM1phIWk9D0vmEqht6GMW69qQnQxH_.KohrzEMopXerx4by9Oj3B6Sz5ZC0MTJStkyaUVf 18Y6FgF8G2QndyZS1iwNigzMER7yRK16FglnsPupXk862R0zkReBRXRn63wSdn6cz71SW2se5hmi kT4s_OboytbFOzSwkAojB0gIAuGoohjAvQ6Zu9nn1f6_r_clka88HTeHbdE9lXCWw.ruwcJAVFFL mjlpezav6PE7l6SmIuueBrUCf.C7s1y_f2MqTcPVGXvxXv88j1D3vpgRlaBv4KWqPlTTrsjms94D 3v64YS0CaZSUeOCN1Tl0n4EmFJhIm9FVuz_F_neusBPwxS.DWoo2dDfPIniC.hw0vhrhJtGFzfbX Uu0wsHu5Q6lR4Z4O02FU2PUQ2LAyzjcqxpgKMeEvXBDUviO3b9kAE4lhaeU1QWrVYsboqWWd9d7d CxkOiDVdyamCfQntUGADaM9XCS8sNkvduxF.FkEn0Lvv4mCJ9w9PZWLRWd5LLjrLiiOSRpabuFPa zGH7yMp2tqvmytD.RkIKBNOHxOU6x.HCCVEOI62pZIyLCIwu7l9wJunYYEGMBESsdzmQ_OU9jAS8 edwJH_yKCw6YDndK_kI9xlaeRDVYY.VT_mwOSLzNH4tcl356bQd_63mKjS2B8otlk3Wur7kewIar 2f0hHNCdFrsn6mrgQISswGMY.Dvi1osf_V474M8Ibt8H2xUjf79eSA_Z6fBWvtjdu_GGkreA7QFX ctE3rNbaacZ.Xu3RJkvMzaq1QqRoAbaI1iGiIN7zpqrrBMKS1URxv4DtzrYg6gyfAIjhDCPJtnb4 bfQHHx5rPJZON7SreP4ENcSO10.O57QB42gyGb1Ule5g8wXisQbqWXaEBtdWggamp7j3aEovBf5x folSH4piB5tnK8Sifj0E86RlGRDZqffoF_mfYZin3ZlryuYM72yjF8wNTeeH97Jr8kphPTMnBYs3 MJIljNjAlLOdMyo4K3LQZmHufDy6nJoZ_FuqynBrtCM3ito5z1R0jbqvxKU7MYsieuXYb6XDUnlK Oo1o4Cy0QW5Y7fl5g.fOT94hNSJQSuVuPhj9EtgXRJZebC2UFOYeDU28fjM06y2a_byqm.LhwxzK ZgGM0RjcLtsjvlO1Bm7iyPqugAO.I0WWtrHAzWy65OV_E37SHwIY1GfZ9IB5ZkwbGFS7_O9h4yAT v3TAGLyWhmWb0sP1LKm9QpUM_bw4xxRpuyNa6UNSlxEaVry4C.vQewTeSG4pT.PrEsrr021ySt8H 0ezzZMcAz9N12iSy4rZX5Q0iIDY9ExQ-- X-Sonic-MF: X-Sonic-ID: 11976334-b941-4c96-b9b3-c8eef40e7e7c Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Thu, 8 Aug 2024 14:45:55 +0000 Received: by hermes--production-ir2-6664f499fc-j2js5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 25862a63562059d8a4ebf4931a5927c3; Thu, 08 Aug 2024 14:45:51 +0000 (UTC) From: Ergus To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Forward sexp inconsistency issue c++-ts-mode X-Debbugs-Cc: Date: Thu, 08 Aug 2024 16:45:42 +0200 Message-ID: <87sevfxecp.fsf@aol.com> MIME-Version: 1.0 Content-Type: text/plain References: <87sevfxecp.fsf.ref@aol.com> X-Mailer: WebService/1.1.22544 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Content-Length: 9020 Received-SPF: pass client-ip=74.6.129.81; envelope-from=spacibba@aol.com; helo=sonic317-26.consmr.mail.bf2.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hi: Using this code: ``` int main() { abort(); /* 1 */ abort(); /* 1 */ } ``` There is an inconsistency in the c++-ts-mode behavior of `forward-sexp`. When there is a comment at the end of the line, if I do `mark-sexp` (C-M-SPC) consecutively I get this selected regions: ----------------------------- 1. abort(); 2. abort(); /* 1 */ 3. abort(); /* 1 */ abort 4. abort(); /* 1 */ abort() 5. abort(); /* 1 */ abort(); 6. abort(); /* 1 */ abort(); /* 1 */ ------------------------------- But when there is NOT trailing comment ``` int main() { abort(); abort(); } ``` ------------------------------- 1. abort(); 2. abort(); abort(); ------------------------------- It looks like in the fist example after 3 the sexp definition is more fine grained (similar to the previous c++-mode behavior) and it selects separately: the function name, the arguments the semicolon the comment But if there is no comment at the end, it always considers the complete line as a sexp (including the ;). For my use case I would prefer the old behavior because it is consistent with the current sexp definition in all emacs (with maybe the exception of python-mode). Because it is easier to copy function names or function calls with a few movements. However, if it is too difficult to reproduce the old behavior; then the new one may be implemented consistently. Best, Ergus In GNU Emacs 31.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-08-07 built on RTX Repository revision: dd93c32c82c65f7c7b26e8c7a8e4fa8425cdbfe0 Repository branch: project System Description: Arch Linux Configured using: 'configure --prefix=/home/ergo/.local/ --with-mailutils --with-pgtk --with-modules --with-cairo --with-harfbuzz --with-native-compilation=aot '--program-transform-name=s/^ctags$/ctags.emacs/'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 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 $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: C++// Minor modes in effect: fancy-compilation-mode: t global-auto-revert-mode: t electric-pair-mode: t whitespace-mode: t flyspell-mode: t completion-preview-mode: t diff-hl-margin-local-mode: t diff-hl-margin-mode: t diff-hl-mode: t corfu-terminal-mode: t global-corfu-mode: t corfu-mode: t project-multi-mode: t gtags-mode: t repeat-mode: t xterm-mouse-mode: t xclip-mode: t override-global-mode: t winner-mode: t save-place-mode: t delete-selection-mode: t savehist-mode: t global-display-fill-column-indicator-mode: t display-fill-column-indicator-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t which-key-mode: t show-paren-mode: t mouse-wheel-mode: t file-name-shadow-mode: t context-menu-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t size-indication-mode: t column-number-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: /mnt/casa/gits/emacs_clones/cuda-mode/cuda-mode hides /home/ergo/.config/emacs/elpa/cuda-mode-20240716.1936/cuda-mode /mnt/casa/gits/emacs_clones/gtags-mode/gtags-mode hides /home/ergo/.config/emacs/elpa/gtags-mode-1.8/gtags-mode /home/ergo/.config/emacs/elpa/transient-20240805.1231/transient hides /home/ergo/.local/share/emacs/31.0.50/lisp/transient Features: (shadow sort mail-extr fancy-compilation compile comint ansi-osc ansi-color comp-run comp-common emacsbug message mailcap yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils autorevert filenotify ffap thingatpt url-parse auth-source eieio eieio-core icons password-cache json map url-vars elec-pair whitespace flyspell-correct flyspell ispell completion-preview diff-hl-margin diff-hl-dired citre-lang-fileref citre-tags citre-ctags citre-readtags citre-readtags-tables citre-backend-interface citre-common-tag rx citre-common-util dired-x dired dired-loaddefs diff-hl log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode track-changes corfu-terminal popon corfu project-multi-mode gtags-mode cl-macs files-x xref project c++-ts-mode c-ts-mode c-ts-common term/tmux term/xterm xterm init repeat markdown-ts-mode subr-x treesit cape compat use-package-ensure use-package-diminish xt-mouse xclip edmacro kmacro byte-opt gv use-package-bind-key bind-key cl-extra help-mode simple-16-theme winner ring saveplace delsel savehist easy-mmode display-fill-column-indicator display-line-numbers diminish which-key cl-seq use-package-core cl-loaddefs cl-lib bytecomp byte-compile disp-table info 0blayout-autoloads ac-emoji-autoloads ac-haskell-process-autoloads ac-html-autoloads arduino-cli-mode-autoloads auctex-autoloads tex-site auto-complete-autoloads avy-zap-autoloads avy-autoloads better-shell-autoloads caml-autoloads cape-autoloads citre-autoloads clang-format-autoloads cobol-mode-autoloads compile-multi-autoloads corfu-terminal-autoloads corfu-autoloads crdt-autoloads csv-mode-autoloads cuda-mode-autoloads d-mode-autoloads deadgrep-autoloads debbugs-autoloads diff-hl-autoloads diminish-autoloads dired-sidebar-autoloads dired-subtree-autoloads dired-hacks-utils-autoloads dumb-jump-autoloads e2ansi-autoloads emamux-autoloads esup-autoloads evil-collection-autoloads annalist-autoloads evil-leader-autoloads evil-autoloads face-explorer-autoloads fancy-compilation-autoloads flx-autoloads flycheck-julia-autoloads flycheck-rust-autoloads flycheck-autoloads flymake-nasm-autoloads flymake-quickdef-autoloads flyspell-correct-autoloads git-modes-autoloads git-timemachine-autoloads gnuplot-autoloads google-c-style-autoloads goto-chg-autoloads groovy-mode-autoloads gtags-mode-autoloads haskell-mode-autoloads highlight-indent-guides-autoloads i3wm-config-mode-autoloads ibuffer-sidebar-autoloads iedit-autoloads imenu-list-autoloads julia-ts-mode-autoloads julia-mode-autoloads languagetool-autoloads lice-autoloads lorem-ipsum-autoloads lua-mode-autoloads magit-autoloads git-commit-autoloads magit-section-autoloads markdown-mode-autoloads markdown-ts-mode-autoloads modern-cpp-font-lock-autoloads move-dup-autoloads multiple-cursors-autoloads mutt-mode-autoloads nasm-mode-autoloads neotree-autoloads nftables-mode-autoloads nginx-mode-autoloads notmuch-autoloads objed-autoloads opencl-mode-autoloads paradox-autoloads phi-search-autoloads pkg-info-autoloads epl-autoloads pkgbuild-mode-autoloads platformio-mode-autoloads async-autoloads popon-autoloads popup-autoloads projectile-autoloads projection-autoloads protobuf-mode-autoloads protobuf-ts-mode-autoloads ptemplate-templates-autoloads ptemplate-autoloads scopeline-autoloads shell-command+-autoloads slime-autoloads macrostep-autoloads sphinx-mode-autoloads f-autoloads dash-autoloads s-autoloads spinner-autoloads ssh-config-mode-autoloads string-inflection-autoloads sudo-edit-autoloads systemd-autoloads tmux-mode-autoloads transient-autoloads tsc-autoloads urgrep-autoloads vdiff-autoloads hydra-autoloads lv-autoloads vterm-toggle-autoloads vterm-autoloads vundo-autoloads with-editor-autoloads xclip-autoloads yasnippet-snippets-autoloads yasnippet-autoloads early-init 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 185298 34784) (symbols 48 15017 0) (strings 32 50296 12386) (string-bytes 1 1766229) (vectors 16 19239) (vector-slots 8 220612 9451) (floats 8 95 112) (intervals 56 967 0) (buffers 992 13)) ------------=_1725694623-5514-1--