summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2020-01-17 21:53:13 +0000
committerAlan Mackenzie <acm@muc.de>2020-01-17 21:53:13 +0000
commit8d2fecdf6c372b8ff064454558ae5843d0607f06 (patch)
tree8af86a930597807ef9163502e939128d0a566b6a /lisp/emacs-lisp
parentd97a77c481ec913d8c3c24f2eecdc41a28243678 (diff)
downloademacs-8d2fecdf6c372b8ff064454558ae5843d0607f06.tar.gz
emacs-8d2fecdf6c372b8ff064454558ae5843d0607f06.tar.bz2
emacs-8d2fecdf6c372b8ff064454558ae5843d0607f06.zip
Introduce element &error into edebug specification lists for macros
This fixes bug #37540. * lisp/emacs-lisp/edebug.el (top level): New entry for &error in alist used to associate elements with their handling functions. (edebug-match-&error): New function. (nested-backquote-form): Use the new element &error to abort instrumentation on encountering a three deep nesting of backquotes (without intervening commas). * doc/lispref/edebug.texi (Specification List): Add an entry for &error. * etc/NEWS: Add an entry for &error.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/edebug.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 0aa6caa37e1..85cc8c8e7ad 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1714,6 +1714,7 @@ contains a circular object."
(cl-macrolet-body . edebug-match-cl-macrolet-body)
(&not . edebug-match-&not)
(&key . edebug-match-&key)
+ (&error . edebug-match-&error)
(place . edebug-match-place)
(gate . edebug-match-gate)
;; (nil . edebug-match-nil) not this one - special case it.
@@ -1847,6 +1848,15 @@ contains a circular object."
(car (cdr pair))))
specs))))
+(defun edebug-match-&error (cursor specs)
+ ;; Signal an error, using the following string in the spec as argument.
+ (let ((error-string (car specs))
+ (edebug-error-point (edebug-before-offset cursor)))
+ (goto-char edebug-error-point)
+ (error "%s"
+ (if (stringp error-string)
+ error-string
+ "String expected after &error in edebug-spec"))))
(defun edebug-match-gate (_cursor)
;; Simply set the gate to prevent backtracking at this level.
@@ -2216,6 +2226,8 @@ into `edebug--cl-macrolet-defs' which is checked in `edebug-list-form-args'."
(def-edebug-spec nested-backquote-form
(&or
+ ("`" &error "Triply nested backquotes (without commas \"between\" them) \
+are too difficult to instrument")
;; Allow instrumentation of any , or ,@ contained within the (\, ...) or
;; (\,@ ...) matched on the next line.
([&or "," ",@"] backquote-form)