[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8d2fecd: Introduce element &error into edebug specification lists
From: |
Alan Mackenzie |
Subject: |
master 8d2fecd: Introduce element &error into edebug specification lists for macros |
Date: |
Fri, 17 Jan 2020 16:55:12 -0500 (EST) |
branch: master
commit 8d2fecdf6c372b8ff064454558ae5843d0607f06
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
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.
---
doc/lispref/edebug.texi | 5 +++++
etc/NEWS | 7 +++++++
lisp/emacs-lisp/edebug.el | 12 ++++++++++++
3 files changed, 24 insertions(+)
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 8be8307..cfef5c1 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -1362,6 +1362,11 @@ while matching the remainder of the specifications at
this level. This
is primarily used to generate more specific syntax error messages. See
@ref{Backtracking}, for more details. Also see the @code{let} example.
+@item &error
+@code{&error} should be followed by a string, an error message, in the
+edebug-spec; it aborts the instrumentation, displaying the message in
+the minibuffer.
+
@item @var{other-symbol}
@cindex indirect specifications
Any other symbol in a specification list may be a predicate or an
diff --git a/etc/NEWS b/etc/NEWS
index f5740c8..73ed3d7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -48,6 +48,13 @@ It was declared obsolete in Emacs 27.1.
** The sb-image.el library is now marked obsolete.
This file was a compatibility kludge which is no longer needed.
+** Edebug
+
++++
+*** Edebug specification lists can use the new keyword '&error', which
+unconditionally aborts the current edebug instrumentation with the
+supplied error message.
+
* New Modes and Packages in Emacs 28.1
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 0aa6caa..85cc8c8 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)
(¬ . edebug-match-¬)
(&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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8d2fecd: Introduce element &error into edebug specification lists for macros,
Alan Mackenzie <=