reddit / emacs

Is there a way to "apply" Edebug specs?

okamsn · 2022-02-05 02:00
The manual for instrumenting macros states that part of the spec can be a symbol: > Any other symbol in a specification list may be a predicate or an indirect > specification. > > If the symbol has an Edebug specification, this 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 def-edebug-spec just as for macros. See the defun example. > > Otherwise, the symbol should be a predicate. The predicate is called with the > argument, and if the predicate returns nil, the specification fails and the > argument is not instrumented. > Some suitable predicates include symbolp, integerp, stringp, vectorp, and atom. From this, it's not clear to me what it means for a function to "process" the arguments. For example, I would like to see if the arguments match one of several specs. Something like (cl-dolist (spec my-specs) (when (edebug-apply spec args) (cl-return t))) Is this possible?
nv-elisp · 2022-02-05 04:14
Have you tried it? What happened?
okamsn · 2022-02-09 01:48
The function `edebug-apply` doesn't exist. The closest function, by suggestive naming at least, is `edebug-match-specs`, but I'm still digging into how Edebug works. I was wondering if anyone had any experience with these features.