summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-02-12 19:28:25 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-02-12 19:28:25 -0500
commitd1be48fdedabb451d5c6cf315fd5f09a632e771f (patch)
tree4ebe615e7843913a58596f36929d3f69fb501ae3 /doc
parentbdd8d5b6a45bb66e230473fe221f8c1832bebb6c (diff)
downloademacs-d1be48fdedabb451d5c6cf315fd5f09a632e771f.tar.gz
Edebug: Overload `edebug-form-spec` even less
The `edebug-form-spec` symbol property was used both to map forms's head symbol to the corresponding spec, and to map spec element names to their expansion. This lead to name conflicts which break instrumentation of examples such as (cl-flet ((gate (x) x)) (gate 4)) because of the Edebug spec element `gate`. So introduce a new symbol property `edebug-elem-spec`. * lisp/subr.el (def-edebug-elem-spec): New function. * lisp/emacs-lisp/edebug.el (edebug--get-elem-spec): New function. (edebug-match-symbol): Use it. (Core Edebug elems): Put them on `edebug-elem-spec` instead of `edebug-form-spec`. (ELisp special forms): Set their `edebug-form-spec` via dolist. (Other non-core Edebug elems): Use `def-edebug-elem-spec`. (edebug-\`): Use `declare`. * lisp/emacs-lisp/pcase.el (pcase-PAT, pcase-FUN, pcase-QPAT): * lisp/skeleton.el (skeleton-edebug-spec): * lisp/emacs-lisp/cl-macs.el: Use `def-edebug-elem-spec`. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests--conflicting-internal-names): New test. * test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el (edebug-test-code-cl-flet1): New test case. * doc/lispref/edebug.texi (Specification List): Add `def-edebug-elem-spec`. (Specification Examples): Use it. * doc/lispref/loading.texi (Hooks for Loading): Avoid the use of `def-edebug-spec` in example (better use `debug` declaration).
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/edebug.texi41
-rw-r--r--doc/lispref/loading.texi2
2 files changed, 24 insertions, 19 deletions
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 693d0e0630a..99d55c7ab95 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -1203,7 +1203,7 @@ define Edebug specifications for special forms implemented in C.
@defmac def-edebug-spec macro specification
Specify which expressions of a call to macro @var{macro} are forms to be
-evaluated. @var{specification} should be the edebug specification.
+evaluated. @var{specification} should be the Edebug specification.
Neither argument is evaluated.
The @var{macro} argument can actually be any symbol, not just a macro
@@ -1389,8 +1389,13 @@ indirect specification.
If the symbol has an Edebug specification, this @dfn{indirect
specification} should be either a list specification that is used in
place of the symbol, or a function that is called to process the
-arguments. The specification may be defined with @code{def-edebug-spec}
-just as for macros. See the @code{defun} example.
+arguments. The specification may be defined with
+@code{def-edebug-elem-spec}:
+
+@defun def-edebug-elem-spec element specification
+Define the @var{specification} to use in place of the symbol @var{element}.
+@var{specification} has to be a list.
+@end defun
Otherwise, the symbol should be a predicate. The predicate is called
with the argument, and if the predicate returns @code{nil}, the
@@ -1568,14 +1573,14 @@ specification for @code{defmacro} is very similar to that for
[&optional ("interactive" interactive)]
def-body))
-(def-edebug-spec lambda-list
- (([&rest arg]
- [&optional ["&optional" arg &rest arg]]
- &optional ["&rest" arg]
- )))
+(def-edebug-elem-spec 'lambda-list
+ '(([&rest arg]
+ [&optional ["&optional" arg &rest arg]]
+ &optional ["&rest" arg]
+ )))
-(def-edebug-spec interactive
- (&optional &or stringp def-form)) ; @r{Notice: @code{def-form}}
+(def-edebug-elem-spec 'interactive
+ '(&optional &or stringp def-form)) ; @r{Notice: @code{def-form}}
@end smallexample
The specification for backquote below illustrates how to match
@@ -1588,11 +1593,11 @@ could fail.)
@smallexample
(def-edebug-spec \` (backquote-form)) ; @r{Alias just for clarity.}
-(def-edebug-spec backquote-form
- (&or ([&or "," ",@@"] &or ("quote" backquote-form) form)
- (backquote-form . [&or nil backquote-form])
- (vector &rest backquote-form)
- sexp))
+(def-edebug-elem-spec 'backquote-form
+ '(&or ([&or "," ",@@"] &or ("quote" backquote-form) form)
+ (backquote-form . [&or nil backquote-form])
+ (vector &rest backquote-form)
+ sexp))
@end smallexample
@@ -1635,10 +1640,10 @@ option. @xref{Instrumenting}.
@defopt edebug-eval-macro-args
When this is non-@code{nil}, all macro arguments will be instrumented
-in the generated code. For any macro, an @code{edebug-form-spec}
+in the generated code. For any macro, the @code{debug} declaration
overrides this option. So to specify exceptions for macros that have
-some arguments evaluated and some not, use @code{def-edebug-spec} to
-specify an @code{edebug-form-spec}.
+some arguments evaluated and some not, use the @code{debug} declaration
+specify an Edebug form specification.
@end defopt
@defopt edebug-save-windows
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 22f0dde593a..33f37331947 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -1125,7 +1125,7 @@ You don't need to give a directory or extension in the file name
@var{library}. Normally, you just give a bare file name, like this:
@example
-(with-eval-after-load "edebug" (def-edebug-spec c-point t))
+(with-eval-after-load "js" (define-key js-mode-map "\C-c\C-c" 'js-eval))
@end example
To restrict which files can trigger the evaluation, include a