GNU bug report logs - #79454
ruby-mode regex syntax highlighting incorrect

Previous Next

Package: emacs;

Reported by: nathan <nathan <at> hintonclan.org>

Date: Mon, 15 Sep 2025 22:26:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: nathan <nathan <at> hintonclan.org>
To: 79454 <at> debbugs.gnu.org
Subject: bug#79454: ruby-mode regex syntax highlighting incorrect
Date: Mon, 15 Sep 2025 13:47:42 -0600

When editing a ruby file I did an assignment like this:
```ruby
some_var = 10
some_var /= 2 # some_var is now equal to 5
```

This is a valid operator however the highlighting showed this as being
part of a regex string which can be formed like this:
```ruby
test_str = 'this is a test string'
test_str.match? /test/ # Returns true
```

Here are the cases that I tested. The first col is what I did, the
second is what I expected and the third is how it was highlighted:

expression # expectation # reality
12/3       # division    # division
12 /3      # division    # regex
12/ 3      # division    # division
12 / 3     # division    # division

I am not an expert in Ruby syntax but I would imagine that the change
would be something like: require two slashes on the same line to
highlight it as a regex expression


In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49,
 cairo version 1.18.4) of 2025-07-18, modified by Debian built on sbuild
Windowing system distributor 'The X.Org Foundation', version 
11.0.12401006
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/libexec --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd
 --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-cairo
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -Werror=implicit-function-declaration
 -ffile-prefix-map=/build/reproducible-path/emacs-30.1+1=. 
-fstack-protector-strong
 -fstack-clash-protection -Wformat -Werror=format-security
 -fcf-protection -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
 LDFLAGS=-Wl,-z,relro'

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

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

Major mode: Ruby

Minor modes in effect:
  inf-ruby-minor-mode: t
  global-auto-revert-mode: t
  display-time-mode: t
  vhdl-electric-mode: t
  tooltip-mode: t
  global-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
  blink-cursor-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 mail-extr emacsbug message 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 noutline
outline jka-compr lisp-mnt finder-inf etags fileloop generator xref
project dabbrev comp comp-cstr cl-extra help-mode warnings comp-run
comp-common misearch multi-isearch inf-ruby thingatpt ruby-mode kmacro
rect time-date vc-git diff-mode track-changes easy-mmode vc-dispatcher
yaml-mode pcmpl-unix sh-script rx smie treesit executable files-x shell
pcomplete cus-start autorevert filenotify time man dired dired-loaddefs
vhdl-mode hippie-exp compile text-property-search comint ansi-osc
ansi-color ring cus-edit pp cus-load wid-edit dockerfile-mode-autoloads
inf-ruby-autoloads yaml-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 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/x-win x-win
term/common-win x-dnd touch-screen 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 lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 284136 22299) (symbols 48 17187 0) (strings 32 60481 3751)
 (string-bytes 1 1717419) (vectors 16 28207) (vector-slots 8 360360 
16523)
 (floats 8 89 968) (intervals 56 10023 0) (buffers 992 25))




This bug report was last modified 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.