From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#12610: unable to use macro in defadvice Date: Fri, 12 Oct 2012 13:54:47 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1350064522 12892 80.91.229.3 (12 Oct 2012 17:55:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Oct 2012 17:55:22 +0000 (UTC) Cc: 12610@debbugs.gnu.org, Le Wang To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 12 19:55:29 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TMjSH-0005ED-Ju for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Oct 2012 19:55:25 +0200 Original-Received: from localhost ([::1]:37127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMjSB-0003JU-48 for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Oct 2012 13:55:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMjS4-0003J9-K1 for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 13:55:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMjS3-0004CE-Df for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 13:55:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMjS3-0004Bz-An for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 13:55:11 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TMjSr-00040t-Vd for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 13:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Oct 2012 17:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12610 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12610-submit@debbugs.gnu.org id=B12610.135006454315402 (code B ref 12610); Fri, 12 Oct 2012 17:56:01 +0000 Original-Received: (at 12610) by debbugs.gnu.org; 12 Oct 2012 17:55:43 +0000 Original-Received: from localhost ([127.0.0.1]:41318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMjSY-00040M-HL for submit@debbugs.gnu.org; Fri, 12 Oct 2012 13:55:43 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:50526 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMjSW-00040F-Al for 12610@debbugs.gnu.org; Fri, 12 Oct 2012 13:55:41 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TMjRf-0004Tx-8A; Fri, 12 Oct 2012 13:54:47 -0400 X-Spook: satellite imagery CIDA chameleon man rs9512c BROMURE X-Ran: dSOk3ig0|o)Qf"ny6Iz8IG%*fw@*r9`6`]tivOh}T@?{UtI.jfa}bT({HQeycRx7LDNfo] X-Hue: blue X-Attribution: GM In-Reply-To: (Stefan Monnier's message of "Fri, 12 Oct 2012 09:35:09 -0400") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65534 Archived-At: Stefan Monnier wrote: > Instead, we should expose the code as code rather than hide it as > data, so that macro-expansion can take place without calling it > explicitly and so the byte-compiler gets to see the code, optimize it > and emit warnings where needed. Sounds right. > I.e. I think the patch should start more along the lines of the one > below (100% guaranteed untested). It causes warnings like: In toplevel form: uniquify.el:479:13:Warning: assignment to free variable `ad-return-value' uniquify.el:487:41:Warning: reference to free variable `ad-return-value' In end of data: uniquify.el:511:1:Warning: the function `ad-get-arg' is not known to be defined. More importantly, it doesn't work... emacs -Q -l uniquify -> byte-code: Symbol's function definition is void: ad-make-advice Compiling the initial example from this report gives: (byte-code "" [ad-add-advice kill-buffer ad-make-advice show-diff-rephrase-question nil t advice #[nil "" [#:--cl-var-- ad-do-it read-char-choice "(s/k/q)? " append "sSKkQq" nil memql (115 83) (107 75) (113 81)] 5 "Prompt when a buffer is about to be killed."] around ad-activate] 8)