Subject: Re: bug#49592: 28.0.50; lisp-current-defun-name and non-standard defuns

From: Michael Heerdegen <[email-masked]>
Date: Sat, 06 Aug 2022 02:17:50 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> > I don't follow - edebug-spec of what, in the above case?
>
> I was suggesting that we could use the edebug spec (instead of
> heuristics) if it exists,

You want to find out the correct NAME of the thing being defined by
looking up the edebug-spec of the current top-level form instead of
simply assuming that the NAME is just the first argument of the call?

Makes sense - but I don't know if it's a big win and Edebug specs help
out in enough cases (lots of macros don't have one, even in Emacs
itself, e.g. `defvar-keymap').

Anyway, it wouldn't harm and motivate people even more to write Edebug
specs.  Or do you intent to give up the heuristic of using the first
argument completely?  I don't think that would be a good idea.  Because
this heuristic works very well in practice IME.  AFAIR, most of the
time, or every time, when I saw the heuristic of
`lisp-current-defun-name' failed, the top-level expression was not a
defining form (like in my example) and `lisp-current-defun-name'
returned the complete sexp - and treating this case specially would
already give quite good results I think.

Michael.