emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs 23.3 released


From: Stefan Monnier
Subject: Re: Emacs 23.3 released
Date: Thu, 10 Mar 2011 23:20:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> A quick try to lexbind give me this error on startup:

> --8<---------------cut here---------------start------------->8---
> Debugger entered--Lisp error: (wrong-type-argument listp 0)
>   ad-parse-arglist(0)

Does the patch below fix it for you?


        Stefan


=== modified file 'lisp/emacs-lisp/advice.el'
--- lisp/emacs-lisp/advice.el   2011-01-28 21:42:11 +0000
+++ lisp/emacs-lisp/advice.el   2011-03-11 04:16:59 +0000
@@ -2535,17 +2535,11 @@
   "Return the argument list of DEFINITION.
 If DEFINITION could be from a subr then its NAME should be
 supplied to make subr arglist lookup more efficient."
-  (cond ((ad-compiled-p definition)
-        (aref (ad-compiled-code definition) 0))
-       ((consp definition)
-        (car (cdr (ad-lambda-expression definition))))
-       ((ad-subr-p definition)
-        (if name
-            (ad-subr-arglist name)
-          ;; otherwise get it from its printed representation:
-          (setq name (format "%s" definition))
-          (string-match "^#<subr \\([^>]+\\)>$" name)
-          (ad-subr-arglist (intern (match-string 1 name)))))))
+  (require 'help-fns)
+  (cond
+   ((or (ad-macro-p definition) (ad-advice-p))
+    (help-function-arglist (cdr definition)))
+   (t (help-function-arglist definition))))
 
 ;; Store subr-args as `((arg1 arg2 ...))' so I can distinguish
 ;; a defined empty arglist `(nil)' from an undefined arglist:

=== modified file 'lisp/help-fns.el'
--- lisp/help-fns.el    2011-03-06 21:22:16 +0000
+++ lisp/help-fns.el    2011-03-11 04:15:05 +0000
@@ -124,6 +124,21 @@
       (nreverse arglist)))
    ((byte-code-function-p def) (aref def 0))
    ((eq (car-safe def) 'lambda) (nth 1 def))
+   ((subrp def)
+    (let ((arity (subr-arity def))
+          (arglist ()))
+      (dotimes (i (car arity))
+        (push (intern (concat "arg" (number-to-string (1+ i)))) arglist))
+      (if (not (numberp (cdr arglist)))
+          (progn
+            (push '&rest arglist)
+            (push 'rest arglist))
+        (push '&optional arglist)
+        (dotimes (i (- (cdr arity) (car arity)))
+          (push (intern (concat "arg" (number-to-string
+                                       (1+ i (car arity)))))
+                arglist)))
+      (nreverse arglist)))
    ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap)))
     "[Arg list not available until function definition is loaded.]")
    (t t)))



reply via email to

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