[Top][All Lists]

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

bug#11686: 24.1.50; defun should return name

From: Lawrence Mitchell
Subject: bug#11686: 24.1.50; defun should return name
Date: Wed, 13 Jun 2012 10:13:10 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

Johan Bockgård wrote:
> With current trunk,

>    (defun NAME ()) => (lambda nil nil)

>    expected        => NAME

> Ditto for defmacro.

Here's a patch, think this is right:

Return NAME, not definition from defun and defmacro

* lisp/emacs-lisp/byte-run.el (defun, defmacro): Return newly created
definition's name, not its definition.

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 635eef9..fb86b2a 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -135,9 +135,11 @@ interpreted according to `macro-declarations-alist'."
        (if docstring (setq body (cons docstring body)))
        ;; Can't use backquote because it's not defined yet!
        (let* ((fun (list 'function (cons 'lambda (cons arglist body))))
-              (def (list 'defalias
-                         (list 'quote name)
-                         (list 'cons ''macro fun)))
+              (def (cons 'prog1
+                         (list (list 'quote name)
+                               (list 'defalias
+                                     (list 'quote name)
+                                     (list 'cons ''macro fun)))))
                 #'(lambda (x)
@@ -190,11 +192,13 @@ interpreted according to `defun-declarations-alist'.
                    (t (message "Warning: Unknown defun property %S in %S"
                                (car x) name)))))
-          (def (list 'defalias
-                     (list 'quote name)
-                     (list 'function
-                           (cons 'lambda
-                                 (cons arglist body))))))
+          (def (cons 'prog1
+                     (list (list 'quote name)
+                           (list 'defalias
+                                 (list 'quote name)
+                                 (list 'function
+                                       (cons 'lambda
+                                             (cons arglist body))))))))
       (if declarations
           (cons 'prog1 (cons def declarations))

reply via email to

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