Call PF correctly from pcase--edebug-match-pat-args

Also correct a doc string and insert commentary.  This fixes
bug#74052.

* lisp/emacs-lisp/edebug.el
(edebug--match-&-spec-op <&interpose>): Correct and complete
the doc string, which now says MUST call exactly once, and
documents the return values of FUN, PF and
edebug--match-&-spec-op.  Also remove an unneeded `(...)
construct.

* lisp/emacs-lisp/pcase.el (pcase--edebug-match-pat-args): Call
PF also for the main cases handled.
This commit is contained in:
Alan Mackenzie 2024-10-28 16:35:27 +00:00
parent c05a13ef0d
commit fb59156655
2 changed files with 34 additions and 22 deletions

View file

@ -84,14 +84,17 @@
(defun pcase--edebug-match-pat-args (head pf)
;; (cl-assert (null (cdr head)))
(setq head (car head))
(or (alist-get head '((quote sexp)
(or &rest pcase-PAT)
(and &rest pcase-PAT)
(guard form)
(pred &or ("not" pcase-FUN) pcase-FUN)
(app pcase-FUN pcase-PAT)))
(let ((me (pcase--get-macroexpander head)))
(funcall pf (and me (symbolp me) (edebug-get-spec me))))))
(let ((specs
(or
(alist-get head '((quote sexp)
(or &rest pcase-PAT)
(and &rest pcase-PAT)
(guard form)
(pred &or ("not" pcase-FUN) pcase-FUN)
(app pcase-FUN pcase-PAT)))
(let ((me (pcase--get-macroexpander head)))
(and me (symbolp me) (edebug-get-spec me))))))
(funcall pf specs)))
(defun pcase--get-macroexpander (s)
"Return the macroexpander for pcase pattern head S, or nil."