[Top][All Lists]

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

Re: Simple defadvice's stopped working (commit daa84a03, Thu Nov 8 23:10

From: Katsumi Yamaoka
Subject: Re: Simple defadvice's stopped working (commit daa84a03, Thu Nov 8 23:10:16 2012 -0500)
Date: Thu, 15 Nov 2012 11:08:44 +0900
User-agent: Gnus/5.130006 (真 Gnus v0.6) Emacs/24.3.50 (i686-pc-cygwin)

Juanma Barranquero wrote:
> On Wed, Nov 14, 2012 at 12:18 AM, Katsumi Yamaoka <address@hidden> wrote:

>> In the latter case I got the following error:
>> Debugger entered--Lisp error: (wrong-type-argument listp t)
>>   ad-parse-arglist(t)
>>   ad-map-arglists(t t)
>>   ad-make-advised-definition(gnus-article-prepare-display)
>>   ad-activate-advised-definition(gnus-article-prepare-display nil)
>>   ad-activate(gnus-article-prepare-display nil)
>>   (progn (ad-add-advice (quote gnus-article-prepare-display)...

> I'm getting this one in advices for functions that aren't yet loaded,
> when the advice uses "activate". Easy to see here:

> emacs -Q
> (defadvice ada-mode (before my-ada activate) t)  <C-x C-e>

> Which is perhaps a mistake, but it was previously silently ignored.

I'm not quite sure it is in a good manner but the patch for
advice.el in the attached diff makes it work in such cases.
The other, that is for nadvice.el, is for an advice of which
the interactive spec is a string, like this example described in

(defadvice find-file (before existing-files-only activate)
  "Find existing files only"
  (interactive "fFind file: "))

With these changes, so far I can play with Emacs as before.

--- advice.el~  2012-11-13 22:00:19.237409000 +0000
+++ advice.el   2012-11-15 01:42:13.391473100 +0000
@@ -2599,3 +2599,3 @@
             ;; Construct the individual pieces that we need for assembly:
-            (orig-arglist (ad-arglist origdef))
+            (orig-arglist (and origdef (ad-arglist origdef)))
             (advised-arglist (or (ad-advised-arglist function)
--- nadvice.el~ 2012-11-14 21:52:40.096113000 +0000
+++ nadvice.el  2012-11-15 01:42:13.391473100 +0000
@@ -131,3 +131,3 @@
   (let ((fspec (cadr (interactive-form function))))
-    (when (eq 'function (car fspec)) ;; Macroexpanded lambda?
+    (when (eq 'function (car-safe fspec)) ;; Macroexpanded lambda?
       (setq fspec (nth 1 fspec)))

reply via email to

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