bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25117: 25.1.90; Result of called-interactively-p differs WRT file co


From: Michael Heerdegen
Subject: bug#25117: 25.1.90; Result of called-interactively-p differs WRT file contents
Date: Mon, 21 Oct 2019 11:15:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> If I understand edebug.el correctly, this code is supposed to make
> called-interactively-p work?
>
> ;; When edebugging a function, some of the sub-expressions are
> ;; wrapped in (edebug-enter (lambda () ..)), so we need to teach
> ;; called-interactively-p that calls within the inner lambda should refer to
> ;; the outside function.
> (add-hook 'called-interactively-p-functions
>           #'edebug--called-interactively-skip)
> (defun edebug--called-interactively-skip (i frame1 frame2)
>   (when (and (eq (car-safe (nth 1 frame1)) 'lambda)
>              (eq (nth 1 (nth 1 frame1)) '())
>              (eq (nth 1 frame2) 'edebug-enter))
>     ;; `edebug-enter' calls itself on its first invocation.
>     (if (eq (nth 1 (backtrace-frame i 'called-interactively-p))
>             'edebug-enter)
>         2 1)))

I think so, yes.

> But I'm not familiar enough with `backtrace-frame' to say whether this,
> like, makes sense.  Anybody?

It makes sense.  Stefan wrote that, but it seems it just doesn't yet handle
the (eq (car-safe (nth 1 frame1)) 'closure) case - Stefan?

> The test case is edebug-defun this, and then `M-x foo'.  The
> (called-interactively-p) form will return nil when you step through the
> function.
>
> (defun foo ()
>   (interactive)
>   (let ((iact (called-interactively-p 'any)))
>     (message "%s" iact)))


Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]