all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: 8457@debbugs.gnu.org
Subject: bug#8457: 24.0.50; defadvice with BODY referencing args by name: void-var error
Date: Sat, 9 Apr 2011 09:45:13 -0700	[thread overview]
Message-ID: <21C5BDEF1EBA475C86898667CFA8E409@us.oracle.com> (raw)

(elisp) `Argument Access in Advice' says that you should be able to
access the args using the original names:
 
"The simplest way to access the arguments of an advised function in the
body of a piece of advice is to use the same names that the function
definition uses.  To do this, you need to know the names of the argument
variables of the original function."
 
This should work, and it works prior to the move to lexbind(?), at least.  I
have this defadvice:
 
(defadvice narrow-to-region (before push-wide-n-restrictions activate)
  "Push the region limits to `wide-n-restrictions'.
You can use `C-x n x' to widen to a previous buffer restriction."
  (when (or (interactive-p) wide-n-push-anyway-p)
    (wide-n-push start end)))
 
START and END are the original arg names.  Yes, the doc also says that
this method of referring to args is not the most robust.  Still, it has
worked in general but no longer does.  This is the error:
 
Debugger entered--Lisp error: (void-variable start)
  (wide-n-push start end)
  (progn (wide-n-push start end))
  (if (or (interactive-p) wide-n-push-anyway-p) (progn (wide-n-push start end)))
  (when (or (interactive-p) wide-n-push-anyway-p) (wide-n-push start end))
  (let (ad-return-value) (when (or (interactive-p) wide-n-push-anyway-p)
(wide-n-push start end)) (setq ad-return-value (apply (quote
ad-Orig-narrow-to-region) arg1 arg2 rest)) ad-return-value)
  narrow-to-region(8268 9972)
  call-interactively(narrow-to-region nil nil)
 
Just a guess: this has to do with the move to lexbind.
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-04-04 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
-Ic:/imagesupport/include'
 






             reply	other threads:[~2011-04-09 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 16:45 Drew Adams [this message]
2011-04-10  4:46 ` bug#8457: 24.0.50; defadvice with BODY referencing args by name: void-var error Stefan Monnier
2011-04-13 17:57   ` Stefan Monnier

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=21C5BDEF1EBA475C86898667CFA8E409@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=8457@debbugs.gnu.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.