Subject: Re: 29.0.60; rust-ts-mode not properly handling apostrophe
From: Йордан Миладинов<[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Wed, 24 May 2023 22:05:20 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello!

Not sure if this is the right place to send the patch, but here it is.

I reported the bug earlier and expected to see it go live on debbugs, but apparently the process is not (that) automatic.

I subscribed for the devel list, but, if you have any comments on this patch, please drop me an email as well.

Cheers!
Yordan Miladinov

Sent with [Proton Mail](https://proton.me/) secure email.

------- Original Message -------
On Thursday, May 25th, 2023 at 12:40 AM, Йордан Миладинов <[email-masked]> wrote:

> In Rust (rust-ts-mode) apostrophe-doublequote-apostrophe break many
> parsing functions (scan-lists being the core one) as the apostrophe
> character is parsed as punctuation, not as a string (as it is in
> c-ts-mode for example).
>
> In GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.37, cairo version 1.17.8) of 2023-04-01 built on nitro
> Repository revision: 3bdbb66efb9895b8ed55270075fa7d8329f8d36b
> Repository branch: emacs-29
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
> System Description: Arch Linux
>
> Configured using:
> 'configure --with-xaw3d --with-xwidgets --prefix
> /home/d/local/emacs-bin/ CFLAGS=-O3'
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
> PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
> TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB
>
> Important settings:
> value of $LANG: en_US.UTF-8
> locale-coding-system: utf-8-unix
>
> Major mode: Outline
>
> Minor modes in effect:
> bug-reference-mode: t
> global-subword-mode: t
> subword-mode: t
> csv-field-index-mode: t
> key-chord-mode: t
> shell-dirtrack-mode: t
> override-global-mode: t
> delete-selection-mode: t
> tooltip-mode: t
> global-eldoc-mode: t
> show-paren-mode: t
> electric-indent-mode: t
> mouse-wheel-mode: t
> menu-bar-mode: t
> file-name-shadow-mode: t
> global-font-lock-mode: t
> font-lock-mode: t
> blink-cursor-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:
> ~/dev/emacs/eldoc-box/eldoc-box hides /home/d/.emacs.d/elpa/eldoc-box-20230404.2324/eldoc-box
>
> Features:
> (shadow mail-extr ispell emacsbug message yank-media puny rfc822 mml
> mml-sec epa 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 vc-git
> diff-mode vc-dispatcher bug-reference wid-edit descr-text smex
> company-oddmuse company-keywords company-etags company-gtags
> company-dabbrev-code company-dabbrev company-files company-clang
> company-capf company-cmake company-semantic company-template
> company-bbdb company d-init rust-ts-mode d-treesit typescript-ts-mode
> json-ts-mode go-ts-mode c-ts-mode python js c-ts-common
> dockerfile-ts-mode d-theme catppuccin-theme d-subword cap-words
> superword subword d-rust d-python d-prog hideshow d-packages eldoc-box
> eglot external-completion array filenotify imenu jsonrpc ert ewoc debug
> backtrace yaml-mode solidity-mode solidity-common cc-mode cc-fonts
> cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
> pkgbuild-mode sh-script treesit executable meson-mode smie markdown-mode
> edit-indirect haskell-mode haskell-cabal haskell-utils haskell-font-lock
> haskell-indentation haskell-string haskell-sort-imports haskell-lexeme
> haskell-align-imports haskell-complete-module haskell-ghc-support
> noutline outline etags fileloop generator xref dabbrev haskell-customize
> csv-mode sort d-nim d-keychords d-interactives d-common ripgrep grep
> flymake-proc flymake derived pcase project warnings icons thingatpt
> jka-compr ace-window avy ace-jump-mode cl use-package-chords bind-chord
> key-chord use-package use-package-delight use-package-diminish d-html
> mmm-mode mmm-univ mmm-class mmm-region mmm-auto mmm-vars mmm-utils
> mmm-compat d-globals vterm bookmark pp face-remap compile
> text-property-search term disp-table ehelp find-func vterm-module
> term/xterm xterm vterm-toggle tramp-sh tramp tramp-loaddefs trampver
> tramp-integration files-x tramp-compat rx shell pcomplete comint
> ansi-osc ansi-color parse-time iso8601 time-date ls-lisp format-spec
> swiper ivy ring ivy-faces ivy-overlay colir color use-package-bind-key
> edmacro kmacro bind-key easy-mmode d-dired dired dired-loaddefs
> d-company d-cc d-bs advice ido delsel cus-load cl-extra help-mode
> use-package-ensure use-package-core company-autoloads
> catppuccin-theme-autoloads ripgrep-autoloads vue-mode-autoloads
> vue-html-mode-autoloads edit-indirect-autoloads solidity-mode-autoloads
> ace-jump-mode-autoloads smex-autoloads yaml-mode-autoloads
> vterm-toggle-autoloads vterm-autoloads use-package-chords-autoloads
> bind-chord-autoloads key-chord-autoloads css-eldoc-autoloads
> ace-window-autoloads zenburn-theme-autoloads avy-autoloads
> meson-mode-autoloads doom-themes-autoloads mmm-mode-autoloads
> djvu-autoloads csv-mode-autoloads one-themes-autoloads neotree-autoloads
> pkgbuild-mode-autoloads markdown-mode-autoloads haskell-mode-autoloads
> eldoc-box-autoloads counsel-autoloads swiper-autoloads info
> ivy-autoloads ssass-mode-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 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/x-win x-win
> term/common-win x-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 xwidget-internal dbusbind inotify lcms2 dynamic-setting
> system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
> xinput2 x multi-tty make-network-process emacs)
>
> Memory information:
> ((conses 16 290895 266480)
> (symbols 48 38398 9)
> (strings 32 148232 44154)
> (string-bytes 1 3939562)
> (vectors 16 45480)
> (vector-slots 8 948948 245260)
> (floats 8 266 920)
> (intervals 56 521 416)
> (buffers 984 17))

From 568e96086237345f45949a9c2ceea13f15abd871 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=99=D0=BE=D1=80=D0=B4=D0=B0=D0=BD=20=D0=9C=D0=B8=D0=BB?=
 =?UTF-8?q?=D0=B0=D0=B4=D0=B8=D0=BD=D0=BE=D0=B2?= <[email-masked]>
Date: Thu, 25 May 2023 00:43:10 +0300
Subject: [PATCH] Fix apostrophe handling in rust-ts-mode

* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--syntax-table)
  Update the syntax table to treat the apostrophe character as
  defining a string, similar to c-ts-mode.  This fix addresses issues
  with functions that rely on scan-lists.
---
 lisp/progmodes/rust-ts-mode.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index be06acde3e3..ce2828541a6 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -64,6 +64,7 @@ rust-ts-mode--syntax-table
     (modify-syntax-entry ?>   "."      table)
     (modify-syntax-entry ?/   ". 124b" table)
     (modify-syntax-entry ?*   ". 23"   table)
+    (modify-syntax-entry ?\'  "\""     table)
     (modify-syntax-entry ?\n  "> b"    table)
     (modify-syntax-entry ?\^m "> b"    table)
     table)
-- 
2.40.1