unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ryan <rct@thompsonclan.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 3984@debbugs.gnu.org
Subject: bug#3984:
Date: Tue, 17 Sep 2013 10:22:51 -0700	[thread overview]
Message-ID: <52388FEB.6020007@thompsonclan.org> (raw)
In-Reply-To: <jwvioxzk3hr.fsf-monnier+emacs@gnu.org>

On 9/17/13 6:10 AM, Stefan Monnier wrote:
>> We have "ad-is-advised" which we can use to find which stack frames
>> correspond to advised functions. We have "ad-get-orig-definition" which we
>> can use to find the original definition of an advised function.
> These are functions of advice.el, which is on the way out.  We need to
> look at nadvice.el.
Wait, so defadvice and friends are going away entirely? Is everything in 
advice.el going away, or are some parts of it going to be converted to 
the new advice system? Is all this documented somewhere?
>
> Thinking about it once more, I realize that your "advised
> call-interactively" case might indeed be resolved by the current code,
> except that it bumps into the problematic case of "deepest advice is
> using :around".
>
> Could you check if it is the case simply be doing a dummy (advice-add
> 'call-interactively :before #'ignore) before your defadvice?
>
> If that works, then we can probably fix that problem in the following way:
> - keep track of every function value (e.g. #<subr call-interactively> in
>    our case) that is wrapped (at the deepest level) in an :around advice
>    (e.g. in a hash-table).
> - when walking up the stack, if we find such a function, look up the
>    stack searching for the matching function symbol (just like we already
>    do when encountering an internal advice element on the stack).
>
>
>          Stefan
I tried the before advice, and it doesn't seem to work. With the 
following code in emacs -Q:

(advice-add 'call-interactively :before #'ignore)
(defun myfun2 ()
   (interactive)
   (or (called-interactively-p)
       (error "Must be interactive!")))
(call-interactively 'myfun2)

I get the following stack trace:

Debugger entered--Lisp error: (error "Must be interactive!")
   signal(error ("Must be interactive!"))
   error("Must be interactive!")
   (or (called-interactively-p) (error "Must be interactive!"))
   myfun2()
   #<subr call-interactively>(myfun2)
   apply(#<subr call-interactively> myfun2)
   call-interactively(myfun2)
   eval-region(345 373 t (lambda (ignore) (goto-char 373) (quote 
(call-interactively (quote myfun2)))))  ; Reading at buffer position 345
   apply(eval-region (345 373 t (lambda (ignore) (goto-char 373) (quote 
(call-interactively (quote myfun2))))))
   eval-defun-2()
   eval-defun(nil)
   #<subr call-interactively>(eval-defun nil nil)
   apply(#<subr call-interactively> (eval-defun nil nil))
   call-interactively(eval-defun nil nil)
   command-execute(eval-defun)

Same thing happens when I do M-x myfun2.





  reply	other threads:[~2013-09-17 17:22 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30 22:37 bug#3984: 23.0.96; defadvice of call-interactively defeats interactive-p Drew Adams
2009-07-31  1:58 ` Stefan Monnier
2009-07-31 14:19   ` Drew Adams
2009-07-31 19:31     ` Stefan Monnier
2009-07-31 20:04       ` Drew Adams
2011-10-10  6:00 ` Kai Tetzlaff
2011-10-11 14:26   ` Drew Adams
2011-10-11 15:46     ` Stefan Monnier
2011-10-11 16:05       ` Drew Adams
2013-09-10 20:29 ` Christopher Wellons
2013-09-11  0:29   ` Stefan Monnier
2013-09-13  8:56 ` bug#3984: Fix for #3984 Ryan
2013-09-13 13:18   ` Stefan Monnier
2013-09-13 18:30     ` Ryan
2013-09-13 19:27       ` Ryan
2013-09-13 21:02         ` Stefan Monnier
2013-09-17  3:18           ` Ryan
2013-09-17 13:10             ` Stefan Monnier
2013-09-17 17:22               ` Ryan [this message]
2013-09-18  1:46                 ` bug#3984: Stefan Monnier
2013-09-18 23:30                   ` bug#3984: Ryan
2013-09-19  0:47                     ` bug#3984: Ryan
2013-09-19  3:38                       ` bug#3984: Stefan Monnier
2013-09-19  8:06                         ` bug#3984: Ryan
2013-09-19 19:23                           ` bug#3984: Ryan
2013-09-19 20:59                             ` bug#3984: Stefan Monnier
2013-09-19 21:59                             ` bug#3984: Ryan
2013-09-20  4:23                               ` bug#3984: Ryan
2013-09-20  4:58                                 ` bug#3984: Fix case where call-interactively is advised Ryan
2013-09-20  5:03                                   ` bug#3984: Ryan
2013-09-20 14:35                                 ` bug#3984: Stefan Monnier
2013-09-20 16:54                                   ` bug#3984: Ryan
2013-09-20 16:56                                     ` bug#3984: Ryan
2013-09-20 14:54                               ` bug#3984: Stefan Monnier
2013-09-20 16:50                                 ` bug#3984: Ryan
2013-09-20 19:59                                   ` bug#3984: Stefan Monnier
2013-09-13 10:24 ` bug#3984: bug#123: Potential fix Ryan

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=52388FEB.6020007@thompsonclan.org \
    --to=rct@thompsonclan.org \
    --cc=3984@debbugs.gnu.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).