Subject: bug#71934: closed (Re: bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 05 Jul 2024 04:26:02 +0000

Your bug report

#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71934: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71934
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects
From: Stefan Monnier <[email-masked]>
To: Michael Heerdegen <[email-masked]>
Cc: [email-masked]
Date: Fri, 05 Jul 2024 00:24:55 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

>> I pushed a patch to `emacs-30` which should fix this.
>> Can you confirm it fixes it in your real use case as well?
> Thanks.  Other use cases are fixed as well

Thank you, closing.

>  but advices are broken :-(
[...]
> (advice-add 'f :around (defun my-f--around-ad (f &rest args) (apply f args)))

AFAIK that's not new.

> Hitting [print] says nil.  AFAIU this should also work transparently,
> right?  The breakage seems to date further back in this case.

It should work for most advices but not for `:around` advice, because
fundamentally, it's virtually impossible to recognize this

    (apply f args)

as being an "interactive call".

> And i have another request: could you please search for the few other
> occurrences of the symbol 'closure' in the Emacs Elisp code base?
> I guess in most cases there is a need to update these places, too.

I already did.
There's one case on `comp.el` which may require some update, but I don't
understand the code enough to know what it intends to do.
It seems to match both `lambda` and `closure`, hence function *values*,
but somehow it doesn't try and handle byte-code functions which are far
more common function values, so maybe the `closure` is just irrelevant
and the code is expected to match source code expressions (whose
evaluation will return functions)?

        Stefan

Subject: 31.0.50; edebug--called-interactively-skip vs. new fun objects
From: Michael Heerdegen <[email-masked]>
To: [email-masked]
Date: Thu, 04 Jul 2024 07:11:36 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

AFAIU we must update this test in `edebug--called-interactively-skip':

#+begin_src emacs-lisp
  (when (and (memq (car-safe (nth 1 frame1)) '(lambda closure)) ...
#+end_src

My test case:

#+begin_src emacs-lisp
(defun f (x)
  (interactive "P")
  (message "c-i: %s" (called-interactively-p 'any)))
(global-set-key [print] #'f)
#+end_src

When edebugging `f', (called-interactively-p 'any) will eval to nil in
current master when hitting print.  Evalled to t as expected in older
Emacs versions.

TIA,

Michael.