[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Efficient edebug-instrumented predicate?
From: |
Arthur Miller |
Subject: |
Efficient edebug-instrumented predicate? |
Date: |
Mon, 04 Oct 2021 16:18:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
I would like to have a reliable and efficient predicate to test whether a
function has been intrumented for edebug or not.
As I have seen in the code, there is no such currently. Suggested patch is
refactored out of 'edebug-remove-intrumentation', but it seems to be slightly
inneficiet since it will try to strip all edebug instrumentation from a
function.
Helpful.el includes a different test based on entries added by edebug wrapper,
but I am not sure how reliable it is to use it since it can change internally?
#+begin_src emacs-lisp
(defun helpful--edebug-p (sym)
"Does function SYM have its definition patched by edebug?"
(let ((fn-def (indirect-function sym)))
;; Edebug replaces function source code with a sexp that has
;; `edebug-enter', `edebug-after' etc interleaved. This means the
;; function is interpreted, so `indirect-function' returns a list.
(when (and (consp fn-def) (consp (cdr fn-def)))
(-let [fn-end (-last-item fn-def)]
(and (consp fn-end)
#+end_src
Such predicate is useful for eventual tooling.
0001-Edebug-Instrumented-Predicate.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Efficient edebug-instrumented predicate?,
Arthur Miller <=