1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix Edebug's handling of dotted specs (bug#6415)

* lisp/emacs-lisp/cl-macs.el (cl-destructuring-bind): Use
cl-macro-list1 instead of cl-macro-list in Edebug spec.

* lisp/emacs-lisp/edebug.el (edebug-after-dotted-spec): Delete
unused variable.
(edebug-dotted-spec): Add docstring.
(edebug-match-specs): Allow &optional and &rest specs to
match nothing at the tail of a dotted form. Handle matches of
dotted form tails which return non-lists.

* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-dotted-forms):
New test.

* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el:
(edebug-test-code-use-destructuring-bind): New function.
This commit is contained in:
Gemini Lasswell 2017-11-01 21:13:02 -07:00
parent 16358d4fcb
commit 0ded1b41a9
4 changed files with 58 additions and 29 deletions

View file

@ -126,5 +126,9 @@
!start!(with-current-buffer (get-buffer-create "*edebug-test-code-buffer*")
!body!(format "current-buffer: %s" (current-buffer))))
(defun edebug-test-code-use-destructuring-bind ()
(let ((two 2) (three 3))
(cl-destructuring-bind (x . y) (cons two three) (+ x!x! y!y!))))
(provide 'edebug-test-code)
;;; edebug-test-code.el ends here

View file

@ -899,5 +899,19 @@ test and possibly others should be updated."
"@g" (should (equal edebug-tests-@-result
'(#("abcd" 1 3 (face italic)) 511))))))
(ert-deftest edebug-tests-dotted-forms ()
"Edebug can instrument code matching the tail of a dotted spec (Bug#6415)."
(edebug-tests-with-normal-env
(edebug-tests-setup-@ "use-destructuring-bind" nil t)
(edebug-tests-run-kbd-macro
"@ SPC SPC SPC SPC SPC SPC"
(edebug-tests-should-be-at "use-destructuring-bind" "x")
(edebug-tests-should-match-result-in-messages "2 (#o2, #x2, ?\\C-b)")
"SPC"
(edebug-tests-should-be-at "use-destructuring-bind" "y")
(edebug-tests-should-match-result-in-messages "3 (#o3, #x3, ?\\C-c)")
"g"
(should (equal edebug-tests-@-result 5)))))
(provide 'edebug-tests)
;;; edebug-tests.el ends here