From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Katsumi Yamaoka <yamaoka@jpl.org>,
ivan.kanis@googlemail.com, asjo@koldfront.dk,
emacs-devel@gnu.org
Subject: Re: Simple defadvice's stopped working (commit daa84a03, Thu Nov 8 23:10:16 2012 -0500)
Date: Fri, 16 Nov 2012 12:25:15 -0500 [thread overview]
Message-ID: <jwv7gplscbt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAAeL0STm+DwN2+hcs7che2F-G5idvZ8dUsJr+ooL7ACa8i42Rg@mail.gmail.com> (Juanma Barranquero's message of "Fri, 16 Nov 2012 17:33:00 +0100")
>> But if you can point me to concrete examples that need to work (and/or
>> that used to work), it would be very helpful.
> As an example of an advice from my .emacs that used to work:
> (defadvice delete-indentation (before my-delete-indentation activate compile)
> (when (called-interactively-p 'any)
> (ad-set-arg 0 (not (ad-get-arg 0)))))
OK, that's a good start.
My current code can handle uses of called-interactively-p in
after/before advice but not in around advice. Problem is: all advices
defined with `defadvice' are implemented as (advice-add foo :around ...)
and indeed your "before" advice cannot be implemented as a (advice-add
foo :before ...) because it modifies arguments.
Hmm... maybe advice-add's before and after advices should be different.
Instead of before being like
(lambda (&rest r) (apply FUNCTION r) (apply OLDFUN r))
it should maybe be like
(lambda (&rest r) (apply OLDFUN (apply FUNCTION r)))
Or maybe this should be a new WHERE, which we could call `:filter-args',
and we could have a corresponding `:filter-return'.
In that case my code would handle:
(advice-add 'delete-indentation :filter-args
(lambda (arg &rest args)
(cons (or (called-interactively-p 'any) arg) args)))
-- Stefan
next prev parent reply other threads:[~2012-11-16 17:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-09 23:47 Simple defadvice's stopped working (commit daa84a03, Thu Nov 8 23:10:16 2012 -0500) Adam Sjøgren
2012-11-10 1:55 ` Stefan Monnier
2012-11-11 21:24 ` Tim Cross
2012-11-12 10:36 ` Ivan Kanis
2012-11-13 11:09 ` Katsumi Yamaoka
2012-11-13 14:34 ` Stefan Monnier
2012-11-13 23:18 ` Katsumi Yamaoka
2012-11-14 16:19 ` Juanma Barranquero
2012-11-15 2:08 ` Katsumi Yamaoka
2012-11-15 3:30 ` Stefan Monnier
2012-11-15 9:00 ` Ivan Kanis
2012-11-15 10:55 ` Katsumi Yamaoka
2012-11-15 14:39 ` Stefan Monnier
2012-11-15 23:01 ` Katsumi Yamaoka
2012-11-16 14:16 ` Stefan Monnier
2012-11-16 16:33 ` Juanma Barranquero
2012-11-16 17:25 ` Stefan Monnier [this message]
2012-11-16 17:36 ` Juanma Barranquero
2012-11-16 18:11 ` Stefan Monnier
2012-11-16 18:17 ` Juanma Barranquero
2012-11-16 20:11 ` Stefan Monnier
2012-11-16 23:52 ` Juanma Barranquero
2012-11-19 1:29 ` Stefan Monnier
2012-11-19 2:36 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv7gplscbt.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=asjo@koldfront.dk \
--cc=emacs-devel@gnu.org \
--cc=ivan.kanis@googlemail.com \
--cc=lekktu@gmail.com \
--cc=yamaoka@jpl.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.