unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 25117@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#25117: 25.1.90; Result of called-interactively-p differs WRT file contents
Date: Mon, 21 Oct 2019 11:15:33 +0200	[thread overview]
Message-ID: <8736fmpih6.fsf@web.de> (raw)
In-Reply-To: <87woczcd8t.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 20 Oct 2019 23:34:42 +0200")

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	other threads:[~2019-10-21  9:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 13:01 bug#25117: 25.1.90; Result of called-interactively-p differs WRT file contents Andreas Röhler
2016-12-05 16:18 ` Michael Heerdegen
2016-12-05 16:58   ` Andreas Röhler
2016-12-05 16:58     ` Michael Heerdegen
2016-12-05 17:18       ` Andreas Röhler
2016-12-05 17:39         ` Michael Heerdegen
2016-12-05 18:23           ` Andreas Röhler
2016-12-05 19:08             ` Noam Postavsky
2016-12-05 19:38               ` Andreas Röhler
2016-12-05 19:34                 ` Noam Postavsky
2016-12-05 19:52                   ` Andreas Röhler
2016-12-05 19:51                     ` Noam Postavsky
2016-12-05 20:09                       ` Andreas Röhler
2019-10-20 21:34             ` Lars Ingebrigtsen
2019-10-21  9:15               ` Michael Heerdegen [this message]
2019-10-21 12:21                 ` Stefan Monnier
2019-10-21 13:21                   ` Michael Heerdegen
2022-04-18 11:24                     ` bug#25117: 25.1.90; `called-interactively-p' from edebug with lexical-binding always gives nil Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736fmpih6.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=25117@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).