unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68318: 30.0.50; Fontification of \{m\} and \{m,n\} in a regexp
@ 2024-01-08  9:26 Arash Esbati
  2024-01-08 11:07 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Arash Esbati @ 2024-01-08  9:26 UTC (permalink / raw)
  To: 68318

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

Hi all,

to reproduce, start 'emacs -Q' and paste the following lines into
scratch:

(re-search-forward "a\\{7\\}")

(re-search-forward "a\\{7,\\}")

(re-search-forward "a\\{,7\\}")

For me, it looks like this:

[-- Attachment #2: string.png --]
[-- Type: image/png, Size: 8173 bytes --]

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


Hitting 'C-u C-x =' on the first 7 and the backslashes says:

  There are text properties here:
    face                 (font-lock-variable-name-face font-lock-string-face)
    fontified            t

On the next two forms, I get:

  There are text properties here:
    face                 font-lock-string-face
    fontified            t

Is this difference on purpose?

Best, Arash

In GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin23.2.0, NS
 appkit-2487.30 Version 14.2.1 (Build 23C71)) of 2024-01-07 built on
 MacMutant.fritz.box
Repository revision: f866c85ac4e32df8061b285b6b44b15346994f3d
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.2.1

Configured using:
 'configure --with-ns --without-pop --without-mailutils --with-threads
 --with-modules --with-native-compilation --without-compress-install
 'CFLAGS=-O2 -g0 -pipe'
 'CPPFLAGS=-I/opt/homebrew/Cellar/gcc/13.2.0/include
 -I/opt/homebrew/Cellar/libgccjit/13.2.0/include
 -I/opt/homebrew/Cellar/gmp/6.3.0/include'
 'LDFLAGS=-L/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current
 -L/opt/homebrew/Cellar/gmp/6.3.0/lib''

Configured features:
ACL GLIB GMP GNUTLS JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE
NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
XIM ZLIB

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#68318: 30.0.50; Fontification of \{m\} and \{m,n\} in a regexp
  2024-01-08  9:26 bug#68318: 30.0.50; Fontification of \{m\} and \{m,n\} in a regexp Arash Esbati
@ 2024-01-08 11:07 ` Andreas Schwab
  2024-01-11 15:51   ` Arash Esbati
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2024-01-08 11:07 UTC (permalink / raw)
  To: Arash Esbati; +Cc: 68318

See lisp-el-font-lock-keywords-2 in lisp-mode.el:

         ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for
         ;; `substitute-command-keys'.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#68318: 30.0.50; Fontification of \{m\} and \{m,n\} in a regexp
  2024-01-08 11:07 ` Andreas Schwab
@ 2024-01-11 15:51   ` Arash Esbati
  0 siblings, 0 replies; 3+ messages in thread
From: Arash Esbati @ 2024-01-11 15:51 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 68318

Andreas Schwab <schwab@linux-m68k.org> writes:

> See lisp-el-font-lock-keywords-2 in lisp-mode.el:
>
>          ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for
>          ;; `substitute-command-keys'.

Thanks for the pointer.  I'm not familiar with the code, but IIUC, the
lines 499-500 are relevant, where the condense is:

  (rx "\\\\" (seq "{" (group-n 1 lisp-mode-symbol) "}"))

which returns:

  "\\\\\\\\{\\(?1:\\(?:\\w\\|\\s_\\|\\\\.\\)+\\)}"

Since we're talking about \\{\\} and not \\{}, I wonder if some
variation like:

  "\\\\\\\\{\\(?1:\\(?:\\w\\|\\s_\\|\\\\.\\)*?[^\\]\\)}"

would fix this issue?  Not sure if it does TRT reg. the "\\\\." part.

Best, Arash





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-11 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08  9:26 bug#68318: 30.0.50; Fontification of \{m\} and \{m,n\} in a regexp Arash Esbati
2024-01-08 11:07 ` Andreas Schwab
2024-01-11 15:51   ` Arash Esbati

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).