1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

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).
This commit is contained in:
Stefan Monnier 2021-02-12 19:28:25 -05:00
parent bdd8d5b6a4
commit d1be48fded
10 changed files with 267 additions and 232 deletions

View file

@ -137,5 +137,15 @@
,(cons func args))))
(wrap + 1 x)))
(defun edebug-test-code-cl-flet1 ()
(cl-flet
;; This `&rest' sexp head should not collide with
;; the Edebug spec elem of the same name.
((f (&rest x) x)
(gate (x) (+ x 5)))
;; This call to `gate' shouldn't collide with the Edebug spec elem
;; of the same name.
(message "Hi %s" (gate 7))))
(provide 'edebug-test-code)
;;; edebug-test-code.el ends here