From 97679d06e854da4656b64df1bafa9a321c05349d Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 19 Sep 2022 11:06:01 +0200 Subject: [PATCH 01/10] Avoid an unnecessary call to intern * src/doc.c (Fdocumentation): Prefer DEFSYM to using intern directly. --- src/doc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc.c b/src/doc.c index d98d121ebd5..67a5f845b93 100644 --- a/src/doc.c +++ b/src/doc.c @@ -342,7 +342,7 @@ string is passed through `substitute-command-keys'. */) doc = module_function_documentation (XMODULE_FUNCTION (fun)); #endif else - doc = call1 (intern ("function-documentation"), fun); + doc = call1 (Qfunction_documentation, fun); /* If DOC is 0, it's typically because of a dumped file missing from the DOC file (bug in src/Makefile.in). */ From f735aa0f3954750df799fce3452b56e5bdac2184 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 19 Sep 2022 11:39:00 +0200 Subject: [PATCH 02/10] Prefer DE specific commands to set wallpaper * lisp/image/wallpaper.el (wallpaper--default-commands): Rearrange order to prioritize desktop environment specific commands before general Wayland commands like "wbg" or even "swaybg". (Bug#57781) --- lisp/image/wallpaper.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el index 4572a8c0628..ff47d37e3a6 100644 --- a/lisp/image/wallpaper.el +++ b/lisp/image/wallpaper.el @@ -55,10 +55,6 @@ (defvar wallpaper--default-commands ;; When updating this, also update the custom :type for `wallpaper-command'. '( - ;; Sway (Wayland) - ("swaybg" "-o" "*" "-i" "%f" "-m" "fill") - ;; Wayland General - ("wbg" "%f") ;; Gnome ("gsettings" "set" "org.gnome.desktop.background" "picture-uri" "file://%f") ;; KDE Plasma @@ -66,6 +62,10 @@ ;; XFCE ("xfconf-query" "-c" "xfce4-desktop" "-p" "/backdrop/screen0/monitoreDP/workspace0/last-image" "-s" "%f") + ;; Sway (Wayland) + ("swaybg" "-o" "*" "-i" "%f" "-m" "fill") + ;; Wayland General + ("wbg" "%f") ;; macOS ("osascript" "-e" "tell application \"Finder\" to set desktop picture to POSIX file \"%f\"") ;; Other / General X From a71de4b52d3de14349ded7d88c4cae6e2a9376ae Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 19 Sep 2022 13:34:51 +0200 Subject: [PATCH 03/10] Improve check for misleading 'cl-case' cases (Bug#57915). * lisp/emacs-lisp/cl-macs.el (cl-case): Check that the case is of the form (quote FOO), not just (quote). * test/lisp/emacs-lisp/cl-macs-tests.el (cl-case-no-warning): New unit test. --- lisp/emacs-lisp/cl-macs.el | 2 +- test/lisp/emacs-lisp/cl-macs-tests.el | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5d330f32d66..beafee1d631 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -792,7 +792,7 @@ compared by `eql'. (macroexp-warn-and-return "Case nil will never match" nil 'suspicious)) - ((and (consp (car c)) (not (cddar c)) + ((and (consp (car c)) (cdar c) (not (cddar c)) (memq (caar c) '(quote function))) (macroexp-warn-and-return (format-message diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 83928775f18..f742637ee35 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -792,4 +792,15 @@ constructs." (should (equal messages (concat "Warning: " message "\n")))))))))) +(ert-deftest cl-case-no-warning () + "Test that `cl-case' and `cl-ecase' don't warn in some valid cases. +See Bug#57915." + (dolist (case '(quote (quote) function (function))) + (dolist (macro '(cl-case cl-ecase)) + (let ((form `(,macro val (,case 1)))) + (ert-info ((prin1-to-string form) :prefix "Form: ") + (ert-with-message-capture messages + (macroexpand form) + (should (string-empty-p messages)))))))) + ;;; cl-macs-tests.el ends here From c464bcb20a53a15e0d07209c73547d9b74cb9a1a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 19 Sep 2022 07:39:21 -0400 Subject: [PATCH 04/10] * doc/misc/eieio.texi (Introduction, Generics): Remove outdated limits Reported by Hokomo . --- doc/misc/eieio.texi | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 18a2b74033e..b1ec5c0dce7 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi @@ -193,7 +193,7 @@ also differs in some other aspects which are mentioned below (also @enumerate @item A structured framework for the creation of basic classes with attributes -and methods using singular inheritance similar to CLOS. +and methods using inheritance similar to CLOS. @item Type checking, and slot unbinding. @item @@ -225,11 +225,6 @@ lacks: @table @asis -@item Method dispatch -EIEO does not support method dispatch for built-in types and multiple -arguments types. In other words, method dispatch only looks at the -first argument, and this one must be an @eieio{} type. - @item Support for metaclasses There is just one default metaclass, @code{eieio-default-superclass}, and you cannot define your own. The @code{:metaclass} tag in @@ -856,11 +851,6 @@ You can also create a generic method with @code{cl-defmethod} (@pxref{Methods}). When a method is created and there is no generic method in place with that name, then a new generic will be created, and the new method will use it. - -In CLOS, a generic method can also be used to provide an argument list -and dispatch precedence for all the arguments. In @eieio{}, -dispatching only occurs for the first argument, so the @var{arglist} -is not used. @end defmac @node Methods From cd2168cd131852279a7d9257c7dff45224c9d6a9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 19 Sep 2022 16:24:44 +0300 Subject: [PATCH 05/10] Fix 'posn-at-point' around several 'display' properties * src/xdisp.c (pos_visible_p): Fix the case when CHARPOS is hidden by a display property, and its neighbors are also hidden. (Bug#45915) --- src/xdisp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 80a07636951..ee074c018e5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1960,15 +1960,18 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, int top_x_before_string = it3.current_x; /* Finally, advance the iterator until we hit the first display element whose character position is - CHARPOS, or until the first newline from the - display string, which signals the end of the - display line. */ + at or beyond CHARPOS, or until the first newline + from the display string, which signals the end of + the display line. */ while (get_next_display_element (&it3)) { if (!EQ (it3.object, string)) top_x_before_string = it3.current_x; PRODUCE_GLYPHS (&it3); - if (IT_CHARPOS (it3) == charpos + if ((it3.bidi_it.scan_dir == 1 + && IT_CHARPOS (it3) >= charpos) + || (it3.bidi_it.scan_dir == -1 + && IT_CHARPOS (it3) <= charpos) || ITERATOR_AT_END_OF_LINE_P (&it3)) break; it3_moved = true; From ba0e989c11ebe05bb519845a6d3ab5af1e2715d8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 19 Sep 2022 16:02:28 +0200 Subject: [PATCH 06/10] Support imenu in emacs-news-mode * lisp/outline.el (outline-imenu-generic-expression): New variable broken out from... (outline-mode): ...here. * lisp/textmodes/emacs-news-mode.el (emacs-news--mode-common): Use above new variable to add imenu support. --- lisp/outline.el | 7 +++++-- lisp/textmodes/emacs-news-mode.el | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/outline.el b/lisp/outline.el index 25ef1616b93..e3fbd8b3272 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -341,6 +341,10 @@ data reflects the `outline-regexp'.") :safe #'booleanp :version "22.1") +(defvar outline-imenu-generic-expression + (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0)) + "Value for `imenu-generic-expression' in Outline mode.") + ;;;###autoload (define-derived-mode outline-mode text-mode "Outline" "Set major mode for editing outlines with selective display. @@ -375,8 +379,7 @@ Turning on outline mode calls the value of `text-mode-hook' and then of (concat paragraph-separate "\\|\\(?:" outline-regexp "\\)")) (setq-local font-lock-defaults '(outline-font-lock-keywords t nil nil backward-paragraph)) - (setq-local imenu-generic-expression - (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) + (setq-local imenu-generic-expression outline-imenu-generic-expression) (add-hook 'change-major-mode-hook #'outline-show-all nil t) (add-hook 'hack-local-variables-hook #'outline-apply-default-state nil t)) diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index 88e89480609..d9decae4df6 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -80,6 +80,7 @@ outline-minor-mode-cycle t outline-minor-mode-highlight 'append) (outline-minor-mode) + (setq-local imenu-generic-expression outline-imenu-generic-expression) (emacs-etc--hide-local-variables)) ;;;###autoload From a7c65fc6660878e244432a5b25fb3a4ff20e8604 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 19 Sep 2022 16:54:19 +0200 Subject: [PATCH 07/10] Allow nil value for filter-buffer-substring-function * lisp/simple.el (filter-buffer-substring): Support a nil value to be more resilient. (filter-buffer-substring-function): Doc fix; improve and update for above change. --- lisp/simple.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 1b9bf9fa6d8..40df5695c35 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5363,7 +5363,10 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." The function is called with the same 3 arguments (BEG END DELETE) that `filter-buffer-substring' received. It should return the buffer substring between BEG and END, after filtering. If DELETE is -non-nil, it should delete the text between BEG and END from the buffer.") +non-nil, it should delete the text between BEG and END from the buffer. + +The default value is `buffer-substring--filter', and nil means +the same as the default.") (defun filter-buffer-substring (beg end &optional delete) "Return the buffer substring between BEG and END, after filtering. @@ -5379,7 +5382,9 @@ Use `filter-buffer-substring' instead of `buffer-substring', you want to allow filtering to take place. For example, major or minor modes can use `filter-buffer-substring-function' to exclude text properties that are special to a buffer, and should not be copied into other buffers." - (funcall filter-buffer-substring-function beg end delete)) + (funcall (or filter-buffer-substring-function + #'buffer-substring--filter) + beg end delete)) (defun buffer-substring--filter (beg end &optional delete) "Default function to use for `filter-buffer-substring-function'. From 60102016e416e5c19fa5945aeb80693dac7ff2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Mon, 19 Sep 2022 10:55:09 +0200 Subject: [PATCH 08/10] Abolish max-specpdl-size (bug#57911) The max-lisp-eval-depth limit is sufficient to prevent unbounded stack growth including the specbind stack; simplify matters for the user by not having them to worry about two different limits. This change turns max-specpdl-size into a harmless variable with no effects, to keep existing code happy. * lisp/subr.el (max-specpdl-size): Define as an ordinary (but obsolete) dynamic variable. * admin/grammars/Makefile.in: * doc/lispintro/emacs-lisp-intro.texi (Loops & Recursion): * doc/lispref/control.texi (Cleanups): * doc/lispref/edebug.texi (Checking Whether to Stop): * doc/lispref/eval.texi (Eval): * doc/lispref/variables.texi (Local Variables): * doc/misc/calc.texi (Recursion Depth): Update documentation. * etc/NEWS: Announce. * src/eval.c (FletX): Use safe iteration to guard against circular bindings list. (syms_of_eval): Remove old max-specpdl-size definition. (init_eval_once, restore_stack_limits, call_debugger) (signal_or_quit, grow_specpdl_allocation): * leim/Makefile.in: * lisp/Makefile.in: * lisp/calc/calc-stuff.el (calc-more-recursion-depth) (calc-less-recursion-depth): * lisp/calc/calc.el (calc-do): * lisp/cedet/semantic/ede-grammar.el (ede-proj-makefile-insert-rules): * lisp/cedet/semantic/grammar.el (semantic-grammar-batch-build-one-package): * lisp/cus-start.el (standard): * lisp/emacs-lisp/comp.el (comp--native-compile): * lisp/emacs-lisp/edebug.el (edebug-max-depth): (edebug-read-and-maybe-wrap-form, edebug-default-enter): * lisp/emacs-lisp/regexp-opt.el (regexp-opt): * lisp/eshell/esh-mode.el (eshell-mode): * lisp/loadup.el (max-specpdl-size): * lisp/mh-e/mh-e.el (mh-invisible-headers): * lisp/net/shr.el (shr-insert-document, shr-descend): * lisp/play/hanoi.el (hanoi-internal): * lisp/progmodes/cperl-mode.el: * src/fileio.c (Fdo_auto_save): Remove references to and modifications of max-specpdl-size. --- admin/grammars/Makefile.in | 2 +- doc/lispintro/emacs-lisp-intro.texi | 5 +-- doc/lispref/control.texi | 5 --- doc/lispref/edebug.texi | 5 +-- doc/lispref/eval.texi | 5 +-- doc/lispref/variables.texi | 21 ---------- doc/misc/calc.texi | 4 -- etc/NEWS | 6 +++ leim/Makefile.in | 2 - lisp/Makefile.in | 8 ++-- lisp/calc/calc-stuff.el | 8 +--- lisp/calc/calc.el | 3 +- lisp/cedet/semantic/ede-grammar.el | 7 ++-- lisp/cedet/semantic/grammar.el | 1 - lisp/cus-start.el | 1 - lisp/emacs-lisp/comp.el | 1 - lisp/emacs-lisp/edebug.el | 6 +-- lisp/emacs-lisp/regexp-opt.el | 1 - lisp/eshell/esh-mode.el | 1 - lisp/loadup.el | 4 +- lisp/mh-e/mh-e.el | 4 +- lisp/net/shr.el | 62 +++++++++++++---------------- lisp/play/hanoi.el | 5 +-- lisp/progmodes/cperl-mode.el | 1 - lisp/subr.el | 8 ++++ src/eval.c | 60 +++------------------------- src/fileio.c | 5 --- 27 files changed, 68 insertions(+), 173 deletions(-) diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in index 4ca88982cde..178c79b7a02 100644 --- a/admin/grammars/Makefile.in +++ b/admin/grammars/Makefile.in @@ -35,7 +35,7 @@ unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH EMACS = ${top_builddir}/src/emacs emacs = "${EMACS}" -batch --no-site-file --no-site-lisp \ - --eval '(setq max-specpdl-size 5000)' --eval '(setq load-prefer-newer t)' + --eval '(setq load-prefer-newer t)' make_bovine = ${emacs} -l semantic/bovine/grammar -f bovine-batch-make-parser make_wisent = ${emacs} -l semantic/wisent/grammar -f wisent-batch-make-parser diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 47a5a870fde..df8fa2f8e79 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -10100,9 +10100,8 @@ resources; as it happens, methods that people find easy---that are frugal of mental resources---sometimes use considerable computer resources. Emacs was designed to run on machines that we now consider limited and its default settings are conservative. You may want to -increase the values of @code{max-specpdl-size} and -@code{max-lisp-eval-depth}. In my @file{.emacs} file, I set them to -15 and 30 times their default value.}. +increase the value of @code{max-lisp-eval-depth}. In my @file{.emacs} +file, I set it to 30 times its default value.}. @menu * while:: Causing a stretch of code to repeat. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index d4520ebdee5..ee2acdb002b 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -2366,11 +2366,6 @@ of the @var{cleanup-forms} themselves exits nonlocally (via a guaranteed to evaluate the rest of them. If the failure of one of the @var{cleanup-forms} has the potential to cause trouble, then protect it with another @code{unwind-protect} around that form. - -The number of currently active @code{unwind-protect} forms counts, -together with the number of local variable bindings, against the limit -@code{max-specpdl-size} (@pxref{Definition of max-specpdl-size,, Local -Variables}). @end defspec For example, here we make an invisible buffer for temporary use, and diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 56f7b7bdfad..6a51489d8a4 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi @@ -1032,9 +1032,8 @@ program. @itemize @bullet @item @vindex edebug-max-depth -@code{max-lisp-eval-depth} (@pxref{Eval}) and @code{max-specpdl-size} -(@pxref{Local Variables}) are both increased to reduce Edebug's impact -on the stack. You could, however, still run out of stack space when +@code{max-lisp-eval-depth} (@pxref{Eval}) is increased to reduce Edebug's +impact on the stack. You could, however, still run out of stack space when using Edebug. You can also enlarge the value of @code{edebug-max-depth} if Edebug reaches the limit of recursion depth instrumenting code that contains very large quoted lists. diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index 6e29a5403f1..11c321b32ed 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -830,7 +830,7 @@ This variable defines the maximum depth allowed in calls to @code{eval}, @code{apply}, and @code{funcall} before an error is signaled (with error message @code{"Lisp nesting exceeds max-lisp-eval-depth"}). -This limit, with the associated error when it is exceeded, is one way +This limit, with the associated error when it is exceeded, is how Emacs Lisp avoids infinite recursion on an ill-defined function. If you increase the value of @code{max-lisp-eval-depth} too much, such code can cause stack overflow instead. On some systems, this overflow @@ -851,9 +851,6 @@ less than 100, Lisp will reset it to 100 if the given value is reached. Entry to the Lisp debugger increases the value, if there is little room left, to make sure the debugger itself has room to execute. - -@code{max-specpdl-size} provides another limit on nesting. -@xref{Definition of max-specpdl-size,, Local Variables}. @end defopt @defvar values diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 975e945b343..ccd19630bf7 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -358,27 +358,6 @@ Variables}); a few variables have terminal-local bindings like ordinary local bindings, but they are localized depending on where you are in Emacs. -@defopt max-specpdl-size -@anchor{Definition of max-specpdl-size} -@cindex variable limit error -@cindex evaluation error -@cindex infinite recursion -This variable defines the limit on the total number of local variable -bindings and @code{unwind-protect} cleanups (@pxref{Cleanups,, -Cleaning Up from Nonlocal Exits}) that are allowed before Emacs -signals an error (with data @code{"Variable binding depth exceeds -max-specpdl-size"}). - -This limit, with the associated error when it is exceeded, is one way -that Lisp avoids infinite recursion on an ill-defined function. -@code{max-lisp-eval-depth} provides another limit on depth of nesting. -@xref{Definition of max-lisp-eval-depth,, Eval}. - -The default value is 2500. Entry to the Lisp debugger increases the -value, if there is little room left, to make sure the debugger itself -has room to execute. -@end defopt - @node Void Variables @section When a Variable is Void @cindex @code{void-variable} error diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 98f59b89c01..89a340e7343 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -10392,7 +10392,6 @@ memory than it would otherwise, but it's guaranteed to fix the problem. @cindex Recursion depth @cindex ``Computation got stuck'' message @cindex @code{max-lisp-eval-depth} -@cindex @code{max-specpdl-size} Calc uses recursion in many of its calculations. Emacs Lisp keeps a variable @code{max-lisp-eval-depth} which limits the amount of recursion possible in an attempt to recover from program bugs. If a calculation @@ -10406,9 +10405,6 @@ is also an @kbd{I M} (@code{calc-less-recursion-depth}) command which decreases this limit by a factor of two, down to a minimum value of 200. The default value is 1000. -These commands also double or halve @code{max-specpdl-size}, another -internal Lisp recursion limit. The minimum value for this limit is 600. - @node Caches @subsection Caches diff --git a/etc/NEWS b/etc/NEWS index a739d74b650..723bdd7c75d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3806,6 +3806,12 @@ the same but works by modifying LIST destructively. --- ** 'string-split' is now an alias for 'split-string'. ++++ +** The variable 'max-specpdl-size' has been made obsolete. +Now 'max-lisp-eval-depth' alone is used for limiting Lisp recursion +and stack usage. 'max-specpdl-size' is still present as a plain +variable for compatibility but its limiting powers have been taken away. + * Changes in Emacs 29.1 on Non-Free Operating Systems diff --git a/leim/Makefile.in b/leim/Makefile.in index 29b9f3b2f86..fbd733b7f66 100644 --- a/leim/Makefile.in +++ b/leim/Makefile.in @@ -128,7 +128,6 @@ leim-list.el: ${leimdir}/leim-list.el ${leimdir}/leim-list.el: ${srcdir}/leim-ext.el ${TIT_MISC} $(AM_V_GEN)rm -f $@ $(AM_V_at)${RUN_EMACS} -l international/quail \ - --eval "(setq max-specpdl-size 5000)" \ --eval "(update-leim-list-file (unmsys--file-name \"${leimdir}\"))" $(AM_V_at)sed -n -e '/^[^;]/p' -e 's/^;\(;*\)inc /;\1 /p' < $< >> $@ @@ -139,7 +138,6 @@ ${leimdir}/ja-dic/ja-dic.el: | $(leimdir)/ja-dic generate-ja-dic: ${leimdir}/ja-dic/ja-dic.el ${leimdir}/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L $(AM_V_GEN)$(RUN_EMACS) -batch -l ja-dic-cnv \ - --eval "(setq max-specpdl-size 5000)" \ -f batch-skkdic-convert -dir "$(leimdir)/ja-dic" $(JA_DIC_NO_REDUCTION_OPTION) "$<" ${srcdir}/../lisp/language/pinyin.el: ${srcdir}/MISC-DIC/pinyin.map diff --git a/lisp/Makefile.in b/lisp/Makefile.in index c73a623cce9..bcf4a3146d4 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -70,9 +70,7 @@ BYTE_COMPILE_FLAGS = \ --eval "(setq load-prefer-newer t byte-compile-warnings 'all)" \ $(BYTE_COMPILE_EXTRA_FLAGS) # ... but we must prefer .elc files for those in the early bootstrap. -# A larger `max-specpdl-size' is needed for emacs-lisp/comp.el. -compile-first: BYTE_COMPILE_FLAGS = \ - --eval '(setq max-specpdl-size 5000)' $(BYTE_COMPILE_EXTRA_FLAGS) +compile-first: BYTE_COMPILE_FLAGS = $(BYTE_COMPILE_EXTRA_FLAGS) # Files to compile before others during a bootstrap. This is done to # speed up the bootstrap process. They're ordered by size, so we use @@ -342,8 +340,8 @@ compile-first: $(COMPILE_FIRST) .PHONY: compile-targets # TARGETS is set dynamically in the recursive call from 'compile-main'. -# Do not build comp.el unless necessary not to exceed max-specpdl-size and -# max-lisp-eval-depth in normal builds. +# Do not build comp.el unless necessary not to exceed max-lisp-eval-depth +# in normal builds. ifneq ($(HAVE_NATIVE_COMP),yes) compile-targets: $(filter-out ./emacs-lisp/comp-cstr.elc,$(filter-out ./emacs-lisp/comp.elc,$(TARGETS))) else diff --git a/lisp/calc/calc-stuff.el b/lisp/calc/calc-stuff.el index 0e8ea42bedc..758b9201843 100644 --- a/lisp/calc/calc-stuff.el +++ b/lisp/calc/calc-stuff.el @@ -52,18 +52,14 @@ With a prefix, push that prefix as a number onto the stack." (calc-less-recursion-depth n) (let ((n (if n (prefix-numeric-value n) 2))) (if (> n 1) - (setq max-specpdl-size (* max-specpdl-size n) - max-lisp-eval-depth (* max-lisp-eval-depth n)))) + (setq max-lisp-eval-depth (* max-lisp-eval-depth n)))) (message "max-lisp-eval-depth is now %d" max-lisp-eval-depth)))) (defun calc-less-recursion-depth (n) (interactive "P") (let ((n (if n (prefix-numeric-value n) 2))) (if (> n 1) - (setq max-specpdl-size - (max (/ max-specpdl-size n) 600) - max-lisp-eval-depth - (max (/ max-lisp-eval-depth n) 200)))) + (setq max-lisp-eval-depth (max (/ max-lisp-eval-depth n) 200)))) (message "max-lisp-eval-depth is now %d" max-lisp-eval-depth)) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 5077c8c8528..c0f87ad3d42 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1625,8 +1625,7 @@ See calc-keypad for details." (error (if (and (eq (car err) 'error) (stringp (nth 1 err)) - (string-match "max-specpdl-size\\|max-lisp-eval-depth" - (nth 1 err))) + (string-search "max-lisp-eval-depth" (nth 1 err))) (error (substitute-command-keys "Computation got stuck or ran too long. Type \\`M' to increase the limit")) (setq calc-aborted-prefix nil) diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el index ff9f991ff4a..40ff8fc86d3 100644 --- a/lisp/cedet/semantic/ede-grammar.el +++ b/lisp/cedet/semantic/ede-grammar.el @@ -177,10 +177,9 @@ Lays claim to all -by.el, and -wy.el files." (cl-defmethod ede-proj-makefile-insert-rules :after ((this semantic-ede-proj-target-grammar)) "Insert rules needed by THIS target. -This raises `max-specpdl-size' and `max-lisp-eval-depth', which can be -needed for the compilation of the resulting parsers." - (insert (format "%s: EMACSFLAGS+= --eval '(setq max-specpdl-size 1500 \ -max-lisp-eval-depth 700)'\n" +This raises `max-lisp-eval-depth', which can be needed for the compilation +of the resulting parsers." + (insert (format "%s: EMACSFLAGS+= --eval '(setq max-lisp-eval-depth 700)'\n" (oref this name)))) (cl-defmethod ede-proj-makefile-insert-dist-dependencies ((this semantic-ede-proj-target-grammar)) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 72037f47108..8ba0e346fff 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1009,7 +1009,6 @@ Return non-nil if there were no errors, nil if errors." packagename (byte-compile-dest-file packagename)) (let (;; Some complex grammar table expressions need a few ;; more resources than the default. - (max-specpdl-size (max 3000 max-specpdl-size)) (max-lisp-eval-depth (max 1000 max-lisp-eval-depth)) ) ;; byte compile the resultant file diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 0e1cb4589da..d7fb56c9854 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -251,7 +251,6 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of ;; emacs.c (report-emacs-bug-address emacsbug string) ;; eval.c - (max-specpdl-size limits integer) (max-lisp-eval-depth limits integer) (max-mini-window-height limits (choice (const :tag "quarter screen" nil) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index a9087313b18..35acbff9b17 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -4044,7 +4044,6 @@ the deferred compilation mechanism." (list "Not a function symbol or file" function-or-file))) (catch 'no-native-compile (let* ((print-symbols-bare t) - (max-specpdl-size (max max-specpdl-size 5000)) (data function-or-file) (comp-native-compiling t) (byte-native-qualities nil) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 31c05057bfa..67704bdb51c 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -129,7 +129,7 @@ contains an infinite loop. When Edebug is instrumenting code containing very large quoted lists, it may reach this limit and give the error message \"Too deep - perhaps infinite loop in spec?\". Make this limit larger to countermand that, but you may also need to -increase `max-lisp-eval-depth' and `max-specpdl-size'." +increase `max-lisp-eval-depth'." :type 'integer :version "26.1") @@ -1107,8 +1107,7 @@ purpose by adding an entry to this alist, and setting edebug-best-error edebug-error-point ;; Do this once here instead of several times. - (max-lisp-eval-depth (+ 800 max-lisp-eval-depth)) - (max-specpdl-size (+ 2000 max-specpdl-size))) + (max-lisp-eval-depth (+ 800 max-lisp-eval-depth))) (let ((no-match (catch 'no-match (setq result (edebug-read-and-maybe-wrap-form1)) @@ -2317,7 +2316,6 @@ and run its entry function, and set up `edebug-before' and ;; but not inside an unwind-protect. ;; Doing it here also keeps it from growing too large. (max-lisp-eval-depth (+ 100 max-lisp-eval-depth)) ; too much?? - (max-specpdl-size (+ 200 max-specpdl-size)) (debugger edebug-debugger) ; only while edebug is active. (edebug-outside-debug-on-error debug-on-error) diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index cae5dd00d1d..4d5a39458d2 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -133,7 +133,6 @@ usually more efficient than that of a simplified version: (save-match-data ;; Recurse on the sorted list. (let* ((max-lisp-eval-depth 10000) - (max-specpdl-size 10000) (completion-ignore-case nil) (completion-regexp-list nil) (open (cond ((stringp paren) paren) (paren "\\("))) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 69069183a3f..8f11e6f04a4 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -331,7 +331,6 @@ and the hook `eshell-exit-hook'." (setq-local require-final-newline nil) (setq-local max-lisp-eval-depth (max 3000 max-lisp-eval-depth)) - (setq-local max-specpdl-size (max 6000 max-lisp-eval-depth)) (setq-local eshell-last-input-start (point-marker)) (setq-local eshell-last-input-end (point-marker)) diff --git a/lisp/loadup.el b/lisp/loadup.el index 634a3314361..c01c827a75e 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -244,9 +244,7 @@ (load "language/indonesian") (load "indent") -(let ((max-specpdl-size (max max-specpdl-size 1800))) - ;; A particularly demanding file to load; 1600 does not seem to be enough. - (load "emacs-lisp/cl-generic")) +(load "emacs-lisp/cl-generic") (load "simple") (load "emacs-lisp/seq") (load "emacs-lisp/nadvice") diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 0ad934107d3..9a04d890973 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -2831,9 +2831,7 @@ removed and entries from `mh-invisible-header-fields' are added." (setq mh-invisible-header-fields-compiled (concat "^" - ;; workaround for insufficient default - (let ((max-specpdl-size 1000)) - (regexp-opt fields t)))) + (regexp-opt fields t))) (setq mh-invisible-header-fields-compiled nil)))) ;; Compile invisible header fields. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 54ce9b1a41c..d56420eb02e 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -373,7 +373,6 @@ DOM should be a parse tree as generated by shr-width (* shr-width (frame-char-width))) (shr--window-width))) - (max-specpdl-size max-specpdl-size) (shr--link-targets nil) (hscroll (window-hscroll)) ;; `bidi-display-reordering' is supposed to be only used for @@ -625,41 +624,34 @@ size, and full-buffer size." (shr-stylesheet shr-stylesheet) (shr-depth (1+ shr-depth)) (start (point))) - ;; shr uses many frames per nested node. - (if (and (> shr-depth (/ max-specpdl-size 15)) - (not (and shr-offer-extend-specpdl - (y-or-n-p "Too deeply nested to render properly; increase `max-specpdl-size'?") - (setq max-specpdl-size (* max-specpdl-size 2))))) - (setq shr-warning - "Not rendering the complete page because of too-deep nesting") + (when style + (if (string-match-p "color\\|display\\|border-collapse" style) + (setq shr-stylesheet (nconc (shr-parse-style style) + shr-stylesheet)) + (setq style nil))) + ;; If we have a display:none, then just ignore this part of the DOM. + (unless (or (equal (cdr (assq 'display shr-stylesheet)) "none") + (and shr-discard-aria-hidden + (equal (dom-attr dom 'aria-hidden) "true"))) + ;; We don't use shr-indirect-call here, since shr-descend is + ;; the central bit of shr.el, and should be as fast as + ;; possible. Having one more level of indirection with its + ;; negative effect on performance is deemed unjustified in + ;; this case. + (cond (external + (funcall external dom)) + ((fboundp function) + (funcall function dom)) + (t + (shr-generic dom))) + (when-let ((id (dom-attr dom 'id))) + (push (cons id (set-marker (make-marker) start)) shr--link-targets)) + ;; If style is set, then this node has set the color. (when style - (if (string-match-p "color\\|display\\|border-collapse" style) - (setq shr-stylesheet (nconc (shr-parse-style style) - shr-stylesheet)) - (setq style nil))) - ;; If we have a display:none, then just ignore this part of the DOM. - (unless (or (equal (cdr (assq 'display shr-stylesheet)) "none") - (and shr-discard-aria-hidden - (equal (dom-attr dom 'aria-hidden) "true"))) - ;; We don't use shr-indirect-call here, since shr-descend is - ;; the central bit of shr.el, and should be as fast as - ;; possible. Having one more level of indirection with its - ;; negative effect on performance is deemed unjustified in - ;; this case. - (cond (external - (funcall external dom)) - ((fboundp function) - (funcall function dom)) - (t - (shr-generic dom))) - (when-let ((id (dom-attr dom 'id))) - (push (cons id (set-marker (make-marker) start)) shr--link-targets)) - ;; If style is set, then this node has set the color. - (when style - (shr-colorize-region - start (point) - (cdr (assq 'color shr-stylesheet)) - (cdr (assq 'background-color shr-stylesheet)))))))) + (shr-colorize-region + start (point) + (cdr (assq 'color shr-stylesheet)) + (cdr (assq 'background-color shr-stylesheet))))))) (defun shr-fill-text (text) (if (zerop (length text)) diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el index 58fb82b6ed0..1a4b6dbeb11 100644 --- a/lisp/play/hanoi.el +++ b/lisp/play/hanoi.el @@ -149,10 +149,9 @@ BITS must be of length nrings. Start at START-TIME." (setq show-trailing-whitespace nil) (unwind-protect (let* - (;; These lines can cause Emacs to crash if you ask for too - ;; many rings. If you uncomment them, on most systems you + (;; This line can cause Emacs to crash if you ask for too + ;; many rings. If you uncomment it, on most systems you ;; can get 10,000+ rings. - ;;(max-specpdl-size (max max-specpdl-size (* nrings 15))) ;;(max-lisp-eval-depth (max max-lisp-eval-depth (+ nrings 20))) (vert (not hanoi-horizontal-flag)) (pole-width (length (format "%d" (max 0 (1- nrings))))) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 614ee60fa03..c3704a05dbb 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3718,7 +3718,6 @@ This is part of `cperl-find-pods-heres' (below)." overshoot warning-message))) -;; Debugging this may require (setq max-specpdl-size 2000)... (defun cperl-find-pods-heres (&optional min max non-inter end ignore-max end-of-here-doc) "Scan the buffer for hard-to-parse Perl constructions. If `cperl-pod-here-fontify' is non-nil after evaluation, diff --git a/lisp/subr.el b/lisp/subr.el index d7cdc28abba..59f9308f31e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1859,6 +1859,14 @@ be a list of the form returned by `event-start' and `event-end'." ;; in warnings when using `values' in let-bindings. ;;(make-obsolete-variable 'values "no longer used" "28.1") +(defvar max-specpdl-size 2500 + "Former limit on specbindings, now without effect. +This variable used to limit the size of the specpdl stack which, +among other things, holds dynamic variable bindings and `unwind-protect' +activations. To prevent runaway recursion, use `max-lisp-eval-depth' +instead; it will indirectly limit the specpdl stack size as well.") +(make-obsolete-variable 'max-specpdl-size nil "29.1") + ;;;; Alternate names for functions - these are not being phased out. diff --git a/src/eval.c b/src/eval.c index bd414fb8687..7da1d8fb989 100644 --- a/src/eval.c +++ b/src/eval.c @@ -211,9 +211,7 @@ backtrace_thread_next (struct thread_state *tstate, union specbinding *pdl) void init_eval_once (void) { - /* Don't forget to update docs - (lispref nodes "Local Variables" and "Eval"). */ - max_specpdl_size = 2500; + /* Don't forget to update docs (lispref node "Eval"). */ max_lisp_eval_depth = 1600; Vrun_hooks = Qnil; pdumper_do_now_and_after_load (init_eval_once_for_pdumper); @@ -265,8 +263,7 @@ max_ensure_room (intmax_t *m, intmax_t a, intmax_t b) static void restore_stack_limits (Lisp_Object data) { - integer_to_intmax (XCAR (data), &max_specpdl_size); - integer_to_intmax (XCDR (data), &max_lisp_eval_depth); + integer_to_intmax (data, &max_lisp_eval_depth); } /* Call the Lisp debugger, giving it argument ARG. */ @@ -278,9 +275,6 @@ call_debugger (Lisp_Object arg) specpdl_ref count = SPECPDL_INDEX (); Lisp_Object val; intmax_t old_depth = max_lisp_eval_depth; - /* Do not allow max_specpdl_size less than actual depth (Bug#16603). */ - ptrdiff_t counti = specpdl_ref_to_count (count); - intmax_t old_max = max (max_specpdl_size, counti); /* The previous value of 40 is too small now that the debugger prints using cl-prin1 instead of prin1. Printing lists nested 8 @@ -288,20 +282,8 @@ call_debugger (Lisp_Object arg) currently requires 77 additional frames. See bug#31919. */ max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100); - /* While debugging Bug#16603, previous value of 100 was found - too small to avoid specpdl overflow in the debugger itself. */ - max_ensure_room (&max_specpdl_size, counti, 200); - - if (old_max == counti) - { - /* We can enter the debugger due to specpdl overflow (Bug#16603). */ - specpdl_ptr--; - grow_specpdl (); - } - /* Restore limits after leaving the debugger. */ - record_unwind_protect (restore_stack_limits, - Fcons (make_int (old_max), make_int (old_depth))); + record_unwind_protect (restore_stack_limits, make_int (old_depth)); #ifdef HAVE_WINDOW_SYSTEM if (display_hourglass_p) @@ -933,12 +915,9 @@ usage: (let* VARLIST BODY...) */) lexenv = Vinternal_interpreter_environment; Lisp_Object varlist = XCAR (args); - while (CONSP (varlist)) + FOR_EACH_TAIL (varlist) { - maybe_quit (); - elt = XCAR (varlist); - varlist = XCDR (varlist); if (SYMBOLP (elt)) { var = elt; @@ -1752,8 +1731,6 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) { /* Edebug takes care of restoring these variables when it exits. */ max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 20); - ptrdiff_t counti = specpdl_ref_to_count (SPECPDL_INDEX ()); - max_ensure_room (&max_specpdl_size, counti, 40); call2 (Vsignal_hook_function, error_symbol, data); } @@ -1822,8 +1799,6 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) { max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100); specpdl_ref count = SPECPDL_INDEX (); - ptrdiff_t counti = specpdl_ref_to_count (count); - max_ensure_room (&max_specpdl_size, counti, 200); specbind (Qdebugger, Qdebug_early); call_debugger (list2 (Qerror, Fcons (error_symbol, data))); unbind_to (count, Qnil); @@ -1839,12 +1814,10 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) { max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100); specpdl_ref count = SPECPDL_INDEX (); - ptrdiff_t counti = specpdl_ref_to_count (count); AUTO_STRING (redisplay_trace, "*Redisplay_trace*"); Lisp_Object redisplay_trace_buffer; AUTO_STRING (gap, "\n\n\n\n"); /* Separates things in *Redisplay-trace* */ Lisp_Object delayed_warning; - max_ensure_room (&max_specpdl_size, counti, 200); redisplay_trace_buffer = Fget_buffer_create (redisplay_trace, Qnil); current_buffer = XBUFFER (redisplay_trace_buffer); if (!backtrace_yet) /* Are we on the first backtrace of the command? */ @@ -2376,17 +2349,12 @@ grow_specpdl_allocation (void) eassert (specpdl_ptr == specpdl_end); specpdl_ref count = SPECPDL_INDEX (); - ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000); + ptrdiff_t max_size = PTRDIFF_MAX - 1000; union specbinding *pdlvec = specpdl - 1; ptrdiff_t size = specpdl_end - specpdl; ptrdiff_t pdlvecsize = size + 1; if (max_size <= size) - { - if (max_specpdl_size < 400) - max_size = max_specpdl_size = 400; - if (max_size <= size) - xsignal0 (Qexcessive_variable_binding); - } + xsignal0 (Qexcessive_variable_binding); /* Can't happen, essentially. */ pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl); specpdl = pdlvec + 1; specpdl_end = specpdl + pdlvecsize - 1; @@ -4229,22 +4197,6 @@ Lisp_Object backtrace_top_function (void) void syms_of_eval (void) { - DEFVAR_INT ("max-specpdl-size", max_specpdl_size, - doc: /* Limit on number of Lisp variable bindings and `unwind-protect's. - -If Lisp code tries to use more bindings than this amount, an error is -signaled. - -You can safely increase this variable substantially if the default -value proves inconveniently small. However, if you increase it too -much, Emacs could run out of memory trying to make the stack bigger. -Note that this limit may be silently increased by the debugger if -`debug-on-error' or `debug-on-quit' is set. - -\"spec\" is short for \"special variables\", i.e., dynamically bound -variables. \"PDL\" is short for \"push-down list\", which is an old -term for \"stack\". */); - DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth, doc: /* Limit on depth in `eval', `apply' and `funcall' before error. diff --git a/src/fileio.c b/src/fileio.c index 6efea8ac369..dd7f85ec97f 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -6019,11 +6019,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) bool old_message_p = 0; struct auto_save_unwind auto_save_unwind; - intmax_t sum = INT_ADD_WRAPV (specpdl_end - specpdl, 40, &sum) - ? INTMAX_MAX : sum; - if (max_specpdl_size < sum) - max_specpdl_size = sum; - if (minibuf_level) no_message = Qt; From 0275b3a63168f66f3d1a5e8ac96200533519aa27 Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Mon, 19 Sep 2022 20:36:53 +0200 Subject: [PATCH 09/10] perl-mode: / is a regexp match if there's nothing before it * lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): A "/" that starts the first statement is a regexp match. (Bug#997) * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-997): New test. --- lisp/progmodes/perl-mode.el | 1 + test/lisp/progmodes/cperl-mode-tests.el | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 70cb4605683..bd8f4ecd1c0 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -280,6 +280,7 @@ (backward-sexp 1) (member (buffer-substring (point) end) perl--syntax-exp-intro-keywords))) + (bobp) (memq (char-before) '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[)))))) nil ;; A division sign instead of a regexp-match. diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index db3feec93ab..66039d6fc7f 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -723,6 +723,18 @@ created by CPerl mode, so skip it for Perl mode." ;;; Tests for issues reported in the Bug Tracker +(ert-deftest cperl-test-bug-997 () + "Test that we distinguish a regexp match when there's nothing before it." + (let ((code "# some comment\n\n/fontify me/;\n")) + (with-temp-buffer + (funcall cperl-test-mode) + (insert code) + (font-lock-ensure) + (goto-char (point-min)) + (search-forward "/f") + (should (equal (get-text-property (point) 'face) + 'font-lock-string-face))))) + (defun cperl-test--run-bug-10483 () "Runs a short program, intended to be under timer scrutiny. This function is intended to be used by an Emacs subprocess in From d6b25b84bc8cde6b8d396b073945c8340e6ca40d Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Mon, 19 Sep 2022 20:47:00 +0200 Subject: [PATCH 10/10] Minor touch-ups of some recent OSC stuff * lisp/comint.el (comint-osc-handlers): (comint-osc-hyperlink-map): Use defvaralias (bug#57821). * lisp/osc.el: Fix some comments. --- etc/NEWS | 4 +++- lisp/comint.el | 4 ++-- lisp/osc.el | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 723bdd7c75d..ee333a84e45 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2450,7 +2450,9 @@ Adding the new function 'osc-compilation-filter' to sequences in compilation buffers. By default, all sequences are filtered out. -A handler for OSC 2, the command to set a window title, is provided. +The list of handlers (already covering OSC 7 and 8) has been extended +with a handler for OSC 2, the command to set a window title. + +++ *** New user option 'project-vc-include-untracked'. diff --git a/lisp/comint.el b/lisp/comint.el index afaa27c2c0a..b2a04ea55ae 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3916,11 +3916,11 @@ REGEXP-GROUP is the regular expression group in REGEXP to use." ;; sequences. ;; Aliases defined for reverse compatibility -(defalias 'comint-osc-handlers 'osc-handlers) +(defvaralias 'comint-osc-handlers 'osc-handlers) (defalias 'comint-osc-directory-tracker 'osc-directory-tracker) (defalias 'comint-osc-hyperlink-handler 'osc-hyperlink-handler) (defalias 'comint-osc-hyperlink 'osc-hyperlink) -(defalias 'comint-osc-hyperlink-map 'osc-hyperlink-map) +(defvaralias 'comint-osc-hyperlink-map 'osc-hyperlink-map) (defun comint-osc-process-output (_) "Interpret OSC escape sequences in comint output. diff --git a/lisp/osc.el b/lisp/osc.el index 8f4cd630ba0..14f7fe6a4f3 100644 --- a/lisp/osc.el +++ b/lisp/osc.el @@ -22,14 +22,14 @@ ;;; Commentary: -;; Interpretation of OSC (Operating System Commands) escape -;; sequences. Handlers for OSC 2, 7 and 8 (for window title, current -;; directory and hyperlinks respectively) are provided. +;; Interpretation of OSC (Operating System Commands) escape sequences. +;; Handlers for OSC 2, 7 and 8 (for window title, current directory +;; and hyperlinks respectively) are provided. ;; The function `osc-compilation-filter' can be added to ;; `compilation-filter-hook' to collect OSC sequences in compilation -;; buffers. The variable `osc-for-compilation-buffer' tells what to do -;; with collected sequences. +;; buffers. The variable `osc-for-compilation-buffer' tells what to +;; do with collected sequences. ;;; Code: