[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: |
Lars Ingebrigtsen |
Subject: |
bug#25117: 25.1.90; Result of called-interactively-p differs WRT file contents |
Date: |
Sun, 20 Oct 2019 23:34:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
> Ahh, only happens when run under edebug. Whilst with edebug in an
> otherwise empty buffer is fine in contrast.
This bug is still present in Emacs 27.
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)))
But I'm not familiar enough with `backtrace-frame' to say whether this,
like, makes sense. Anybody?
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)))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#25117: 25.1.90; Result of called-interactively-p differs WRT file contents,
Lars Ingebrigtsen <=