unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Frank Fischer <frank-fischer@shadow-soft.de>
To: help-gnu-emacs@gnu.org
Subject: Re: defadvice and called-interactively-p
Date: Wed, 6 Jun 2012 08:11:38 +0000 (UTC)	[thread overview]
Message-ID: <jqn3bq$jhn$1@dough.gmane.org> (raw)
In-Reply-To: 87txyoyivg.fsf@ericabrahamsen.net

On 2012-06-06, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
> Yup, it was just a guess. Another thing you're probably already
> perfectly aware of: the docstring for called-interactively-p says,
>
> "This function is meant for implementing advice and other
> function-modifying features."
>
> If called-interactively-p is meant to go in the advice, not the
> original functions, the behavior you're seeing is probably the whole
> point of how it works.

Yes I know this docstring. On the other hand the elisp manual says in 21.4

   The above method with the additional argument is usually best,
   because it allows callers to say "treat this call as interactive."
   But you can also do the job by testing `called-interactively-p'.
   
So even if using `called-interactively-p' is not the "recommended"
way, it sounds to me as if it is a completely valid one. Bug there's
nothing that suggests using `called-interactively-p' is dangerous when
used in an advised function (at least I did not find something in the
whole manual).

But the problem is that I cannot change/redefine the command that uses
`called-interactively-p' (that's the whole point of using an advice at
all), so changing this function is not an option. Of course, the
question arises if a function using `called-interactively-p' should be
considered being broken ... ?

Thanks for you comments,
Frank




  reply	other threads:[~2012-06-06  8:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06  7:03 defadvice and called-interactively-p Frank Fischer
2012-06-06  7:26 ` Eric Abrahamsen
2012-06-06  7:35   ` Frank Fischer
2012-06-06  7:55     ` Eric Abrahamsen
2012-06-06  8:11       ` Frank Fischer [this message]
2012-06-08  0:03         ` Juanma Barranquero
2012-06-08  6:45           ` Frank Fischer
2012-06-08  7:02             ` Juanma Barranquero

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='jqn3bq$jhn$1@dough.gmane.org' \
    --to=frank-fischer@shadow-soft.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).