From unknown Sat Aug 09 05:00:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16319: 24.3.50; `case' macro not expanded in advice Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Jan 2014 22:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16319 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 16319@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13886139534320 (code B ref -1); Wed, 01 Jan 2014 22:06:01 +0000 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 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-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 unknown Sat Aug 09 05:00:12 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: Drew Adams Subject: bug#16319: closed (Re: bug#16319: 24.3.50; `case' macro not expanded in advice) Message-ID: References: X-Gnu-PR-Message: they-closed 16319 X-Gnu-PR-Package: emacs Reply-To: 16319@debbugs.gnu.org Date: Thu, 02 Jan 2014 15:15:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1388675704-22962-1" This is a multi-part message in MIME format... ------------=_1388675704-22962-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #16319: 24.3.50; `case' macro not expanded in advice 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 16319@debbugs.gnu.org. --=20 16319: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D16319 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1388675704-22962-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit 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 ------------=_1388675704-22962-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit 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' ------------=_1388675704-22962-1--