From unknown Sat Aug 09 04:55:45 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#16319 <16319@debbugs.gnu.org> To: bug#16319 <16319@debbugs.gnu.org> Subject: Status: 24.3.50; `case' macro not expanded in advice Reply-To: bug#16319 <16319@debbugs.gnu.org> Date: Sat, 09 Aug 2025 11:55:45 +0000 retitle 16319 24.3.50; `case' macro not expanded in advice reassign 16319 emacs submitter 16319 Drew Adams severity 16319 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 01 17:05:53 2014 Received: (at submit) by debbugs.gnu.org; 1 Jan 2014 22:05:53 +0000 Received: from localhost ([127.0.0.1]:56668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VyTvE-00017c-I4 for submit@debbugs.gnu.org; Wed, 01 Jan 2014 17:05:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58220) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VyTvD-00017U-0Q for submit@debbugs.gnu.org; Wed, 01 Jan 2014 17:05:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VyTv2-0000AM-Jg for submit@debbugs.gnu.org; Wed, 01 Jan 2014 17:05:50 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyTv2-0000AI-Ez for submit@debbugs.gnu.org; Wed, 01 Jan 2014 17:05:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyTut-00050W-QK for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2014 17:05:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VyTuk-00008q-Tj for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2014 17:05:31 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:20988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyTuk-00008m-Nr for bug-gnu-emacs@gnu.org; Wed, 01 Jan 2014 17:05:22 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id s01M5KAn030795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Jan 2014 22:05:21 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s01M5JnQ024759 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 1 Jan 2014 22:05:20 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s01M5Jrh023217 for ; Wed, 1 Jan 2014 22:05:19 GMT MIME-Version: 1.0 Message-ID: Date: Wed, 1 Jan 2014 14:05:18 -0800 (PST) From: Drew Adams To: bug-gnu-emacs@gnu.org Subject: 24.3.50; `case' macro not expanded in advice X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] 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: -4.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: -4.0 (----) 1. This bug: emacs -Q Put this in a file foo.el and byte-compile it. (eval-when-compile (require 'cl)) ;; case,=20 (when (fboundp 'file-cache-add-file) (defadvice file-cache-add-file (around bmkp-autofile-filecache activate) "Respect option `bmkp-autofile-filecache'." (case bmkp-autofile-filecache (autofile-only (bmkp-autofile-set (ad-get-arg 0) nil nil 'NO-UPDA= TE-P)) (autofile+cache (progn ad-do-it (bmkp-autofile-set (ad-get-arg 0)= nil nil 'NO-UPDATE-P 'MSG-P))) (cache-only ad-do-it)))) emacs -Q M-x load-file foo.elc M-: (file-cache-add-file "foo.el") Debugger entered--Lisp error: (void-function case) (case bmkp-autofile-filecache (autofile-only (bmkp-autofile-set file=20 nil nil (quote NO-UPDATE-P))) (autofile+cache (progn (setq ad-return-value (with-no-warnings (funcall ad--addoit-function file))) (bmkp-autofile-set file nil nil (quote NO-UPDATE-P) (quote MSG-P)))) (cache-only (setq ad-return-value (with-no-warnings (funcall ad--addoit-function file)))))=20 (let (ad-return-value) (case bmkp-autofile-filecache (autofile-only (bmkp-autofile-set file nil nil (quote NO-UPDATE-P))) (autofile+cache (progn (setq ad-return-value (with-no-warnings (funcall ad--addoit-function file))) (bmkp-autofile-set file nil nil (quote NO-UPDATE-P) (quote MSG-P)))) (cache-only (setq ad-return-value (with-no-warnings (funcall ad--addoit-function file))))) ad-return-value)=20 ad-Advice-file-cache-add-file(#[...]) file-cache-add-file("foo.el") eval((file-cache-add-file "foo.el") nil) eval-expression((file-cache-add-file "foo.el") nil) call-interactively(eval-expression nil nil) command-execute(eval-expression) 2. Another (minor), related bug: As a workaround, I defined a helper function, which has just the `case' sexp, and I use that in the defadvice. But then I get a warning about `ad-do-it' being an undefined variable. So I work around that by adding (defvar ad-do-it). But that's not right either, since `ad-do-it' is not a variable. Fixing #1 will take care of #2. If you do not fix #1 then at least the byte-compiler should not flag `ad-do-it' as an undefined variable. In GNU Emacs 24.3.50.1 (i686-pc-mingw32) of 2013-12-27 on ODIEONE Bzr revision: 115778 rgm@gnu.org-20131228000456-1797o8z6veuyozs0 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/binary --enable-checking=3Dyes,glyphs 'CFLAGS=3D-O0 -g3' LDFLAGS=3D-Lc:/Devel/emacs/lib CPPFLAGS=3D-Ic:/Devel/emacs/include' From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 02 10:14:51 2014 Received: (at 16319-done) by debbugs.gnu.org; 2 Jan 2014 15:14:51 +0000 Received: from localhost ([127.0.0.1]:58040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vyjz1-0005xr-6P for submit@debbugs.gnu.org; Thu, 02 Jan 2014 10:14:51 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:11983) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vyjyx-0005xg-NP for 16319-done@debbugs.gnu.org; Thu, 02 Jan 2014 10:14:48 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFsr+l6/2dsb2JhbABEuzWDWRdzgh8BBVYjEAs0EhQYDSSIJMEtkQoDiGGcGYFegxU X-IPAS-Result: Av8EABK/CFFsr+l6/2dsb2JhbABEuzWDWRdzgh8BBVYjEAs0EhQYDSSIJMEtkQoDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="43765428" Received: from 108-175-233-122.dsl.teksavvy.com (HELO pastel.home) ([108.175.233.122]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 02 Jan 2014 10:14:46 -0500 Received: by pastel.home (Postfix, from userid 20848) id A89AB6013C; Thu, 2 Jan 2014 10:14:46 -0500 (EST) From: Stefan Monnier To: Drew Adams Subject: Re: bug#16319: 24.3.50; `case' macro not expanded in advice Message-ID: References: Date: Thu, 02 Jan 2014 10:14:46 -0500 In-Reply-To: (Drew Adams's message of "Wed, 1 Jan 2014 14:05:18 -0800 (PST)") 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.3 (/) X-Debbugs-Envelope-To: 16319-done Cc: 16319-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 (/) Indeed macros in defadvice are expanded only at run-time. Use advice-add which does not suffer from this problem. Stefan From unknown Sat Aug 09 04:55:45 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 31 Jan 2014 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator