From 4a687bcc20d4d5a3297bfaecd6bd9d400ba39195 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 30 Jul 2023 10:08:27 +0300 Subject: [PATCH 01/12] Bump Emacs version * README: * configure.ac: * nt/README.W32: * msdos/sed2v2.inp: * etc/NEWS: Bump Emacs version to 29.1.50. --- README | 2 +- configure.ac | 2 +- etc/NEWS | 27 +++++++++++++++++++++++++++ msdos/sed2v2.inp | 2 +- nt/README.W32 | 2 +- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README b/README index 38de64ff128..64b8c833d3f 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Copyright (C) 2001-2023 Free Software Foundation, Inc. See the end of the file for license conditions. -This directory tree holds version 29.1 of GNU Emacs, the extensible, +This directory tree holds version 29.1.50 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure.ac b/configure.ac index ad1068a70ad..5dd182ae6e5 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl along with GNU Emacs. If not, see . AC_PREREQ([2.65]) dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el. -AC_INIT([GNU Emacs], [29.1], [bug-gnu-emacs@gnu.org], [], +AC_INIT([GNU Emacs], [29.1.50], [bug-gnu-emacs@gnu.org], [], [https://www.gnu.org/software/emacs/]) dnl Set emacs_config_options to the options of 'configure', quoted for the shell, diff --git a/etc/NEWS b/etc/NEWS index 75bf8f5dd28..922938f13a1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -15,6 +15,33 @@ in older Emacs versions. You can narrow news to a specific version by calling 'view-emacs-news' with a prefix argument or by typing 'C-u C-h C-n'. + +* Installation Changes in Emacs 29.2 + + +* Startup Changes in Emacs 29.2 + + +* Changes in Emacs 29.2 + + +* Editing Changes in Emacs 29.2 + + +* Changes in Specialized Modes and Packages in Emacs 29.2 + + +* New Modes and Packages in Emacs 29.2 + + +* Incompatible Lisp Changes in Emacs 29.2 + + +* Lisp Changes in Emacs 29.2 + + +* Changes in Emacs 29.2 on Non-Free Operating Systems + * Installation Changes in Emacs 29.1 diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index c5d8e1a4919..bcf92ac6be3 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -67,7 +67,7 @@ /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ -/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.1"/ +/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.1.50"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ diff --git a/nt/README.W32 b/nt/README.W32 index 9c3c675cbb4..4eda5e1e243 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -1,7 +1,7 @@ Copyright (C) 2001-2023 Free Software Foundation, Inc. See the end of the file for license conditions. - Emacs version 29.1 for MS-Windows + Emacs version 29.1.50 for MS-Windows This README file describes how to set up and run a precompiled distribution of the latest version of GNU Emacs for MS-Windows. You From cb1f7db249096bf58e28fb586d7ef926536dcb09 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 25 Jul 2023 16:49:18 +0300 Subject: [PATCH 02/12] ; Minor documentation fixes * src/character.c (Fstring_width): Doc fix. * doc/emacs/trouble.texi (Understanding Bug Reporting): Fix typo (bug#64854). (cherry picked from commit f6e4e77d23d0be79be83ef41c3ea9acd5c983af2) --- doc/emacs/trouble.texi | 2 +- src/character.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index bccdea72b19..d2e8ac3452a 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -706,7 +706,7 @@ produced by typing those commands. for the detailed raw data. Reporting the facts is straightforward, but many people strain to posit explanations and report them instead of the facts. If the explanations are based on guesses about how -Emacs is implemented, they night not be useful; meanwhile, lacking the +Emacs is implemented, they might not be useful; meanwhile, lacking the facts, we will have no real information about the bug. If you want to actually @emph{debug} the problem, and report explanations that are more than guesses, that is useful---but please include the raw facts diff --git a/src/character.c b/src/character.c index d0b18367a83..13d516987d3 100644 --- a/src/character.c +++ b/src/character.c @@ -470,7 +470,7 @@ used for non-Latin and other unusual characters (such as emoji) is ignored as well, as are display properties and invisible text. For these reasons, the results are not generally reliable; for accurate dimensions of text as it will be displayed, -use `window-text-pixel-size' instead. +use `string-pixel-width' or `window-text-pixel-size' instead. usage: (string-width STRING &optional FROM TO) */) (Lisp_Object str, Lisp_Object from, Lisp_Object to) { From d13029cdcde22b8e68d91d8f0c0b2649f72675f2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 25 Jul 2023 20:38:01 +0300 Subject: [PATCH 03/12] Avoid crashes under 'which-key-mode' * src/keyboard.c (Fthis_single_command_keys): Don't allow calls to Fvector with negative first argument. (Bug#64857) (cherry picked from commit 65834b8f8d53402517da7fe2446f5bac0aa30c39) --- src/keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 99f886821e2..101a6f3a78e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11116,8 +11116,8 @@ the command loop or by `read-key-sequence'. The value is always a vector. */) (void) { - return Fvector (this_command_key_count - - this_single_command_key_start, + ptrdiff_t nkeys = this_command_key_count - this_single_command_key_start; + return Fvector (nkeys < 0 ? 0 : nkeys, (XVECTOR (this_command_keys)->contents + this_single_command_key_start)); } From 54e98b5f9bdd82a84fc301f1faf9a09a7326dc3f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 27 Jul 2023 09:37:03 +0300 Subject: [PATCH 04/12] ; Clarify documentation of 'server-after-make-frame-hook' * doc/lispref/frames.texi (Creating Frames): * lisp/server.el (server-after-make-frame-hook): Clarify documentation of 'server-after-make-frame-hook'. (Bug#64873) (cherry picked from commit e650a14f64b9ebea69615c19ca4466c14af35857) --- doc/lispref/frames.texi | 10 +++++++--- lisp/server.el | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index a8ac9a214f6..9bfb9e50c6c 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -187,9 +187,13 @@ selected frame. @end defvar @defopt server-after-make-frame-hook -A normal hook run when the Emacs server creates a client frame. When -this hook is called, the created frame is the selected one. -@xref{Emacs Server,,, emacs, The GNU Emacs Manual}. +A normal hook run when the Emacs server starts using a client frame. +When this hook is called, the client frame is the selected one. Note +that, depending on how @command{emacsclient} was invoked +(@pxref{Invoking emacsclient,,, emacs, The GNU Emacs Manual}), this +client frame could be a new frame created for the client, or it could +be an existing frame that the server reused for handling the client +commands. @xref{Emacs Server,,, emacs, The GNU Emacs Manual}. @end defopt diff --git a/lisp/server.el b/lisp/server.el index eaf24a770e4..104fc060c05 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -182,8 +182,10 @@ space (this means characters from ! to ~; or from code 33 to :type 'hook) (defcustom server-after-make-frame-hook nil - "Hook run when the Emacs server creates a client frame. -The created frame is selected when the hook is called." + "Hook run when the Emacs server starts using a client frame. +The client frame is selected when the hook is called. +The client frame could be a newly-created frame, or an +existing frame reused for this purpose." :type 'hook :version "27.1") From b2cb6e821603b53b88b99b5cbf24dc715fc25867 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 27 Jul 2023 09:51:39 +0300 Subject: [PATCH 05/12] ; Better documentation of HOME on MS-Windows * doc/emacs/custom.texi (Find Init): Add footnote about HOME on MS-Windows. (Bug#64871) (cherry picked from commit d59630e591cd49780e6554d1025c1879bb89680b) --- doc/emacs/custom.texi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index e56b1fe964c..ea29876be80 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2804,7 +2804,12 @@ library. @xref{Hooks}. @subsection How Emacs Finds Your Init File Emacs normally finds your init file in a location under your home -directory. @xref{Init File}. +directory@footnote{ +On MS-Windows, there's no single directory considered by all programs +as ``the home directory'' of the user. Emacs uses one of the +pertinent directories as the equivalent of your home directory; see +@ref{Windows HOME}, for the details. +}. @xref{Init File}. Emacs looks for your init file using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or @file{~/.emacs.d/init.el} in that order; you can From 71419a60c3710549742c2489b7fce7783ac0f65c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 27 Jul 2023 15:34:38 +0300 Subject: [PATCH 06/12] Avoid crashes due to invalid 'mode-line-format' * src/xdisp.c (display_mode_element, redisplay_window_error): Don't take XCAR of what can be Qnil. (Bug#64893) (cherry picked from commit 7ea3f39deec3d54914077455e70605a14eb7d200) --- src/xdisp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index fdb4acd71bf..9cddcfeda27 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17601,6 +17601,7 @@ redisplay_window_error (Lisp_Object error_data) if (max_redisplay_ticks > 0 && CONSP (error_data) && EQ (XCAR (error_data), Qerror) + && CONSP (XCDR (error_data)) && STRINGP (XCAR (XCDR (error_data)))) Vdelayed_warnings_list = Fcons (list2 (XCAR (error_data), XCAR (XCDR (error_data))), @@ -27091,7 +27092,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, oprops = Fcopy_sequence (oprops); tem = props; - while (CONSP (tem)) + while (CONSP (tem) && CONSP (XCDR (tem))) { oprops = plist_put (oprops, XCAR (tem), XCAR (XCDR (tem))); From 96d52f894441c06d7fdc10617e707f410ad66cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Thu, 27 Jul 2023 16:13:54 +0200 Subject: [PATCH 07/12] Fix function help for advised aliases (bug#64797) * lisp/help-fns.el (help-fns--analyze-function): For aliases, use the base function name if at the end of the chain. This fixes a regression introduced in d30fde6b0cc. Reported by Michael Heerdegen. (cherry picked from commit 024bd1f09099ae186442001a75e578638070e296) --- lisp/help-fns.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index be13d40cfa3..eb50f3b26ca 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -995,7 +995,8 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)." (symbol-name function))))))) (real-def (cond ((and aliased (not (subrp def))) - (car (function-alias-p real-function t))) + (or (car (function-alias-p real-function)) + real-function)) ((subrp def) (intern (subr-name def))) (t def)))) From 0002d4f31666719c5e972ca65efffc70750db613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Date: Fri, 28 Jul 2023 12:21:42 +0200 Subject: [PATCH 08/12] Avoid spurious whitespace in the modeline of emacsclient frames * lisp/bindings.el (mode-line-client): Compute 'help-echotext property in advance. (Bug#58183) (cherry picked from commit 8c3338f6ba354218aee12c223d778be4180f892b) --- lisp/bindings.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index f4881ac388c..6db043e495c 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -226,9 +226,9 @@ mnemonics of the following coding systems: (put 'mode-line-mule-info 'risky-local-variable t) (defvar mode-line-client - `("" - (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" ""))) - help-echo ,(purecopy "emacsclient frame"))) + `(:eval + (if (frame-parameter nil 'client) + ,(propertize "@" 'help-echo (purecopy "emacsclient frame")))) "Mode line construct for identifying emacsclient frames.") ;; Autoload if this file no longer dumped. ;;;###autoload From 7b9e83d3cf92abf1411c1999068839a7e1bb36e8 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 30 Jul 2023 21:18:54 +0800 Subject: [PATCH 09/12] Fix bug#64923 * src/xfns.c (Fx_create_frame): Prevent cairo surface from being left without a desired size. (bug#64923) --- src/xfns.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/xfns.c b/src/xfns.c index 528ae61ca32..d723b1f7d7c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5109,6 +5109,17 @@ This function is an internal primitive--use `make-frame' instead. */) gui_default_parameter (f, parms, Qfullscreen, Qnil, "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); +#ifdef USE_CAIRO + /* Set the initial size of the Cairo surface to the frame's current + width and height. If the window manager doesn't resize the new + frame after it's first mapped, Emacs will create a surface with + empty dimensions in response to to the initial exposure event, + which will persist until the next time it's resized. + (bug#64923) */ + x_cr_update_surface_desired_size (f, FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f)); +#endif /* USE_CAIRO */ + /* Make the window appear on the frame and enable display, unless the caller says not to. However, with explicit parent, Emacs cannot control visibility, so don't try. */ From 092a2ecb083d9f3e301c5b9bf23e0f2f666fec27 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 30 Jul 2023 18:08:27 +0300 Subject: [PATCH 10/12] ; * admin/make-tarball.txt: Update based on latest experiences. --- admin/make-tarball.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index 1cc97c883af..fddf8444067 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -426,6 +426,13 @@ Now change to the 'manual' directory and invoke upload-manuals: If upload-manuals fails, resolve the problems and re-invoke it. This requires running make-manuals again, since upload-manuals destructively modifies the 'manual' directory where you invoke it. + + If new files fail to be "cvs add"ed, they need to be manually + removed from under /path/to/webpages/cvs/checkout before retrying + upload-manuals, because if they exist, they will not be handled as + "new" files, and will not be "cvs add"ed by the next run of the + script. + Also, upload-manuals invokes "cvs commit -f", so if you run it several times, some files will be committed more than once even though they were not changed in-between. Suck it up. From ba60070b81c4b507b856269031a17b99e9f5e77c Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 13 Jun 2023 13:53:31 +0100 Subject: [PATCH 11/12] Backport: Fix some tree-sitter :match regexps This was originally installed on 2023-06-17 in the emacs-29 release branch and later reverted. This backport follows the Emacs 29.1 release (bug#64019). The shy groups were caught by modified versions of the GNU ELPA packages xr and relint: - https://github.com/mattiase/xr/pull/6 - https://github.com/mattiase/relint/pull/14 * lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Quote special character in regexp. * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): * lisp/progmodes/js.el (js--plain-method-re): (js--treesit-font-lock-settings): * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Replace character alternative [\\d], which matches '\' or 'd', with the most likely intention [0-9]. Fix shy groups mistyped as optional colons. Remove unneeded numbered :match group in rust-ts-mode. (cherry picked from commit cd8d3f3379ec7179fac4bb8e9c40658be15a64f6) --- lisp/progmodes/java-ts-mode.el | 2 +- lisp/progmodes/js.el | 6 +++--- lisp/progmodes/ruby-ts-mode.el | 2 +- lisp/progmodes/rust-ts-mode.el | 13 ++++++++----- lisp/progmodes/typescript-ts-mode.el | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 463872dcbc8..7f2fc4188a3 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -168,7 +168,7 @@ the available version of Tree-sitter for java." :override t :feature 'constant `(((identifier) @font-lock-constant-face - (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face)) + (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) [(true) (false)] @font-lock-constant-face) :language 'java :override t diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 70048e5d26c..bbe3159f596 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -106,7 +106,7 @@ name.") (defconst js--plain-method-re (concat "^\\s-*?\\(" js--dotted-name-re "\\)\\.prototype" - "\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(\\(:?async[ \t\n]+\\)function\\)\\_>") + "\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(\\(?:async[ \t\n]+\\)function\\)\\_>") "Regexp matching an explicit JavaScript prototype \"method\" declaration. Group 1 is a (possibly-dotted) class name, group 2 is a method name, and group 3 is the `function' keyword.") @@ -3540,7 +3540,7 @@ Check if a node type is available, then return the right font lock rules." :language 'javascript :feature 'constant '(((identifier) @font-lock-constant-face - (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face)) + (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) [(true) (false) (null)] @font-lock-constant-face) @@ -3646,7 +3646,7 @@ Check if a node type is available, then return the right font lock rules." :feature 'number '((number) @font-lock-number-face ((identifier) @font-lock-number-face - (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face))) + (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face))) :language 'javascript :feature 'operator diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 91d65a2777b..4b951f7606f 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1021,7 +1021,7 @@ leading double colon is not added." (:match "\\`\\$[#\"'`:?]" @global_var)) ;; ?' ?" ?` are character literals. ((character) @char - (:match "\\`?[#\"'`:?]" @char)) + (:match "\\`\\?[#\"'`:?]" @char)) ;; Symbols like :+, :<=> or :foo=. ((simple_symbol) @symbol (:match "\\s." @symbol)) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index b55af0b49e3..999c1d7ae96 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -143,7 +143,7 @@ eol)) @font-lock-builtin-face))) ((identifier) @font-lock-type-face - (:match "\\`\\(:?Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face))) + (:match "\\`\\(?:Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face))) :language 'rust :feature 'comment @@ -232,9 +232,12 @@ (type_identifier) @font-lock-type-face ((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail)) ((scoped_identifier path: (identifier) @font-lock-type-face) - (:match - "\\`\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)\\'" - @font-lock-type-face)) + (:match ,(rx bos + (or "u8" "u16" "u32" "u64" "u128" "usize" + "i8" "i16" "i32" "i64" "i128" "isize" + "char" "str") + eos) + @font-lock-type-face)) ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope)) ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope)) (type_identifier) @font-lock-type-face) @@ -249,7 +252,7 @@ :feature 'constant `((boolean_literal) @font-lock-constant-face ((identifier) @font-lock-constant-face - (:match "\\`[A-Z][A-Z\\d_]*\\'" @font-lock-constant-face))) + (:match "\\`[A-Z][0-9A-Z_]*\\'" @font-lock-constant-face))) :language 'rust :feature 'variable diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index bacf9fbd08e..d234bf2f6e6 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -198,7 +198,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." :language language :feature 'constant `(((identifier) @font-lock-constant-face - (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face)) + (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) [(true) (false) (null)] @font-lock-constant-face) :language language @@ -345,7 +345,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." :feature 'number `((number) @font-lock-number-face ((identifier) @font-lock-number-face - (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face))) + (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face))) :language language :feature 'operator From 2b8796eea1979fe6891ab9d80cd126fe8980167a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sun, 30 Jul 2023 15:30:38 +0200 Subject: [PATCH 12/12] Fix rx wrong-code bug: ranges starting with ^ (rx (in (?^ . ?a))) was incorrectly translated to "[^-a]". Change it so that we get "[_-a^]" instead. * lisp/emacs-lisp/rx.el (rx--generate-alt): Split ranges starting with `^` occurring first in a non-negated character alternative. * test/lisp/emacs-lisp/rx-tests.el (rx-any): Add and adapt tests. (cherry picked from commit 5f5d668ac7917d61e9366fe0c3efd7b542671c3d) --- lisp/emacs-lisp/rx.el | 20 +++++++++++++------- test/lisp/emacs-lisp/rx-tests.el | 20 +++++++++++++++----- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 46f61c26bc4..30195cbae32 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -445,13 +445,19 @@ classes." (setcar dash-l ?.)) ; Reduce --x to .-x (setq items (nconc items '((?- . ?-)))))) - ;; Deal with leading ^ and range ^-x. - (when (and (consp (car items)) - (eq (caar items) ?^) - (cdr items)) - ;; Move ^ and ^-x to second place. - (setq items (cons (cadr items) - (cons (car items) (cddr items))))) + ;; Deal with leading ^ and range ^-x in non-negated set. + (when (and (eq (car-safe (car items)) ?^) + (not negated)) + (if (eq (cdar items) ?^) + ;; single leading ^ + (when (cdr items) + ;; Move the ^ to second place. + (setq items (cons (cadr items) + (cons (car items) (cddr items))))) + ;; Split ^-x to _-x^ + (setq items (cons (cons ?_ (cdar items)) + (cons '(?^ . ?^) + (cdr items)))))) (cond ;; Empty set: if negated, any char, otherwise match-nothing. diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 028250b7352..9c8628a8f26 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -112,23 +112,33 @@ (should (equal (rx (any "]" "^") (any "]" "-") (any "-" "^") (not (any "]" "^")) (not (any "]" "-")) (not (any "-" "^"))) - "[]^][]-][-^][^]^][^]-][^-^]")) + "[]^][]-][-^][^]^][^]-][^^-]")) (should (equal (rx (any "]" "^" "-") (not (any "]" "^" "-"))) "[]^-][^]^-]")) + (should (equal (rx (any "^-f") (any "^-f" "-") + (any "^-f" "z") (any "^-f" "z" "-")) + "[_-f^][_-f^-][_-f^z][_-f^z-]")) + (should (equal (rx (not (any "^-f")) (not (any "^-f" "-")) + (not (any "^-f" "z")) (not (any "^-f" "z" "-"))) + "[^^-f][^^-f-][^^-fz][^^-fz-]")) + (should (equal (rx (any "^-f" word) (any "^-f" "-" word)) + "[_-f^[:word:]][_-f^[:word:]-]")) + (should (equal (rx (not (any "^-f" word)) (not (any "^-f" "-" word))) + "[^^-f[:word:]][^^-f[:word:]-]")) (should (equal (rx (any "-" ascii) (any "^" ascii) (any "]" ascii)) "[[:ascii:]-][[:ascii:]^][][:ascii:]]")) (should (equal (rx (not (any "-" ascii)) (not (any "^" ascii)) (not (any "]" ascii))) - "[^[:ascii:]-][^[:ascii:]^][^][:ascii:]]")) + "[^[:ascii:]-][^^[:ascii:]][^][:ascii:]]")) (should (equal (rx (any "-]" ascii) (any "^]" ascii) (any "-^" ascii)) "[][:ascii:]-][]^[:ascii:]][[:ascii:]^-]")) (should (equal (rx (not (any "-]" ascii)) (not (any "^]" ascii)) (not (any "-^" ascii))) - "[^][:ascii:]-][^]^[:ascii:]][^[:ascii:]^-]")) + "[^][:ascii:]-][^]^[:ascii:]][^^[:ascii:]-]")) (should (equal (rx (any "-]^" ascii) (not (any "-]^" ascii))) "[]^[:ascii:]-][^]^[:ascii:]-]")) (should (equal (rx (any "^" lower upper) (not (any "^" lower upper))) - "[[:lower:]^[:upper:]][^[:lower:]^[:upper:]]")) + "[[:lower:]^[:upper:]][^^[:lower:][:upper:]]")) (should (equal (rx (any "-" lower upper) (not (any "-" lower upper))) "[[:lower:][:upper:]-][^[:lower:][:upper:]-]")) (should (equal (rx (any "]" lower upper) (not (any "]" lower upper))) @@ -143,7 +153,7 @@ "[]-a-][^]-a-]")) (should (equal (rx (any "--]") (not (any "--]")) (any "-" "^-a") (not (any "-" "^-a"))) - "[].-\\-][^].-\\-][-^-a][^-^-a]")) + "[].-\\-][^].-\\-][_-a^-][^^-a-]")) (should (equal (rx (not (any "!a" "0-8" digit nonascii))) "[^!0-8a[:digit:][:nonascii:]]")) (should (equal (rx (any) (not (any)))