From unknown Sun Jun 15 08:52:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Apr 2014 11:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17348 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 17348@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.139851099324104 (code B ref -1); Sat, 26 Apr 2014 11:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Apr 2014 11:16:33 +0000 Received: from localhost ([127.0.0.1]:59014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We0at-0006Ge-JG for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46326) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We0ap-0006GV-Pc for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1We0af-0006qf-Pw for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We0af-0006qX-MS for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We0aY-0001rT-2p for bug-gnu-emacs@gnu.org; Sat, 26 Apr 2014 07:16:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1We0aQ-0006U6-KW for bug-gnu-emacs@gnu.org; Sat, 26 Apr 2014 07:16:10 -0400 Received: from mailrelay004.isp.belgacom.be ([195.238.6.170]:52499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We0aQ-0006Tx-EQ for bug-gnu-emacs@gnu.org; Sat, 26 Apr 2014 07:16:02 -0400 X-Belgacom-Dynamic: yes Received: from 2.152-246-81.adsl-dyn.isp.belgacom.be (HELO LDLC-portable) ([81.246.152.2]) by relay.skynet.be with ESMTP; 26 Apr 2014 13:16:00 +0200 From: Nicolas Richard Date: Sat, 26 Apr 2014 13:16:00 +0200 Message-ID: <87vbtwl4sv.fsf@yahoo.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Evalling: (progn (defun yfcheck () (message "Check")) (defun yftest () (message "Test")) (advice-add 'yftest :before #'yfcheck) (advice-add 'yftest :after #'yfcheck) (yftest) nil) gives (in the *Messages* buffer) Test Check I'd have expected: Check Test Check -- Nico. From unknown Sun Jun 15 08:52:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Apr 2014 12:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17348 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Nicolas Richard Cc: 17348@debbugs.gnu.org Received: via spool by 17348-submit@debbugs.gnu.org id=B17348.13985163806999 (code B ref 17348); Sat, 26 Apr 2014 12:47:02 +0000 Received: (at 17348) by debbugs.gnu.org; 26 Apr 2014 12:46:20 +0000 Received: from localhost ([127.0.0.1]:59056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We1zn-0001op-KL for submit@debbugs.gnu.org; Sat, 26 Apr 2014 08:46:19 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:33925) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We1zi-0001oZ-TT for 17348@debbugs.gnu.org; Sat, 26 Apr 2014 08:46:15 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVNMCqOU/2dsb2JhbABZgwaDSr0vgw6BFxd0giYBAQRWIxALNBIUGA0kiAzSGReOegeEOASpGYFqg0wh X-IPAS-Result: ArYGAIDvNVNMCqOU/2dsb2JhbABZgwaDSr0vgw6BFxd0giYBAQRWIxALNBIUGA0kiAzSGReOegeEOASpGYFqg0wh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="59126033" Received: from 76-10-163-148.dsl.teksavvy.com (HELO pastel.home) ([76.10.163.148]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Apr 2014 08:46:13 -0400 Received: by pastel.home (Postfix, from userid 20848) id B90BA600CA; Sat, 26 Apr 2014 08:46:13 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87vbtwl4sv.fsf@yahoo.fr> Date: Sat, 26 Apr 2014 08:46:13 -0400 In-Reply-To: <87vbtwl4sv.fsf@yahoo.fr> (Nicolas Richard's message of "Sat, 26 Apr 2014 13:16:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > (advice-add 'yftest :before #'yfcheck) > (advice-add 'yftest :after #'yfcheck) `advice-add' will not add the same function twice, indeed. Similarly to `add-hook'. This is done explicitly in advice--add-function: (when a ;; The advice is already present. Remove the old one, first. (setf (gv-deref ref) (advice--remove-function (gv-deref ref) (advice--car a)))) I guess we could change that, but then the notion of "removal" becomes more complicated. Stefan From unknown Sun Jun 15 08:52:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after Resent-From: Nicolas Richard Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Apr 2014 20:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17348 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: Nicolas Richard , 17348@debbugs.gnu.org Received: via spool by 17348-submit@debbugs.gnu.org id=B17348.139854374529850 (code B ref 17348); Sat, 26 Apr 2014 20:23:02 +0000 Received: (at 17348) by debbugs.gnu.org; 26 Apr 2014 20:22:25 +0000 Received: from localhost ([127.0.0.1]:59338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We97A-0007lN-JO for submit@debbugs.gnu.org; Sat, 26 Apr 2014 16:22:24 -0400 Received: from mailrelay001.isp.belgacom.be ([195.238.6.51]:12037) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We977-0007l7-CY for 17348@debbugs.gnu.org; Sat, 26 Apr 2014 16:22:22 -0400 X-Belgacom-Dynamic: yes Received: from 41.233-178-91.adsl-dyn.isp.belgacom.be (HELO LDLC-portable) ([91.178.233.41]) by relay.skynet.be with ESMTP; 26 Apr 2014 22:22:19 +0200 From: Nicolas Richard References: <87vbtwl4sv.fsf@yahoo.fr> Date: Sat, 26 Apr 2014 22:22:19 +0200 In-Reply-To: (Stefan Monnier's message of "Sat, 26 Apr 2014 08:46:13 -0400") Message-ID: <87iopvlu2s.fsf@yahoo.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Stefan Monnier writes: >> (advice-add 'yftest :before #'yfcheck) >> (advice-add 'yftest :after #'yfcheck) > > `advice-add' will not add the same function twice, indeed. > Similarly to `add-hook'. This is done explicitly in advice--add-function: > > (when a > ;; The advice is already present. Remove the old one, first. > (setf (gv-deref ref) > (advice--remove-function (gv-deref ref) (advice--car a)))) > > I guess we could change that, but then the notion of "removal" becomes > more complicated. In the actual situation that lead me to adding the same function twice, it was a tracing function, like (message "time: %s ; value of foovariable: %s" (current-time) foovariable) and I assumed that I would be able to remove them both with one (advice-remove ...) -- I guess that isn't too complicated. OTOH I also think that the current behaviour is fine, but I'd suggest emitting a warning when an advice is being overwritten/removed that way. -- Nico. From unknown Sun Jun 15 08:52:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 May 2014 20:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17348 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Nicolas Richard Cc: 17348@debbugs.gnu.org Received: via spool by 17348-submit@debbugs.gnu.org id=B17348.13989772698978 (code B ref 17348); Thu, 01 May 2014 20:48:02 +0000 Received: (at 17348) by debbugs.gnu.org; 1 May 2014 20:47:49 +0000 Received: from localhost ([127.0.0.1]:47714 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WfxtU-0002Kj-G5 for submit@debbugs.gnu.org; Thu, 01 May 2014 16:47:48 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:60719) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WfxtR-0002Ka-Gz for 17348@debbugs.gnu.org; Thu, 01 May 2014 16:47:46 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id A735D2C09A; Thu, 1 May 2014 16:47:44 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id BF49B1E5B89; Thu, 1 May 2014 16:47:20 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id A592AB4125; Thu, 1 May 2014 16:47:20 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87vbtwl4sv.fsf@yahoo.fr> <87iopvlu2s.fsf@yahoo.fr> Date: Thu, 01 May 2014 16:47:20 -0400 In-Reply-To: <87iopvlu2s.fsf@yahoo.fr> (Nicolas Richard's message of "Sat, 26 Apr 2014 22:22:19 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -3.0 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.0 (---) > In the actual situation that lead me to adding the same function twice, > it was a tracing function, like (message "time: %s ; value of > foovariable: %s" (current-time) foovariable) and I assumed that I would > be able to remove them both with one (advice-remove ...) -- I guess that > isn't too complicated. Removing them both would not be desirable in general. > OTOH I also think that the current behaviour is fine, but I'd suggest > emitting a warning when an advice is being overwritten/removed that way. It's not meant to be a "secret" behavior, so people should be able to rely on this behavior (just like you can rely on add-hook being idempotent) and use it, in which case emitting a warning is not appropriate. This said, maybe we should make it easier to do what you wanted. E.g. we could probably make it possible to use different `name' properties to let a user add a function several times (potentially at different places, but even at the same place). Stefan From unknown Sun Jun 15 08:52:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Nicolas Richard Subject: bug#17348: closed (Re: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after) Message-ID: References: <87vbtwl4sv.fsf@yahoo.fr> X-Gnu-PR-Message: they-closed 17348 X-Gnu-PR-Package: emacs Reply-To: 17348@debbugs.gnu.org Date: Sat, 10 May 2014 20:10:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1399752603-27421-1" This is a multi-part message in MIME format... ------------=_1399752603-27421-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #17348: 24.3.50; Cannot advice-add the same function :before and :after which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 17348@debbugs.gnu.org. --=20 17348: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17348 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1399752603-27421-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 17348-done) by debbugs.gnu.org; 10 May 2014 20:09:31 +0000 Received: from localhost ([127.0.0.1]:58395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjDaM-00077G-Qi for submit@debbugs.gnu.org; Sat, 10 May 2014 16:09:31 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:49579) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WjDaJ-000770-U4 for 17348-done@debbugs.gnu.org; Sat, 10 May 2014 16:09:28 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVNMCqwB/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIxALNBIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ X-IPAS-Result: ArYGAIDvNVNMCqwB/2dsb2JhbABZgwaDSr0vgw6BFxd0giUBAQEBAgFWIxALNBIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="62272004" Received: from 76-10-172-1.dsl.teksavvy.com (HELO pastel.home) ([76.10.172.1]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 10 May 2014 16:09:21 -0400 Received: by pastel.home (Postfix, from userid 20848) id 684B360786; Sat, 10 May 2014 16:09:21 -0400 (EDT) From: Stefan Monnier To: Nicolas Richard Subject: Re: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after Message-ID: References: <87vbtwl4sv.fsf@yahoo.fr> <87iopvlu2s.fsf@yahoo.fr> Date: Sat, 10 May 2014 16:09:21 -0400 In-Reply-To: (Stefan Monnier's message of "Thu, 01 May 2014 16:47:20 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 17348-done Cc: 17348-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) I installed a patch in `emacs-24' which will let you add the same function multiple times, as long as you specify different `name' properties for each one. >> In the actual situation that lead me to adding the same function twice, >> it was a tracing function, like (message "time: %s ; value of >> foovariable: %s" (current-time) foovariable) and I assumed that I would >> be able to remove them both with one (advice-remove ...) -- I guess that >> isn't too complicated. > Removing them both would not be desirable in general. With the new code, you can remove each one individually by specifying its `name', or you can remove them all by specifying the function itself. Stefan ------------=_1399752603-27421-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 26 Apr 2014 11:16:33 +0000 Received: from localhost ([127.0.0.1]:59014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We0at-0006Ge-JG for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46326) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1We0ap-0006GV-Pc for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1We0af-0006qf-Pw for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We0af-0006qX-MS for submit@debbugs.gnu.org; Sat, 26 Apr 2014 07:16:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We0aY-0001rT-2p for bug-gnu-emacs@gnu.org; Sat, 26 Apr 2014 07:16:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1We0aQ-0006U6-KW for bug-gnu-emacs@gnu.org; Sat, 26 Apr 2014 07:16:10 -0400 Received: from mailrelay004.isp.belgacom.be ([195.238.6.170]:52499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1We0aQ-0006Tx-EQ for bug-gnu-emacs@gnu.org; Sat, 26 Apr 2014 07:16:02 -0400 X-Belgacom-Dynamic: yes Received: from 2.152-246-81.adsl-dyn.isp.belgacom.be (HELO LDLC-portable) ([81.246.152.2]) by relay.skynet.be with ESMTP; 26 Apr 2014 13:16:00 +0200 From: Nicolas Richard To: bug-gnu-emacs@gnu.org Subject: 24.3.50; Cannot advice-add the same function :before and :after Date: Sat, 26 Apr 2014 13:16:00 +0200 Message-ID: <87vbtwl4sv.fsf@yahoo.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Evalling: (progn (defun yfcheck () (message "Check")) (defun yftest () (message "Test")) (advice-add 'yftest :before #'yfcheck) (advice-add 'yftest :after #'yfcheck) (yftest) nil) gives (in the *Messages* buffer) Test Check I'd have expected: Check Test Check -- Nico. ------------=_1399752603-27421-1--