[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8457: 24.0.50; defadvice with BODY referencing args by name: void-va

From: Drew Adams
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

(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 (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]