all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kohei Tsuruta <seventhepg@gmail.com>
To: 75422@debbugs.gnu.org
Subject: bug#75422: 30.0.93; [PATCH] forward-sexp and backward-sexp jump outside of comments in tsx-ts-mode
Date: Tue, 07 Jan 2025 08:02:02 -0800	[thread overview]
Message-ID: <m2bjwiwr2d.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]

Steps to reproduce
- emacs -Q test.tsx
- (tsx-ts-mode)
- Move point at the end of the comment at line 3
- (backward-sexp)

The expected point position after (backward-sexp) is "treesit-thing-|settings"
or at least stay inside of the comment line, however, point moves to the
beginning of "Hello".
Likewise, if you C-x C-e at the end of the comment line, it evaluates "Hello".

--- test.tsx (| is point) ---
export const App = () => {
  const greeting = "Hello"
  // treesit-thing-settings|
  return <>{greeting}</>
}
--- END test.tsx ---

It happens because tsx-ts-mode doesn't recognize comments. In
typescript-ts-base-mode, treesit-thing-settings is set to have "text" as
a thing for typescript but it's missing in tsx-ts-mode when it's set for
tsx.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-text-as-a-thing-in-tsx-ts-mode.patch --]
[-- Type: text/x-patch, Size: 1162 bytes --]

From d1c5aa45213e4011dfb641edb0d064e5d02e370d Mon Sep 17 00:00:00 2001
From: Kohei Tsuruta <seventhepg@gmail.com>
Date: Tue, 7 Jan 2025 07:36:14 -0800
Subject: [PATCH] Add "text" as a thing in tsx-ts-mode

* lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode):
Add definition of "text"
---
 lisp/progmodes/typescript-ts-mode.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 4a38d1da596..0ffcb144771 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -564,7 +564,9 @@ tsx-ts-mode
                    (sentence ,(regexp-opt
                                (append typescript-ts-mode--sentence-nodes
                                        '("jsx_element"
-                                         "jsx_self_closing_element")))))))
+                                         "jsx_self_closing_element"))))
+                   (text ,(regexp-opt '("comment"
+                                        "template_string"))))))
 
     ;; Font-lock.
     (setq-local treesit-font-lock-settings
-- 
2.39.5 (Apple Git-154)


[-- Attachment #3: Type: text/plain, Size: 4952 bytes --]




In GNU Emacs 30.0.93 (build 3, aarch64-apple-darwin24.1.0, NS
 appkit-2575.20 Version 15.1.1 (Build 24B91)) of 2025-01-05 built on
 mac.lan
Repository revision: 505c1123e18a8a710fc60e05a4c870497bf580f4
Repository branch: emacs-30
System Description:  macOS 15.1.1

Configured using:
 'configure --with-native-compilation --disable-ns-self-contained
 --with-tree-sitter'

Configured features:
ACL GNUTLS LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER SQLITE3
THREADS TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  bug-reference-prog-mode: t
  paredit-mode: t
  rainbow-delimiters-mode: t
  whitespace-mode: t
  which-function-mode: t
  corfu-terminal-mode: t
  corfu-history-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mode: t
  savehist-mode: t
  recentf-mode: t
  winner-mode: t
  repeat-mode: t
  save-place-mode: t
  delete-selection-mode: t
  electric-pair-mode: t
  minibuffer-depth-indicate-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  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
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-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 emacsbug mail-extr ispell log-edit message sendmail
yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config 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 vc consult-imenu help-fns
radix-tree cl-print debug backtrace find-func dabbrev vertico-directory
c++-ts-mode c-ts-mode js c-ts-common treesit cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs time-date
misearch multi-isearch vc-git diff-mode track-changes vc-dispatcher
bug-reference descr-text grep embark-consult embark ffap texinfo
texinfo-loaddefs files-x consult bookmark pp add-log term/xterm xterm
paredit cape rainbow-delimiters disp-table whitespace merge-n-save
flymake project compile text-property-search comint ansi-osc ansi-color
thingatpt which-func imenu corfu-terminal popon corfu-history corfu
orderless marginalia vertico compat savehist recentf tree-widget
wid-edit winner ring repeat saveplace delsel elec-pair finder-inf
solarized-light-theme solarized-theme solarized solarized-faces color
edmacro kmacro mb-depth delight comp comp-cstr warnings comp-run
comp-common rx cl-extra help-mode use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core avy-autoloads cape-autoloads
corfu-terminal-autoloads corfu-autoloads delight-autoloads
dumb-jump-autoloads dash-autoloads embark-consult-autoloads
consult-autoloads embark-autoloads exec-path-from-shell-autoloads
expand-region-autoloads marginalia-autoloads markdown-mode-autoloads
info orderless-autoloads paredit-autoloads popon-autoloads
popup-autoloads rainbow-delimiters-autoloads s-autoloads
solarized-theme-autoloads vertico-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 icons 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/ns-win ns-win
ucs-normalize mule-util term/common-win 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 kqueue cocoa ns multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 334937 64735) (symbols 48 32870 14)
 (strings 32 126791 4029) (string-bytes 1 4022076) (vectors 16 34459)
 (vector-slots 8 436900 32986) (floats 8 362 7583)
 (intervals 56 3954 480) (buffers 992 27))

             reply	other threads:[~2025-01-07 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 16:02 Kohei Tsuruta [this message]
2025-01-07 17:44 ` bug#75422: 30.0.93; [PATCH] forward-sexp and backward-sexp jump outside of comments in tsx-ts-mode Juri Linkov
2025-01-08  2:29   ` Yuan Fu
2025-01-08  7:44     ` Juri Linkov
2025-01-08 13:12       ` Eli Zaretskii
2025-01-09  7:51         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bjwiwr2d.fsf@gmail.com \
    --to=seventhepg@gmail.com \
    --cc=75422@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.