aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-02-18 23:13:51 +0800
committerPo Lu2023-02-18 23:13:51 +0800
commitc045d5322c2c1658f215bf59d431fcc8f96ffc12 (patch)
treee273d3eaedf5a109f5e18b6581b41e9dec9412e0
parenta61f9cb77ced0607e4607bc5d82ae06165e6138d (diff)
parent97f24924df62303c944176510038f398370f8fb6 (diff)
downloademacs-c045d5322c2c1658f215bf59d431fcc8f96ffc12.tar.gz
emacs-c045d5322c2c1658f215bf59d431fcc8f96ffc12.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rw-r--r--doc/lispref/compile.texi86
-rw-r--r--doc/lispref/frames.texi40
-rw-r--r--etc/NEWS3
-rw-r--r--etc/NEWS.2920
-rw-r--r--lisp/calc/calc.el9
-rw-r--r--lisp/emacs-lisp/comp.el68
-rw-r--r--lisp/emacs-lisp/package.el7
-rw-r--r--lisp/faces.el6
-rw-r--r--lisp/files.el13
-rw-r--r--lisp/frame.el5
-rw-r--r--lisp/hi-lock.el1
-rw-r--r--lisp/loadup.el15
-rw-r--r--lisp/progmodes/cc-engine.el2
-rw-r--r--lisp/progmodes/elisp-mode.el4
-rw-r--r--lisp/progmodes/project.el31
-rw-r--r--lisp/startup.el12
-rw-r--r--lisp/subr.el7
-rw-r--r--lisp/time.el4
-rw-r--r--lisp/treesit.el9
-rw-r--r--src/comp.c98
-rw-r--r--src/data.c2
-rw-r--r--src/treesit.c26
-rw-r--r--src/xdisp.c11
-rw-r--r--test/lisp/hi-lock-tests.el143
24 files changed, 383 insertions, 239 deletions
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index be2125a9ab3..cdbf64036da 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -849,7 +849,12 @@ from writing its results, the @file{*.eln} files, into a subdirectory
849of @code{user-emacs-directory} (@pxref{Init File}). You can do that 849of @code{user-emacs-directory} (@pxref{Init File}). You can do that
850by either changing the value of @code{native-comp-eln-load-path} 850by either changing the value of @code{native-comp-eln-load-path}
851(@pxref{Native-Compilation Variables}) or by temporarily pointing the 851(@pxref{Native-Compilation Variables}) or by temporarily pointing the
852@env{HOME} environment variable to a non-existing directory. 852@env{HOME} environment variable to a non-existing directory. Note
853that the latter technique might still produce a small number of
854@file{*.eln} files if Emacs needs to generate @dfn{trampolines}, which
855are used if Lisp primitives are advised or redefined in your Lisp code
856that is being natively compiled. @xref{Native-Compilation Variables,
857trampolines}.
853 858
854@menu 859@menu
855* Native-Compilation Functions:: Functions to natively-compile Lisp. 860* Native-Compilation Functions:: Functions to natively-compile Lisp.
@@ -981,24 +986,6 @@ whether native-compilation is available should use this predicate.
981 This section documents the variables that control 986 This section documents the variables that control
982native-compilation. 987native-compilation.
983 988
984@defvar inhibit-automatic-native-compilation
985If your Emacs has support for native compilation, Emacs will (by
986default) compile the Lisp files you're loading in the background, and
987then install the native-compiled versions of the functions. If you
988wish to disable this, you can set this variable to non-@code{nil}. If
989you want to set it permanently, this should probably be done from the
990early init file, since setting it in the normal init file is probably
991too late.
992
993While setting this variable disables automatic compilation of Lisp
994files, the compiler may still be invoked to install @dfn{trampolines}
995if any built-in functions are redefined. However, these trampolines
996will not get written to your cache directory.
997
998You can also use the @samp{EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION}
999environment variable to disable native compilation.
1000@end defvar
1001
1002@defopt native-comp-speed 989@defopt native-comp-speed
1003This variable specifies the optimization level for native compilation. 990This variable specifies the optimization level for native compilation.
1004Its value should be a number between @minus{}1 and 3. Values between 991Its value should be a number between @minus{}1 and 3. Values between
@@ -1093,3 +1080,64 @@ The directories in this list are also used for writing the
1093specifically, Emacs will write these files into the first writable 1080specifically, Emacs will write these files into the first writable
1094directory in the list. Thus, you can control where native-compilation 1081directory in the list. Thus, you can control where native-compilation
1095stores the results by changing the value of this variable. 1082stores the results by changing the value of this variable.
1083
1084@cindex disable asynchronous native compilation
1085@cindex inhibit asynchronous native compilation
1086@cindex asynchronous native compilation, disable
1087@defvar native-comp-jit-compilation
1088This variable, if non-@code{nil}, enables asynchronous (a.k.a.@:
1089@dfn{just-in-time}, or @acronym{JIT}) native compilation of the
1090@file{*.elc} files loaded by Emacs for which the corresponding
1091@file{*.eln} files do not already exist. This JIT compilation uses
1092separate Emacs sub-processes running in batch mode, according to the
1093value of @code{native-comp-async-jobs-number}. When the JIT
1094compilation of a Lisp file finishes successfully, the resulting
1095@file{.eln} file is loaded and its code replaces the definition of
1096functions provided by the @file{.elc} file.
1097@end defvar
1098
1099@cindex trampolines, in native compilation
1100 Setting the value of @code{native-comp-jit-compilation} to@code{nil}
1101disables JIT native compilation. However, even when JIT native
1102compilation is disabled, Emacs might still need to start asynchronous
1103native compilation subprocesses to produce @dfn{trampolines}. To
1104control this, use a separate variable, described below.
1105
1106@defvar native-comp-enable-subr-trampolines
1107This variable controls generation of trampolines. A trampoline is a
1108small piece of native code required to allow calling Lisp primitives,
1109which were advised or redefined, from Lisp code that was
1110natively-compiled with @code{native-comp-speed} set to 2 or greater.
1111Emacs stores the generated trampolines on separate @file{*.eln} files.
1112By default, this variable's value is @code{t}, which enables the
1113generation of trampoline files; setting it to @code{nil} disables the
1114generation of trampolines. Note that if a trampoline needed for
1115advising or redefining a primitive is not available and cannot be
1116generated, calls to that primitive from natively-compiled Lisp will
1117ignore redefinitions and advices, and will behave as if the primitive
1118was called directly from C. Therefore, we don't recommend disabling
1119the trampoline generation, unless you know that all the trampolines
1120needed by your Lisp programs are already compiled and accessible to
1121Emacs.
1122
1123The value of this variable can also be a string, in which case it is
1124interpreted as the name of a directory in which to store the generated
1125trampoline @file{*.eln} files, overriding the directories specified by
1126@code{native-comp-eln-load-path}. This is useful if you want the
1127trampolines to be generated as needed, but don't want to store them
1128under the user's @env{HOME} directory or the other public directories
1129where @file{*.eln} files are kept. However, unlike with directories
1130in @code{native-comp-eln-load-path}, the trampolines will be stored in
1131the directory given by the value of this variable, not in its
1132version-specific subdirectory.
1133
1134If this variable is non-@code{nil}, and Emacs needs to produce a
1135trampoline, but it cannot find any writable directory to store the
1136trampoline, it will store it inside @code{temporary-file-directory}
1137(@pxref{Unique File Names}).
1138
1139Trampolines produced when no writable directory is found to store
1140them, or when this variable is a string, will only be available for
1141the duration of the current Emacs session, because Emacs doesn't look
1142for trampolines in either of these places.
1143@end defvar
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 6ffefe8184f..3f51f55c7e1 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1475,19 +1475,24 @@ in this frame. Its value is @code{color}, @code{grayscale} or
1475 1475
1476@vindex title@r{, a frame parameter} 1476@vindex title@r{, a frame parameter}
1477@item title 1477@item title
1478If a frame has a non-@code{nil} title, it appears in the window 1478If a frame has a non-@code{nil} title, that title appears in the window
1479system's title bar at the top of the frame, and also in the mode line 1479system's title bar at the top of the frame, and also in the mode line
1480of windows in that frame if @code{mode-line-frame-identification} uses 1480of windows in that frame if @code{mode-line-frame-identification} uses
1481@samp{%F} (@pxref{%-Constructs}). This is normally the case when 1481@samp{%F} (@pxref{%-Constructs}). This is normally the case when
1482Emacs is not using a window system, and can only display one frame at 1482Emacs is not using a window system, and can only display one frame at
1483a time. @xref{Frame Titles}. 1483a time. When Emacs is using a window system, this parameter, if
1484non-@code{nil}, overrides the title determined by the @code{name}
1485parameter and the implicit title calculated according to
1486@code{frame-title-format}. It also overrides the title determined by
1487@code{icon-title-format} for iconified frames. @xref{Frame Titles}.
1484 1488
1485@vindex name@r{, a frame parameter} 1489@vindex name@r{, a frame parameter}
1486@item name 1490@item name
1487The name of the frame. The frame name serves as a default for the frame 1491The name of the frame. If you don't specify a name via this
1488title, if the @code{title} parameter is unspecified or @code{nil}. If 1492parameter, Emacs sets the frame name automatically, as specified by
1489you don't specify a name, Emacs sets the frame name automatically 1493@code{frame-title-format} and @code{icon-title-format}, and that is
1490(@pxref{Frame Titles}). 1494the frame's title that will appear on display when Emacs uses a window
1495system (unless the @code{title} parameter overrides it).
1491 1496
1492If you specify the frame name explicitly when you create the frame, the 1497If you specify the frame name explicitly when you create the frame, the
1493name is also used (instead of the name of the Emacs executable) when 1498name is also used (instead of the name of the Emacs executable) when
@@ -2632,17 +2637,26 @@ frame name automatically based on a template stored in the variable
2632frame is redisplayed. 2637frame is redisplayed.
2633 2638
2634@defvar frame-title-format 2639@defvar frame-title-format
2635This variable specifies how to compute a name for a frame when you have 2640This variable specifies how to compute a name for a frame when you
2636not explicitly specified one. The variable's value is actually a mode 2641have not explicitly specified one (via the frame's parameters;
2642@pxref{Basic Parameters}). The variable's value is actually a mode
2637line construct, just like @code{mode-line-format}, except that the 2643line construct, just like @code{mode-line-format}, except that the
2638@samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored. @xref{Mode Line 2644@samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored.
2639Data}. 2645@xref{Mode Line Data}.
2640@end defvar 2646@end defvar
2641 2647
2642@defvar icon-title-format 2648@defvar icon-title-format
2643This variable specifies how to compute the name for an iconified frame, 2649This variable specifies how to compute the name for an iconified frame
2644when you have not explicitly specified the frame title. This title 2650when you have not explicitly specified the frame's name via the
2645appears in the icon itself. 2651frame's parameters. The resulting title appears in the frame's icon
2652itself. If the value is a string, is should be a mode line construct
2653like that of @code{frame-title-format}. The value can also be
2654@code{t}, which means to use @code{frame-title-format} instead; this
2655avoids problems with some window managers and desktop environments,
2656where a change in a frame's title (when a frame is iconified) is
2657interpreted as a request to raise the frame and/or give it input
2658focus. The default is a string identical to the default value of
2659@code{frame-title-format}.
2646@end defvar 2660@end defvar
2647 2661
2648@defvar multiple-frames 2662@defvar multiple-frames
diff --git a/etc/NEWS b/etc/NEWS
index 94e41df8f3c..af37633db83 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -63,7 +63,7 @@ This allows the user to customize the prompt that is appended by
63"(yes or no) ". 63"(yes or no) ".
64 64
65--- 65---
66** New face 'display-time-time-and-date-indicator'. 66** New face 'display-time-date-and-time'.
67This is used for displaying the time and date components of 67This is used for displaying the time and date components of
68'display-time-mode'. 68'display-time-mode'.
69 69
@@ -305,7 +305,6 @@ define "sexps" in tree-sitter enabled modes.
305Tree-sitter conditionally sets 'forward-sexp-function' for major modes 305Tree-sitter conditionally sets 'forward-sexp-function' for major modes
306that have defined 'treesit-sexp-type-regexp' to enable sexp-related 306that have defined 'treesit-sexp-type-regexp' to enable sexp-related
307motion commands. 307motion commands.
308>>>>>>> origin/master
309 308
310** New or changed byte-compilation warnings 309** New or changed byte-compilation warnings
311 310
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index 35063678f58..b140d1dcbfd 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -199,13 +199,6 @@ load time.
199** Native Compilation 199** Native Compilation
200 200
201+++ 201+++
202*** New variable 'inhibit-automatic-native-compilation'.
203If set, Emacs will inhibit native compilation (and won't write
204anything to the eln cache automatically). The variable is initialized
205during Emacs startup from the environment variable
206'EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION'.
207
208---
209*** New command 'native-compile-prune-cache'. 202*** New command 'native-compile-prune-cache'.
210This command deletes old subdirectories of the eln cache (but not the 203This command deletes old subdirectories of the eln cache (but not the
211ones for the current Emacs version). Note that subdirectories of the 204ones for the current Emacs version). Note that subdirectories of the
@@ -1202,6 +1195,13 @@ the most recently deleted frame. With a numerical prefix argument
1202between 1 and 16, where 1 is the most recently deleted frame, undelete 1195between 1 and 16, where 1 is the most recently deleted frame, undelete
1203the corresponding deleted frame. 1196the corresponding deleted frame.
1204 1197
1198+++
1199*** The variable 'icon-title-format' can now have the value t.
1200That value means to use 'frame-title-format' for iconified frames.
1201This is useful with some window managers and desktop environments
1202which treat changes in frame's title as requests to raise the frame
1203and/or give it input focus.
1204
1205** Tab Bars and Tab Lines 1205** Tab Bars and Tab Lines
1206 1206
1207--- 1207---
@@ -3251,8 +3251,10 @@ for which a "built-in" mode would be turned on. For example:
3251 (add-to-list 'major-mode-remap-alist '(ruby-mode . ruby-ts-mode)) 3251 (add-to-list 'major-mode-remap-alist '(ruby-mode . ruby-ts-mode))
3252 3252
3253If you try these modes and don't like them, you can go back to the 3253If you try these modes and don't like them, you can go back to the
3254"built-in" modes by restarting Emacs. But please tell us why you 3254"built-in" modes by restarting Emacs. (If you use desktop.el to save
3255didn't like the tree-sitter based modes, so that we could try 3255and restore Emacs sessions, make sure no buffer under these modes is
3256recorded in the desktop file, before restarting.) But please tell us
3257why you didn't like the tree-sitter based modes, so that we could try
3256improving them. 3258improving them.
3257 3259
3258Each major mode based on tree-sitter needs a language grammar library, 3260Each major mode based on tree-sitter needs a language grammar library,
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 26556bf056a..1da4f9ad738 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1286,16 +1286,17 @@ the trail buffer."
1286(defun calc-mode () 1286(defun calc-mode ()
1287 "Calculator major mode. 1287 "Calculator major mode.
1288 1288
1289This is an RPN calculator featuring arbitrary-precision integer, rational, 1289This is a Reverse Polish notation (RPN) calculator featuring
1290floating-point, complex, matrix, and symbolic arithmetic. 1290arbitrary-precision integer, rational, floating-point, complex,
1291matrix, and symbolic arithmetic.
1291 1292
1292RPN calculation: 2 RET 3 + produces 5. 1293RPN calculation: 2 RET 3 + produces 5.
1293Algebraic style: \\=' 2+3 RET produces 5. 1294Algebraic style: \\=' 2+3 RET produces 5.
1294 1295
1295Basic operators are +, -, *, /, ^, & (reciprocal), % (modulo), n (change-sign). 1296Basic operators are +, -, *, /, ^, & (reciprocal), % (modulo), n (change-sign).
1296 1297
1297Press ? repeatedly for more complete help. Press `h i' to read the 1298Press \\`?' repeatedly for more complete help. Press \\`h i' to read the
1298Calc manual on-line, `h s' to read the summary, or `h t' for the tutorial. 1299Calc manual, \\`h s' to read the summary, or \\`h t' for the tutorial.
1299 1300
1300Notations: 3.14e6 3.14 * 10^6 1301Notations: 3.14e6 3.14 * 10^6
1301 _23 negative number -23 (or type `23 n') 1302 _23 negative number -23 (or type `23 n')
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index d2e7d933f4f..5e707d2d631 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -85,13 +85,17 @@ This is intended for debugging the compiler itself.
85 :type 'boolean 85 :type 'boolean
86 :version "28.1") 86 :version "28.1")
87 87
88(defcustom native-comp-deferred-compilation-deny-list 88(defcustom native-comp-jit-compilation-deny-list
89 '() 89 '()
90 "List of regexps to exclude matching files from deferred native compilation. 90 "List of regexps to exclude matching files from deferred native compilation.
91Files whose names match any regexp are excluded from native compilation." 91Files whose names match any regexp are excluded from native compilation."
92 :type '(repeat regexp) 92 :type '(repeat regexp)
93 :version "28.1") 93 :version "28.1")
94 94
95(make-obsolete-variable 'native-comp-deferred-compilation-deny-list
96 'native-comp-jit-compilation-deny-list
97 "29.1")
98
95(defcustom native-comp-bootstrap-deny-list 99(defcustom native-comp-bootstrap-deny-list
96 '() 100 '()
97 "List of regexps to exclude files from native compilation during bootstrap. 101 "List of regexps to exclude files from native compilation during bootstrap.
@@ -105,7 +109,11 @@ during bootstrap."
105 ;; correctly (see comment in `advice--add-function'). DO NOT 109 ;; correctly (see comment in `advice--add-function'). DO NOT
106 ;; REMOVE. 110 ;; REMOVE.
107 macroexpand rename-buffer) 111 macroexpand rename-buffer)
108 "Primitive functions to exclude from trampoline optimization." 112 "Primitive functions to exclude from trampoline optimization.
113
114Primitive functions included in this list will not be called
115directly by the natively-compiled code, which makes trampolines for
116those primitives unnecessary in case of function redefinition/advice."
109 :type '(repeat symbol) 117 :type '(repeat symbol)
110 :version "28.1") 118 :version "28.1")
111 119
@@ -695,7 +703,7 @@ Useful to hook into pass checkers.")
695;;;###autoload 703;;;###autoload
696(defun comp-subr-trampoline-install (subr-name) 704(defun comp-subr-trampoline-install (subr-name)
697 "Make SUBR-NAME effectively advice-able when called from native code." 705 "Make SUBR-NAME effectively advice-able when called from native code."
698 (unless (or (null comp-enable-subr-trampolines) 706 (unless (or (null native-comp-enable-subr-trampolines)
699 (memq subr-name native-comp-never-optimize-functions) 707 (memq subr-name native-comp-never-optimize-functions)
700 (gethash subr-name comp-installed-trampolines-h)) 708 (gethash subr-name comp-installed-trampolines-h))
701 (cl-assert (subr-primitive-p (symbol-function subr-name))) 709 (cl-assert (subr-primitive-p (symbol-function subr-name)))
@@ -3782,6 +3790,32 @@ Return the trampoline if found or nil otherwise."
3782 when (file-exists-p filename) 3790 when (file-exists-p filename)
3783 do (cl-return (native-elisp-load filename)))) 3791 do (cl-return (native-elisp-load filename))))
3784 3792
3793(defun comp--trampoline-abs-filename (subr-name)
3794 "Return the absolute filename for a trampoline for SUBR-NAME."
3795 (cl-loop
3796 with dirs = (if (stringp native-comp-enable-subr-trampolines)
3797 (list native-comp-enable-subr-trampolines)
3798 (if native-compile-target-directory
3799 (list (expand-file-name comp-native-version-dir
3800 native-compile-target-directory))
3801 (comp-eln-load-path-eff)))
3802 with rel-filename = (comp-trampoline-filename subr-name)
3803 for dir in dirs
3804 for abs-filename = (expand-file-name rel-filename dir)
3805 unless (file-exists-p dir)
3806 do (ignore-errors
3807 (make-directory dir t)
3808 (cl-return abs-filename))
3809 when (file-writable-p abs-filename)
3810 do (cl-return abs-filename)
3811 ;; Default to some temporary directory if no better option was
3812 ;; found.
3813 finally (cl-return
3814 (expand-file-name
3815 (make-temp-file-internal (file-name-sans-extension rel-filename)
3816 0 ".eln" nil)
3817 temporary-file-directory))))
3818
3785(defun comp-trampoline-compile (subr-name) 3819(defun comp-trampoline-compile (subr-name)
3786 "Synthesize compile and return a trampoline for SUBR-NAME." 3820 "Synthesize compile and return a trampoline for SUBR-NAME."
3787 (let* ((lambda-list (comp-make-lambda-list-from-subr 3821 (let* ((lambda-list (comp-make-lambda-list-from-subr
@@ -3803,25 +3837,7 @@ Return the trampoline if found or nil otherwise."
3803 (lexical-binding t)) 3837 (lexical-binding t))
3804 (comp--native-compile 3838 (comp--native-compile
3805 form nil 3839 form nil
3806 ;; If we've disabled nativecomp, don't write the trampolines to 3840 (comp--trampoline-abs-filename subr-name))))
3807 ;; the eln cache (but create them).
3808 (unless inhibit-automatic-native-compilation
3809 (cl-loop
3810 for dir in (if native-compile-target-directory
3811 (list (expand-file-name comp-native-version-dir
3812 native-compile-target-directory))
3813 (comp-eln-load-path-eff))
3814 for f = (expand-file-name
3815 (comp-trampoline-filename subr-name)
3816 dir)
3817 unless (file-exists-p dir)
3818 do (ignore-errors
3819 (make-directory dir t)
3820 (cl-return f))
3821 when (file-writable-p f)
3822 do (cl-return f)
3823 finally (error "Cannot find suitable directory for output in \
3824`native-comp-eln-load-path'"))))))
3825 3841
3826 3842
3827;; Some entry point support code. 3843;; Some entry point support code.
@@ -4110,14 +4126,12 @@ the deferred compilation mechanism."
4110 data 4126 data
4111 ;; So we return the compiled function. 4127 ;; So we return the compiled function.
4112 (native-elisp-load data))) 4128 (native-elisp-load data)))
4113 ;; We may have created a temporary file when we're being
4114 ;; called with something other than a file as the argument.
4115 ;; Delete it if we can.
4116 (when (and (not (stringp function-or-file)) 4129 (when (and (not (stringp function-or-file))
4117 (not output) 4130 (not output)
4118 comp-ctxt 4131 comp-ctxt
4119 (comp-ctxt-output comp-ctxt) 4132 (comp-ctxt-output comp-ctxt)
4120 (file-exists-p (comp-ctxt-output comp-ctxt))) 4133 (file-exists-p (comp-ctxt-output comp-ctxt)))
4134 ;; NOTE: Not sure if we want to remove this or being cautious.
4121 (cond ((eq 'windows-nt system-type) 4135 (cond ((eq 'windows-nt system-type)
4122 ;; We may still be using the temporary .eln file. 4136 ;; We may still be using the temporary .eln file.
4123 (ignore-errors (delete-file (comp-ctxt-output comp-ctxt)))) 4137 (ignore-errors (delete-file (comp-ctxt-output comp-ctxt))))
@@ -4137,11 +4151,11 @@ LOAD and SELECTOR work as described in `native--compile-async'."
4137 (t (error "SELECTOR must be a function a regexp or nil"))) 4151 (t (error "SELECTOR must be a function a regexp or nil")))
4138 ;; Also exclude files from deferred compilation if 4152 ;; Also exclude files from deferred compilation if
4139 ;; any of the regexps in 4153 ;; any of the regexps in
4140 ;; `native-comp-deferred-compilation-deny-list' matches. 4154 ;; `native-comp-jit-compilation-deny-list' matches.
4141 (and (eq load 'late) 4155 (and (eq load 'late)
4142 (cl-some (lambda (re) 4156 (cl-some (lambda (re)
4143 (string-match-p re file)) 4157 (string-match-p re file))
4144 native-comp-deferred-compilation-deny-list)))) 4158 native-comp-jit-compilation-deny-list))))
4145 4159
4146(defun native--compile-async (files &optional recursively load selector) 4160(defun native--compile-async (files &optional recursively load selector)
4147 ;; BEWARE, this function is also called directly from C. 4161 ;; BEWARE, this function is also called directly from C.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 09917cd29b1..a0bb5e75393 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -378,10 +378,8 @@ If so, and variable `package-check-signature' is
378`allow-unsigned', return `allow-unsigned', otherwise return the 378`allow-unsigned', return `allow-unsigned', otherwise return the
379value of variable `package-check-signature'." 379value of variable `package-check-signature'."
380 (if (eq package-check-signature 'allow-unsigned) 380 (if (eq package-check-signature 'allow-unsigned)
381 (progn 381 (and (epg-find-configuration 'OpenPGP)
382 (require 'epg-config) 382 'allow-unsigned)
383 (and (epg-find-configuration 'OpenPGP)
384 'allow-unsigned))
385 package-check-signature)) 383 package-check-signature))
386 384
387(defcustom package-unsigned-archives nil 385(defcustom package-unsigned-archives nil
@@ -958,7 +956,6 @@ Newer versions are always activated, regardless of FORCE."
958 "Untar the current buffer. 956 "Untar the current buffer.
959This uses `tar-untar-buffer' from Tar mode. All files should 957This uses `tar-untar-buffer' from Tar mode. All files should
960untar into a directory named DIR; otherwise, signal an error." 958untar into a directory named DIR; otherwise, signal an error."
961 (require 'tar-mode)
962 (tar-mode) 959 (tar-mode)
963 ;; Make sure everything extracts into DIR. 960 ;; Make sure everything extracts into DIR.
964 (let ((regexp (concat "\\`" (regexp-quote (expand-file-name dir)) "/")) 961 (let ((regexp (concat "\\`" (regexp-quote (expand-file-name dir)) "/"))
diff --git a/lisp/faces.el b/lisp/faces.el
index 7fe2cccba90..830d3b7a49a 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -191,7 +191,7 @@ For internal use only."
191 (let ((face-id (car (gethash face face--new-frame-defaults)))) 191 (let ((face-id (car (gethash face face--new-frame-defaults))))
192 (push `(,face-id ,face . ,spec) faces))) 192 (push `(,face-id ,face . ,spec) faces)))
193 (frame--face-hash-table frame)) 193 (frame--face-hash-table frame))
194 (mapcar #'cdr (sort faces (lambda (f1 f2) (< (car f1) (car f2))))))) 194 (mapcar #'cdr (sort faces (lambda (f1 f2) (> (car f1) (car f2)))))))
195 195
196(defun face-list () 196(defun face-list ()
197 "Return a list of all defined faces." 197 "Return a list of all defined faces."
@@ -199,7 +199,7 @@ For internal use only."
199 (maphash (lambda (face spec) 199 (maphash (lambda (face spec)
200 (push `(,(car spec) . ,face) faces)) 200 (push `(,(car spec) . ,face) faces))
201 face--new-frame-defaults) 201 face--new-frame-defaults)
202 (mapcar #'cdr (sort faces (lambda (f1 f2) (< (car f1) (car f2))))))) 202 (mapcar #'cdr (sort faces (lambda (f1 f2) (> (car f1) (car f2)))))))
203 203
204(defun make-face (face) 204(defun make-face (face)
205 "Define a new face with name FACE, a symbol. 205 "Define a new face with name FACE, a symbol.
@@ -2226,7 +2226,7 @@ the X resource \"reverseVideo\" is present, handle that."
2226 (unwind-protect 2226 (unwind-protect
2227 (progn 2227 (progn
2228 (x-setup-function-keys frame) 2228 (x-setup-function-keys frame)
2229 (dolist (face (nreverse (face-list))) 2229 (dolist (face (face-list))
2230 (face-spec-recalc face frame)) 2230 (face-spec-recalc face frame))
2231 (x-handle-reverse-video frame parameters) 2231 (x-handle-reverse-video frame parameters)
2232 (frame-set-background-mode frame t) 2232 (frame-set-background-mode frame t)
diff --git a/lisp/files.el b/lisp/files.el
index b0ec6bb09d0..5b989902bc3 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6360,7 +6360,18 @@ If FILE1 or FILE2 does not exist, the return value is unspecified."
6360 (let (f1-attr f2-attr) 6360 (let (f1-attr f2-attr)
6361 (and (setq f1-attr (file-attributes (file-truename file1))) 6361 (and (setq f1-attr (file-attributes (file-truename file1)))
6362 (setq f2-attr (file-attributes (file-truename file2))) 6362 (setq f2-attr (file-attributes (file-truename file2)))
6363 (equal f1-attr f2-attr)))))) 6363 (progn
6364 ;; Haiku systems change the file's last access timestamp
6365 ;; every time `stat' is called. Make sure to not compare
6366 ;; the timestamps in that case.
6367 (or (equal f1-attr f2-attr)
6368 (when (and (eq system-type 'haiku)
6369 (consp (nthcdr 4 f1-attr))
6370 (consp (nthcdr 4 f2-attr)))
6371 (ignore-errors
6372 (setcar (nthcdr 4 f1-attr) nil)
6373 (setcar (nthcdr 4 f2-attr) nil))
6374 (equal f1-attr f2-attr)))))))))
6364 6375
6365(defun file-in-directory-p (file dir) 6376(defun file-in-directory-p (file dir)
6366 "Return non-nil if DIR is a parent directory of FILE. 6377 "Return non-nil if DIR is a parent directory of FILE.
diff --git a/lisp/frame.el b/lisp/frame.el
index d925a87153c..3fd8dbbdc36 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2142,8 +2142,9 @@ frame's display)."
2142 ;; a toggle. 2142 ;; a toggle.
2143 (featurep 't-mouse) 2143 (featurep 't-mouse)
2144 ;; No way to check whether a w32 console has a mouse, assume 2144 ;; No way to check whether a w32 console has a mouse, assume
2145 ;; it always does. 2145 ;; it always does, except in batch invocations.
2146 (boundp 'w32-use-full-screen-buffer)))))) 2146 (and (not noninteractive)
2147 (boundp 'w32-use-full-screen-buffer)))))))
2147 2148
2148(defun display-popup-menus-p (&optional display) 2149(defun display-popup-menus-p (&optional display)
2149 "Return non-nil if popup menus are supported on DISPLAY. 2150 "Return non-nil if popup menus are supported on DISPLAY.
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 78fc5e6f716..5c536b190fb 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -611,6 +611,7 @@ then remove all hi-lock highlighting."
611 (cond 611 (cond
612 (current-prefix-arg (list t)) 612 (current-prefix-arg (list t))
613 ((and (display-popup-menus-p) 613 ((and (display-popup-menus-p)
614 last-nonmenu-event
614 (listp last-nonmenu-event) 615 (listp last-nonmenu-event)
615 use-dialog-box) 616 use-dialog-box)
616 (catch 'snafu 617 (catch 'snafu
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 3b30414b146..f6f48b3b735 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -594,7 +594,7 @@ lost after dumping")))
594 (equal dump-mode "pdump")) 594 (equal dump-mode "pdump"))
595 ;; Don't enable this before bootstrap is completed, as the 595 ;; Don't enable this before bootstrap is completed, as the
596 ;; compiler infrastructure may not be usable yet. 596 ;; compiler infrastructure may not be usable yet.
597 (setq comp-enable-subr-trampolines t)) 597 (setq native-comp-enable-subr-trampolines t))
598 (message "Dumping under the name %s" output) 598 (message "Dumping under the name %s" output)
599 (condition-case () 599 (condition-case ()
600 (delete-file output) 600 (delete-file output)
@@ -644,10 +644,17 @@ lost after dumping")))
644 (message "Adding name %s" (concat name ".pdmp")) 644 (message "Adding name %s" (concat name ".pdmp"))
645 (add-name-to-file (expand-file-name "emacs.pdmp" 645 (add-name-to-file (expand-file-name "emacs.pdmp"
646 invocation-directory) 646 invocation-directory)
647 (expand-file-name (concat name ".pdmp") 647 (expand-file-name (concat name exe)
648 invocation-directory) 648 invocation-directory)
649 t)))) 649 t)
650 (kill-emacs)))) 650 (when (equal dump-mode "pdump")
651 (message "Adding name %s" (concat name ".pdmp"))
652 (add-name-to-file (expand-file-name "emacs.pdmp"
653 invocation-directory)
654 (expand-file-name (concat name ".pdmp")
655 invocation-directory)
656 t))))
657 (kill-emacs)))))
651 658
652;; This file must be loaded each time Emacs is run from scratch, e.g., temacs. 659;; This file must be loaded each time Emacs is run from scratch, e.g., temacs.
653;; So run the startup code now. First, remove `-l loadup' from args. 660;; So run the startup code now. First, remove `-l loadup' from args.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index f8ae49c42dd..037a53421a8 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -14951,7 +14951,7 @@ comment at the start of cc-engine.el for more info."
14951 'case-label) 14951 'case-label)
14952 (1+ containing-sexp))) 14952 (1+ containing-sexp)))
14953 (t (c-add-syntax (if (eq (char-before) ?:) 14953 (t (c-add-syntax (if (eq (char-before) ?:)
14954 'case-label 14954 'case-label
14955 'statement-case-intro) 14955 'statement-case-intro)
14956 (1+ containing-sexp)))))) 14956 (1+ containing-sexp))))))
14957 14957
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index be969b0c3e3..1c339d08148 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -220,8 +220,8 @@ All commands in `lisp-mode-shared-map' are inherited by this map."
220Load the compiled code when finished. 220Load the compiled code when finished.
221 221
222Use `emacs-lisp-byte-compile-and-load' in combination with 222Use `emacs-lisp-byte-compile-and-load' in combination with
223`inhibit-automatic-native-compilation' set to nil to achieve 223`native-comp-jit-compilation' set to t to achieve asynchronous
224asynchronous native compilation." 224native compilation."
225 (interactive nil emacs-lisp-mode) 225 (interactive nil emacs-lisp-mode)
226 (emacs-lisp--before-compile-buffer) 226 (emacs-lisp--before-compile-buffer)
227 (load (native-compile buffer-file-name))) 227 (load (native-compile buffer-file-name)))
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 2343adf4698..1228c73fee8 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1,7 +1,7 @@
1;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- 1;;; project.el --- Operations on the current project -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2015-2023 Free Software Foundation, Inc. 3;; Copyright (C) 2015-2023 Free Software Foundation, Inc.
4;; Version: 0.9.6 4;; Version: 0.9.7
5;; Package-Requires: ((emacs "26.1") (xref "1.4.0")) 5;; Package-Requires: ((emacs "26.1") (xref "1.4.0"))
6 6
7;; This is a GNU ELPA :core package. Avoid using functionality that 7;; This is a GNU ELPA :core package. Avoid using functionality that
@@ -494,6 +494,23 @@ files related to the current buffer.
494The directory names should be absolute. Used in the VC-aware 494The directory names should be absolute. Used in the VC-aware
495project backend implementation of `project-external-roots'.") 495project backend implementation of `project-external-roots'.")
496 496
497(defvar project-vc-backend-markers-alist
498 `((Git . ".git")
499 (Hg . ".hg")
500 (Bzr . ".bzr")
501 ;; See the comment above `vc-svn-admin-directory' for why we're
502 ;; duplicating the definition.
503 (SVN . ,(if (and (memq system-type '(cygwin windows-nt ms-dos))
504 (getenv "SVN_ASP_DOT_NET_HACK"))
505 "_svn"
506 ".svn"))
507 (DARCS . "_darcs")
508 (Fossil . ".fslckout")
509 (Got . ".got"))
510 "Associative list assigning root markers to VC backend symbols.
511
512See `project-vc-extra-root-markers' for the marker value format.")
513
497(defun project-try-vc (dir) 514(defun project-try-vc (dir)
498 (defvar vc-svn-admin-directory) 515 (defvar vc-svn-admin-directory)
499 (require 'vc-svn) 516 (require 'vc-svn)
@@ -501,17 +518,11 @@ project backend implementation of `project-external-roots'.")
501 ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers' 518 ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers'
502 ;; changes. 519 ;; changes.
503 (or (vc-file-getprop dir 'project-vc) 520 (or (vc-file-getprop dir 'project-vc)
504 (let* ((backend-markers-alist `((Git . ".git") 521 (let* ((backend-markers
505 (Hg . ".hg")
506 (Bzr . ".bzr")
507 (SVN . ,vc-svn-admin-directory)
508 (DARCS . "_darcs")
509 (Fossil . ".fslckout")))
510 (backend-markers
511 (delete 522 (delete
512 nil 523 nil
513 (mapcar 524 (mapcar
514 (lambda (b) (assoc-default b backend-markers-alist)) 525 (lambda (b) (assoc-default b project-vc-backend-markers-alist))
515 vc-handled-backends))) 526 vc-handled-backends)))
516 (marker-re 527 (marker-re
517 (concat 528 (concat
@@ -537,7 +548,7 @@ project backend implementation of `project-external-roots'.")
537 (backend 548 (backend
538 (cl-find-if 549 (cl-find-if
539 (lambda (b) 550 (lambda (b)
540 (member (assoc-default b backend-markers-alist) 551 (member (assoc-default b project-vc-backend-markers-alist)
541 last-matches)) 552 last-matches))
542 vc-handled-backends)) 553 vc-handled-backends))
543 project) 554 project)
diff --git a/lisp/startup.el b/lisp/startup.el
index cfe20d4b720..fb14fbad17f 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -542,8 +542,8 @@ DIRS are relative."
542 (setq comp--compilable t)) 542 (setq comp--compilable t))
543 543
544(defvar native-comp-eln-load-path) 544(defvar native-comp-eln-load-path)
545(defvar inhibit-automatic-native-compilation) 545(defvar native-comp-jit-compilation)
546(defvar comp-enable-subr-trampolines) 546(defvar native-comp-enable-subr-trampolines)
547 547
548(defvar startup--original-eln-load-path nil 548(defvar startup--original-eln-load-path nil
549 "Original value of `native-comp-eln-load-path'.") 549 "Original value of `native-comp-eln-load-path'.")
@@ -592,10 +592,6 @@ It is the default value of the variable `top-level'."
592 (funcall 'android-enumerate-fonts) 592 (funcall 'android-enumerate-fonts)
593 (setq android-fonts-enumerated t)) 593 (setq android-fonts-enumerated t))
594 594
595 ;; Allow disabling automatic .elc->.eln processing.
596 (setq inhibit-automatic-native-compilation
597 (getenv "EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION"))
598
599 (if command-line-processed 595 (if command-line-processed
600 (message internal--top-level-message) 596 (message internal--top-level-message)
601 (setq command-line-processed t) 597 (setq command-line-processed t)
@@ -614,8 +610,8 @@ It is the default value of the variable `top-level'."
614 ;; in this session. This is necessary if libgccjit is not 610 ;; in this session. This is necessary if libgccjit is not
615 ;; available on MS-Windows, but Emacs was built with 611 ;; available on MS-Windows, but Emacs was built with
616 ;; native-compilation support. 612 ;; native-compilation support.
617 (setq inhibit-automatic-native-compilation t 613 (setq native-comp-jit-compilation nil
618 comp-enable-subr-trampolines nil)) 614 native-comp-enable-subr-trampolines nil))
619 615
620 ;; Form `native-comp-eln-load-path'. 616 ;; Form `native-comp-eln-load-path'.
621 (let ((path-env (getenv "EMACSNATIVELOADPATH"))) 617 (let ((path-env (getenv "EMACSNATIVELOADPATH")))
diff --git a/lisp/subr.el b/lisp/subr.el
index 439d6e3fbb5..33865aa326c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1935,8 +1935,13 @@ activations. To prevent runaway recursion, use `max-lisp-eval-depth'
1935instead; it will indirectly limit the specpdl stack size as well.") 1935instead; it will indirectly limit the specpdl stack size as well.")
1936(make-obsolete-variable 'max-specpdl-size nil "29.1") 1936(make-obsolete-variable 'max-specpdl-size nil "29.1")
1937 1937
1938(make-obsolete-variable 'comp-enable-subr-trampolines
1939 'native-comp-enable-subr-trampolines
1940 "29.1")
1941
1938(make-obsolete-variable 'native-comp-deferred-compilation 1942(make-obsolete-variable 'native-comp-deferred-compilation
1939 'inhibit-automatic-native-compilation "29.1") 1943 'native-comp-jit-compilation
1944 "29.1")
1940 1945
1941 1946
1942;;;; Alternate names for functions - these are not being phased out. 1947;;;; Alternate names for functions - these are not being phased out.
diff --git a/lisp/time.el b/lisp/time.el
index 030aef9d49b..522bec46ac6 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -139,7 +139,7 @@ make the mail indicator stand out on a color display."
139 :version "22.1" 139 :version "22.1"
140 :type '(choice (const :tag "None" nil) face)) 140 :type '(choice (const :tag "None" nil) face))
141 141
142(defface display-time-time-and-date-indicator nil 142(defface display-time-date-and-time nil
143 "Face for `display-time-format'." 143 "Face for `display-time-format'."
144 :group 'mode-line-faces 144 :group 'mode-line-faces
145 :version "30.1") 145 :version "30.1")
@@ -184,7 +184,7 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
184 (format-time-string (or display-time-format 184 (format-time-string (or display-time-format
185 (if display-time-24hr-format "%H:%M" "%-I:%M%p")) 185 (if display-time-24hr-format "%H:%M" "%-I:%M%p"))
186 now) 186 now)
187 'face 'display-time-time-and-date-indicator 187 'face 'display-time-date-and-time
188 'help-echo (format-time-string "%a %b %e, %Y" now)) 188 'help-echo (format-time-string "%a %b %e, %Y" now))
189 load 189 load
190 (if mail 190 (if mail
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 749781894b8..d7f34146852 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -166,10 +166,13 @@ parser in `treesit-parser-list', or nil if there is no parser."
166A leaf node is a node that doesn't have any child nodes. 166A leaf node is a node that doesn't have any child nodes.
167 167
168The returned node's span covers POS: the node's beginning is before 168The returned node's span covers POS: the node's beginning is before
169or at POS, and the node's end is at or after POS. 169or at POS, and the node's end is after POS.
170 170
171If no leaf node's span covers POS (e.g., POS is on whitespace 171If no such node exists, but there's a leaf node which ends at POS,
172between two leaf nodes), return the first leaf node after POS. 172return that node.
173
174Otherwise (e.g., when POS is on whitespace between two leaf
175nodes), return the first leaf node after POS.
173 176
174If there is no leaf node after POS, return the first leaf node 177If there is no leaf node after POS, return the first leaf node
175before POS. 178before POS.
diff --git a/src/comp.c b/src/comp.c
index 7d2987605d9..1b55226b0c3 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -5174,8 +5174,7 @@ maybe_defer_native_compilation (Lisp_Object function_name,
5174 if (!load_gccjit_if_necessary (false)) 5174 if (!load_gccjit_if_necessary (false))
5175 return; 5175 return;
5176 5176
5177 if (!native_comp_deferred_compilation 5177 if (!native_comp_jit_compilation
5178 || !NILP (Vinhibit_automatic_native_compilation)
5179 || noninteractive 5178 || noninteractive
5180 || !NILP (Vpurify_flag) 5179 || !NILP (Vpurify_flag)
5181 || !COMPILEDP (definition) 5180 || !COMPILEDP (definition)
@@ -5672,28 +5671,18 @@ syms_of_comp (void)
5672{ 5671{
5673#ifdef HAVE_NATIVE_COMP 5672#ifdef HAVE_NATIVE_COMP
5674 DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources, 5673 DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources,
5675 doc: /* List of sources to be native-compiled when startup is finished. 5674 doc: /* List of sources to be native-compiled when startup is finished.
5676For internal use. */); 5675For internal use. */);
5677 DEFVAR_BOOL ("comp--compilable", 5676 DEFVAR_BOOL ("comp--compilable", comp__compilable,
5678 comp__compilable, 5677 doc: /* Non-nil when comp.el can be native compiled.
5679 doc: /* Non-nil when comp.el can be native compiled.
5680For internal use. */); 5678For internal use. */);
5681 /* Compiler control customizes. */ 5679 /* Compiler control customizes. */
5682 DEFVAR_LISP ("inhibit-automatic-native-compilation", 5680 DEFVAR_BOOL ("native-comp-jit-compilation", native_comp_jit_compilation,
5683 Vinhibit_automatic_native_compilation, 5681 doc: /* If non-nil, compile loaded .elc files asynchronously.
5684 doc: /* If non-nil, inhibit automatic native compilation of loaded .elc files.
5685 5682
5686After compilation, each function definition is updated to the native 5683After compilation, each function definition is updated to use the
5687compiled one. */); 5684natively-compiled one. */);
5688 Vinhibit_automatic_native_compilation = Qnil; 5685 native_comp_jit_compilation = true;
5689
5690 DEFVAR_BOOL ("native-comp-deferred-compilation",
5691 native_comp_deferred_compilation,
5692 doc: /* If non-nil compile loaded .elc files asynchronously.
5693
5694After compilation, each function definition is updated to the native
5695compiled one. */);
5696 native_comp_deferred_compilation = true;
5697 5686
5698 DEFSYM (Qnative_comp_speed, "native-comp-speed"); 5687 DEFSYM (Qnative_comp_speed, "native-comp-speed");
5699 DEFSYM (Qnative_comp_debug, "native-comp-debug"); 5688 DEFSYM (Qnative_comp_debug, "native-comp-debug");
@@ -5837,74 +5826,83 @@ compiled one. */);
5837 /* FIXME should be initialized but not here... Plus this don't have 5826 /* FIXME should be initialized but not here... Plus this don't have
5838 to be necessarily exposed to lisp but can easy debug for now. */ 5827 to be necessarily exposed to lisp but can easy debug for now. */
5839 DEFVAR_LISP ("comp-subr-list", Vcomp_subr_list, 5828 DEFVAR_LISP ("comp-subr-list", Vcomp_subr_list,
5840 doc: /* List of all defined subrs. */); 5829 doc: /* List of all defined subrs. */);
5841 DEFVAR_LISP ("comp-abi-hash", Vcomp_abi_hash, 5830 DEFVAR_LISP ("comp-abi-hash", Vcomp_abi_hash,
5842 doc: /* String signing the .eln files ABI. */); 5831 doc: /* String signing the .eln files ABI. */);
5843 Vcomp_abi_hash = Qnil; 5832 Vcomp_abi_hash = Qnil;
5844 DEFVAR_LISP ("comp-native-version-dir", Vcomp_native_version_dir, 5833 DEFVAR_LISP ("comp-native-version-dir", Vcomp_native_version_dir,
5845 doc: /* Directory in use to disambiguate eln compatibility. */); 5834 doc: /* Directory in use to disambiguate eln compatibility. */);
5846 Vcomp_native_version_dir = Qnil; 5835 Vcomp_native_version_dir = Qnil;
5847 5836
5848 DEFVAR_LISP ("comp-deferred-pending-h", Vcomp_deferred_pending_h, 5837 DEFVAR_LISP ("comp-deferred-pending-h", Vcomp_deferred_pending_h,
5849 doc: /* Hash table symbol-name -> function-value. 5838 doc: /* Hash table symbol-name -> function-value.
5850For internal use. */); 5839For internal use. */);
5851 Vcomp_deferred_pending_h = CALLN (Fmake_hash_table, QCtest, Qeq); 5840 Vcomp_deferred_pending_h = CALLN (Fmake_hash_table, QCtest, Qeq);
5852 5841
5853 DEFVAR_LISP ("comp-eln-to-el-h", Vcomp_eln_to_el_h, 5842 DEFVAR_LISP ("comp-eln-to-el-h", Vcomp_eln_to_el_h,
5854 doc: /* Hash table eln-filename -> el-filename. */); 5843 doc: /* Hash table eln-filename -> el-filename. */);
5855 Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal); 5844 Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal);
5856 5845
5857 DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path, 5846 DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path,
5858 doc: /* List of eln cache directories. 5847 doc: /* List of directories to look for natively-compiled *.eln files.
5859 5848
5860If a directory is non absolute it is assumed to be relative to 5849The *.eln files are actually looked for in a version-specific
5861`invocation-directory'. 5850subdirectory of each directory in this list. That subdirectory
5862`comp-native-version-dir' value is used as a sub-folder name inside 5851is determined by the value of `comp-native-version-dir'.
5863each eln cache directory. 5852If the name of a directory in this list is not absolute, it is
5864The last directory of this list is assumed to be the system one. */); 5853assumed to be relative to `invocation-directory'.
5854The last directory of this list is assumed to be the one holding
5855the system *.eln files, which are the files produced when building
5856Emacs. */);
5865 5857
5866 /* Temporary value in use for bootstrap. We can't do better as 5858 /* Temporary value in use for bootstrap. We can't do better as
5867 `invocation-directory' is still unset, will be fixed up during 5859 `invocation-directory' is still unset, will be fixed up during
5868 dump reload. */ 5860 dump reload. */
5869 Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil); 5861 Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
5870 5862
5871 DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines, 5863 DEFVAR_LISP ("native-comp-enable-subr-trampolines",
5872 doc: /* If non-nil, enable primitive trampoline synthesis. 5864 Vnative_comp_enable_subr_trampolines,
5873This makes Emacs respect redefinition or advises of primitive functions 5865 doc: /* If non-nil, enable generation of trampolines for calling primitives.
5874when they are called from Lisp code natively-compiled at `native-comp-speed' 5866Trampolines are needed so that Emacs respects redefinition or advice of
5875of 2. 5867primitive functions when they are called from Lisp code natively-compiled
5868at `native-comp-speed' of 2.
5876 5869
5877By default, this is enabled, and when Emacs sees a redefined or advised 5870By default, the value is t, and when Emacs sees a redefined or advised
5878primitive called from natively-compiled Lisp, it generates a trampoline 5871primitive called from natively-compiled Lisp, it generates a trampoline
5879for it on-the-fly. 5872for it on-the-fly.
5880 5873
5881Disabling this, when a trampoline for a redefined or advised primitive is 5874If the value is a file name (a string), it specifies the directory in
5882not available from previous compilations, means that such redefinition 5875which to deposit the generated trampolines, overriding the directories
5883or advise will not have effect on calls from natively-compiled Lisp code. 5876in `native-comp-eln-load-path'.
5884That is, calls to primitives without existing trampolines from 5877
5885natively-compiled Lisp will behave as if the primitive was called 5878When this variable is nil, generation of trampolines is disabled.
5886directly from C. */); 5879
5880Disabling the generation of trampolines, when a trampoline for a redefined
5881or advised primitive is not already available from previous compilations,
5882means that such redefinition or advice will not have effect when calling
5883primitives from natively-compiled Lisp code. That is, calls to primitives
5884without existing trampolines from natively-compiled Lisp will behave as if
5885the primitive was called directly from C, and will ignore its redefinition
5886and advice. */);
5887 5887
5888 DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h, 5888 DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h,
5889 doc: /* Hash table subr-name -> installed trampoline. 5889 doc: /* Hash table subr-name -> installed trampoline.
5890This is used to prevent double trampoline instantiation but also to 5890This is used to prevent double trampoline instantiation, and also to
5891protect the trampolines against GC. */); 5891protect the trampolines against GC. */);
5892 Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); 5892 Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table);
5893 5893
5894 DEFVAR_LISP ("comp-no-native-file-h", V_comp_no_native_file_h, 5894 DEFVAR_LISP ("comp-no-native-file-h", V_comp_no_native_file_h,
5895 doc: /* Files for which no deferred compilation has to be performed. 5895 doc: /* Files for which no deferred compilation should be performed.
5896These files' compilation should not be deferred because the bytecode 5896These files' compilation should not be deferred because the bytecode
5897version was explicitly requested by the user during load. 5897version was explicitly requested by the user during load.
5898For internal use. */); 5898For internal use. */);
5899 V_comp_no_native_file_h = CALLN (Fmake_hash_table, QCtest, Qequal); 5899 V_comp_no_native_file_h = CALLN (Fmake_hash_table, QCtest, Qequal);
5900 5900
5901 DEFVAR_BOOL ("comp-file-preloaded-p", comp_file_preloaded_p, 5901 DEFVAR_BOOL ("comp-file-preloaded-p", comp_file_preloaded_p,
5902 doc: /* When non-nil assume the file being compiled to 5902 doc: /* When non-nil, assume the file being compiled to be preloaded. */);
5903be preloaded. */);
5904 5903
5905 DEFVAR_LISP ("comp-loaded-comp-units-h", Vcomp_loaded_comp_units_h, 5904 DEFVAR_LISP ("comp-loaded-comp-units-h", Vcomp_loaded_comp_units_h,
5906 doc: /* Hash table recording all loaded compilation units. 5905 doc: /* Hash table recording all loaded compilation units, file -> CU. */);
5907file -> CU. */);
5908 Vcomp_loaded_comp_units_h = 5906 Vcomp_loaded_comp_units_h =
5909 CALLN (Fmake_hash_table, QCweakness, Qvalue, QCtest, Qequal); 5907 CALLN (Fmake_hash_table, QCweakness, Qvalue, QCtest, Qequal);
5910 5908
diff --git a/src/data.c b/src/data.c
index 04ac2b09ac3..1fa8b0358b5 100644
--- a/src/data.c
+++ b/src/data.c
@@ -855,7 +855,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
855#ifdef HAVE_NATIVE_COMP 855#ifdef HAVE_NATIVE_COMP
856 register Lisp_Object function = XSYMBOL (symbol)->u.s.function; 856 register Lisp_Object function = XSYMBOL (symbol)->u.s.function;
857 857
858 if (comp_enable_subr_trampolines 858 if (!NILP (Vnative_comp_enable_subr_trampolines)
859 && SUBRP (function) 859 && SUBRP (function)
860 && !SUBR_NATIVE_COMPILEDP (function)) 860 && !SUBR_NATIVE_COMPILEDP (function))
861 CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol); 861 CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol);
diff --git a/src/treesit.c b/src/treesit.c
index cab2f0d5354..e1d6f1ef79f 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -720,6 +720,7 @@ Return nil if a grammar library for LANGUAGE is not available. */)
720 } 720 }
721} 721}
722 722
723
723/*** Parsing functions */ 724/*** Parsing functions */
724 725
725static void 726static void
@@ -770,7 +771,8 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte,
770 treesit_check_parser (lisp_parser); 771 treesit_check_parser (lisp_parser);
771 TSTree *tree = XTS_PARSER (lisp_parser)->tree; 772 TSTree *tree = XTS_PARSER (lisp_parser)->tree;
772 /* See comment (ref:visible-beg-null) if you wonder why we don't 773 /* See comment (ref:visible-beg-null) if you wonder why we don't
773 update visible_beg/end when tree is NULL. */ 774 update visible_beg/end when tree is NULL. */
775
774 if (tree != NULL) 776 if (tree != NULL)
775 { 777 {
776 eassert (start_byte <= old_end_byte); 778 eassert (start_byte <= old_end_byte);
@@ -794,8 +796,14 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte,
794 ptrdiff_t old_end_offset = (min (visible_end, 796 ptrdiff_t old_end_offset = (min (visible_end,
795 max (visible_beg, old_end_byte)) 797 max (visible_beg, old_end_byte))
796 - visible_beg); 798 - visible_beg);
797 ptrdiff_t new_end_offset = (min (visible_end, 799 /* We don't clip new_end_offset under visible_end, because
798 max (visible_beg, new_end_byte)) 800 inserting in narrowed region always extends the visible
801 region. If we clip new_end_offset here, and re-add the
802 clipped "tail" in treesit_sync_visible_region later,
803 while it is technically equivalent, tree-sitter's
804 incremental parsing algorithm doesn't seem to like it
805 (bug#61369). */
806 ptrdiff_t new_end_offset = (max (visible_beg, new_end_byte)
799 - visible_beg); 807 - visible_beg);
800 eassert (start_offset <= old_end_offset); 808 eassert (start_offset <= old_end_offset);
801 eassert (start_offset <= new_end_offset); 809 eassert (start_offset <= new_end_offset);
@@ -817,11 +825,13 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte,
817 /* Move forward. */ 825 /* Move forward. */
818 visi_beg_delta = (old_end_byte < visible_beg 826 visi_beg_delta = (old_end_byte < visible_beg
819 ? new_end_byte - old_end_byte : 0); 827 ? new_end_byte - old_end_byte : 0);
828
820 XTS_PARSER (lisp_parser)->visible_beg = visible_beg + visi_beg_delta; 829 XTS_PARSER (lisp_parser)->visible_beg = visible_beg + visi_beg_delta;
821 XTS_PARSER (lisp_parser)->visible_end = (visible_end 830 XTS_PARSER (lisp_parser)->visible_end = (visible_end
822 + visi_beg_delta 831 + visi_beg_delta
823 + (new_end_offset 832 + (new_end_offset
824 - old_end_offset)); 833 - old_end_offset));
834
825 eassert (XTS_PARSER (lisp_parser)->visible_beg >= 0); 835 eassert (XTS_PARSER (lisp_parser)->visible_beg >= 0);
826 eassert (XTS_PARSER (lisp_parser)->visible_beg 836 eassert (XTS_PARSER (lisp_parser)->visible_beg
827 <= XTS_PARSER (lisp_parser)->visible_end); 837 <= XTS_PARSER (lisp_parser)->visible_end);
@@ -1104,6 +1114,7 @@ treesit_read_buffer (void *parser, uint32_t byte_index,
1104 return beg; 1114 return beg;
1105} 1115}
1106 1116
1117
1107/*** Functions for parser and node object */ 1118/*** Functions for parser and node object */
1108 1119
1109/* Wrap the parser in a Lisp_Object to be used in the Lisp 1120/* Wrap the parser in a Lisp_Object to be used in the Lisp
@@ -1266,6 +1277,9 @@ treesit_ensure_query_compiled (Lisp_Object query, Lisp_Object *signal_symbol,
1266 return treesit_query; 1277 return treesit_query;
1267} 1278}
1268 1279
1280
1281/* Lisp definitions. */
1282
1269DEFUN ("treesit-parser-p", 1283DEFUN ("treesit-parser-p",
1270 Ftreesit_parser_p, Streesit_parser_p, 1, 1, 0, 1284 Ftreesit_parser_p, Streesit_parser_p, 1, 1, 0,
1271 doc: /* Return t if OBJECT is a tree-sitter parser. */) 1285 doc: /* Return t if OBJECT is a tree-sitter parser. */)
@@ -1484,6 +1498,7 @@ treesit_parser_live_p (Lisp_Object parser)
1484 (!NILP (Fbuffer_live_p (XTS_PARSER (parser)->buffer)))); 1498 (!NILP (Fbuffer_live_p (XTS_PARSER (parser)->buffer))));
1485} 1499}
1486 1500
1501
1487/*** Parser API */ 1502/*** Parser API */
1488 1503
1489DEFUN ("treesit-parser-root-node", 1504DEFUN ("treesit-parser-root-node",
@@ -1730,6 +1745,7 @@ positions. PARSER is the parser issuing the notification. */)
1730 return Qnil; 1745 return Qnil;
1731} 1746}
1732 1747
1748
1733/*** Node API */ 1749/*** Node API */
1734 1750
1735/* Check that OBJ is a positive integer and signal an error if 1751/* Check that OBJ is a positive integer and signal an error if
@@ -2252,6 +2268,7 @@ produced by tree-sitter. */)
2252 return same_node ? Qt : Qnil; 2268 return same_node ? Qt : Qnil;
2253} 2269}
2254 2270
2271
2255/*** Query functions */ 2272/*** Query functions */
2256 2273
2257DEFUN ("treesit-pattern-expand", 2274DEFUN ("treesit-pattern-expand",
@@ -2826,6 +2843,7 @@ the query. */)
2826 return Fnreverse (result); 2843 return Fnreverse (result);
2827} 2844}
2828 2845
2846
2829/*** Navigation */ 2847/*** Navigation */
2830 2848
2831static inline void 2849static inline void
@@ -3446,7 +3464,7 @@ DEFUN ("treesit-available-p", Ftreesit_available_p,
3446#endif 3464#endif
3447} 3465}
3448 3466
3449 3467
3450/*** Initialization */ 3468/*** Initialization */
3451 3469
3452/* Initialize the tree-sitter routines. */ 3470/* Initialize the tree-sitter routines. */
diff --git a/src/xdisp.c b/src/xdisp.c
index d3dae205037..21362d0b9d8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13424,7 +13424,8 @@ gui_consider_frame_title (Lisp_Object frame)
13424 13424
13425 Fselect_window (f->selected_window, Qt); 13425 Fselect_window (f->selected_window, Qt);
13426 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->contents)); 13426 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->contents));
13427 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; 13427 fmt = (FRAME_ICONIFIED_P (f) && !EQ (Vicon_title_format, Qt)
13428 ? Vicon_title_format : Vframe_title_format);
13428 13429
13429 mode_line_target = MODE_LINE_TITLE; 13430 mode_line_target = MODE_LINE_TITLE;
13430 title_start = MODE_LINE_NOPROP_LEN (0); 13431 title_start = MODE_LINE_NOPROP_LEN (0);
@@ -36762,9 +36763,11 @@ which no explicit name has been set (see `modify-frame-parameters'). */);
36762 DEFVAR_LISP ("icon-title-format", Vicon_title_format, 36763 DEFVAR_LISP ("icon-title-format", Vicon_title_format,
36763 doc: /* Template for displaying the title bar of an iconified frame. 36764 doc: /* Template for displaying the title bar of an iconified frame.
36764\(Assuming the window manager supports this feature.) 36765\(Assuming the window manager supports this feature.)
36765This variable has the same structure as `mode-line-format' (which see), 36766If the value is a string, it should have the same structure
36766and is used only on frames for which no explicit name has been set 36767as `mode-line-format' (which see), and is used only on frames
36767\(see `modify-frame-parameters'). */); 36768for which no explicit name has been set \(see `modify-frame-parameters').
36769If the value is t, that means use `frame-title-format' for
36770iconified frames. */);
36768 /* Do not nest calls to pure_list. This works around a bug in 36771 /* Do not nest calls to pure_list. This works around a bug in
36769 Oracle Developer Studio 12.6. */ 36772 Oracle Developer Studio 12.6. */
36770 Lisp_Object icon_title_name_format 36773 Lisp_Object icon_title_name_format
diff --git a/test/lisp/hi-lock-tests.el b/test/lisp/hi-lock-tests.el
index aeb08ecbb29..794a3b1d0c2 100644
--- a/test/lisp/hi-lock-tests.el
+++ b/test/lisp/hi-lock-tests.el
@@ -86,13 +86,18 @@
86 (unhighlight-regexp "a a") 86 (unhighlight-regexp "a a")
87 (should (= (length (overlays-in (point-min) (point-max))) 0)) 87 (should (= (length (overlays-in (point-min) (point-max))) 0))
88 88
89 (let ((search-spaces-regexp search-whitespace-regexp)) (highlight-regexp "a a")) 89 (let ((search-spaces-regexp search-whitespace-regexp))
90 (highlight-regexp "a a"))
90 (should (= (length (overlays-in (point-min) (point-max))) 1)) 91 (should (= (length (overlays-in (point-min) (point-max))) 1))
91 (cl-letf (((symbol-function 'completing-read) 92 ;; We bind use-dialog-box to nil to prevent unhighlight-regexp
92 (lambda (_prompt _coll 93 ;; from using popup menus, since the replacement for
93 &optional _x _y _z _hist defaults _inherit) 94 ;; completing-read below is not ready for that calamity
94 (car defaults)))) 95 (let ((use-dialog-box nil))
95 (call-interactively 'unhighlight-regexp)) 96 (cl-letf (((symbol-function 'completing-read)
97 (lambda (_prompt _coll
98 &optional _x _y _z _hist defaults _inherit)
99 (car defaults))))
100 (call-interactively 'unhighlight-regexp)))
96 (should (= (length (overlays-in (point-min) (point-max))) 0)) 101 (should (= (length (overlays-in (point-min) (point-max))) 0))
97 102
98 (emacs-lisp-mode) 103 (emacs-lisp-mode)
@@ -142,12 +147,16 @@
142 (let ((search-spaces-regexp search-whitespace-regexp)) (highlight-regexp "a a")) 147 (let ((search-spaces-regexp search-whitespace-regexp)) (highlight-regexp "a a"))
143 (font-lock-ensure) 148 (font-lock-ensure)
144 (should (memq 'hi-yellow (get-text-property 1 'face))) 149 (should (memq 'hi-yellow (get-text-property 1 'face)))
145 (cl-letf (((symbol-function 'completing-read) 150 ;; We bind use-dialog-box to nil to prevent unhighlight-regexp
146 (lambda (_prompt _coll 151 ;; from using popup menus, since the replacement for
147 &optional _x _y _z _hist defaults _inherit) 152 ;; completing-read below is not ready for that calamity
148 (car defaults))) 153 (let ((use-dialog-box nil))
149 (font-lock-fontified t)) 154 (cl-letf (((symbol-function 'completing-read)
150 (call-interactively 'unhighlight-regexp)) 155 (lambda (_prompt _coll
156 &optional _x _y _z _hist defaults _inherit)
157 (car defaults)))
158 (font-lock-fontified t))
159 (call-interactively 'unhighlight-regexp)))
151 (should (null (get-text-property 1 'face)))))) 160 (should (null (get-text-property 1 'face))))))
152 161
153(ert-deftest hi-lock-unhighlight () 162(ert-deftest hi-lock-unhighlight ()
@@ -156,58 +165,64 @@
156 (with-temp-buffer 165 (with-temp-buffer
157 (insert "aAbB\n") 166 (insert "aAbB\n")
158 167
159 (cl-letf (((symbol-function 'completing-read) 168 ;; We bind use-dialog-box to nil to prevent unhighlight-regexp
160 (lambda (_prompt _coll 169 ;; from using popup menus, since the replacement for
161 &optional _x _y _z _hist defaults _inherit) 170 ;; completing-read below is not ready for that calamity
162 (car defaults)))) 171 (let ((use-dialog-box nil))
163 172 (cl-letf (((symbol-function 'completing-read)
164 (highlight-regexp "a") 173 (lambda (_prompt _coll
165 (highlight-regexp "b") 174 &optional _x _y _z _hist defaults _inherit)
166 (should (= (length (overlays-in (point-min) (point-max))) 4)) 175 (car defaults))))
167 ;; `hi-lock--regexps-at-point' should take regexp "a" at point 1, 176 (highlight-regexp "a")
168 ;; not the last regexp "b" 177 (highlight-regexp "b")
169 (goto-char 1) 178 (should (= (length (overlays-in (point-min) (point-max))) 4))
170 (call-interactively 'unhighlight-regexp) 179 ;; `hi-lock--regexps-at-point' should take regexp "a" at point 1,
171 (should (= (length (overlays-in 1 3)) 0)) 180 ;; not the last regexp "b"
172 (should (= (length (overlays-in 3 5)) 2)) 181 (goto-char 1)
173 ;; Next call should unhighlight remaining regepxs 182 (call-interactively 'unhighlight-regexp)
174 (call-interactively 'unhighlight-regexp) 183 (should (= (length (overlays-in 1 3)) 0))
175 (should (= (length (overlays-in 3 5)) 0)) 184 (should (= (length (overlays-in 3 5)) 2))
176 185 ;; Next call should unhighlight remaining regepxs
177 ;; Test unhighlight all 186 (call-interactively 'unhighlight-regexp)
178 (highlight-regexp "a") 187 (should (= (length (overlays-in 3 5)) 0))
179 (highlight-regexp "b") 188
180 (should (= (length (overlays-in (point-min) (point-max))) 4)) 189 ;; Test unhighlight all
181 (unhighlight-regexp t) 190 (highlight-regexp "a")
182 (should (= (length (overlays-in (point-min) (point-max))) 0)) 191 (highlight-regexp "b")
183 192 (should (= (length (overlays-in (point-min) (point-max))) 4))
184 (emacs-lisp-mode) 193 (unhighlight-regexp t)
185 (setq font-lock-mode t) 194 (should (= (length (overlays-in (point-min) (point-max))) 0))
186 195
187 (highlight-regexp "a") 196 (emacs-lisp-mode)
188 (highlight-regexp "b") 197 (setq font-lock-mode t)
189 (font-lock-ensure) 198
190 (should (memq 'hi-yellow (get-text-property 1 'face))) 199 (highlight-regexp "a")
191 (should (memq 'hi-yellow (get-text-property 3 'face))) 200 (highlight-regexp "b")
192 ;; `hi-lock--regexps-at-point' should take regexp "a" at point 1, 201 (font-lock-ensure)
193 ;; not the last regexp "b" 202 (should (memq 'hi-yellow (get-text-property 1 'face)))
194 (goto-char 1) 203 (should (memq 'hi-yellow (get-text-property 3 'face)))
195 (let ((font-lock-fontified t)) (call-interactively 'unhighlight-regexp)) 204 ;; `hi-lock--regexps-at-point' should take regexp "a" at point 1,
196 (should (null (get-text-property 1 'face))) 205 ;; not the last regexp "b"
197 (should (memq 'hi-yellow (get-text-property 3 'face))) 206 (goto-char 1)
198 ;; Next call should unhighlight remaining regepxs 207 (let ((font-lock-fontified t))
199 (let ((font-lock-fontified t)) (call-interactively 'unhighlight-regexp)) 208 (call-interactively 'unhighlight-regexp))
200 (should (null (get-text-property 3 'face))) 209 (should (null (get-text-property 1 'face)))
201 210 (should (memq 'hi-yellow (get-text-property 3 'face)))
202 ;; Test unhighlight all 211 ;; Next call should unhighlight remaining regepxs
203 (highlight-regexp "a") 212 (let ((font-lock-fontified t))
204 (highlight-regexp "b") 213 (call-interactively 'unhighlight-regexp))
205 (font-lock-ensure) 214 (should (null (get-text-property 3 'face)))
206 (should (memq 'hi-yellow (get-text-property 1 'face))) 215
207 (should (memq 'hi-yellow (get-text-property 3 'face))) 216 ;; Test unhighlight all
208 (let ((font-lock-fontified t)) (unhighlight-regexp t)) 217 (highlight-regexp "a")
209 (should (null (get-text-property 1 'face))) 218 (highlight-regexp "b")
210 (should (null (get-text-property 3 'face))))))) 219 (font-lock-ensure)
220 (should (memq 'hi-yellow (get-text-property 1 'face)))
221 (should (memq 'hi-yellow (get-text-property 3 'face)))
222 (let ((font-lock-fontified t))
223 (unhighlight-regexp t))
224 (should (null (get-text-property 1 'face)))
225 (should (null (get-text-property 3 'face))))))))
211 226
212(provide 'hi-lock-tests) 227(provide 'hi-lock-tests)
213;;; hi-lock-tests.el ends here 228;;; hi-lock-tests.el ends here