From: Lawrence Mitchell <wence@gmx.li>
To: 11686@debbugs.gnu.org
Subject: bug#11686: 24.1.50; defun should return name
Date: Wed, 13 Jun 2012 10:13:10 +0100 [thread overview]
Message-ID: <87mx47h8wp.fsf@gmx.li> (raw)
In-Reply-To: <87ipewb637.fsf@gnu.org>
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)))))
(declarations
(mapcar
#'(lambda (x)
@@ -190,11 +192,13 @@ interpreted according to `defun-declarations-alist'.
(t (message "Warning: Unknown defun property %S in %S"
(car x) name)))))
decls))
- (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))
def))))
next prev parent reply other threads:[~2012-06-13 9:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 20:58 bug#11686: 24.1.50; defun should return name Johan Bockgård
2012-06-13 9:13 ` Lawrence Mitchell [this message]
2012-06-13 12:27 ` Stefan Monnier
2012-06-13 14:34 ` Lawrence Mitchell
2012-06-18 15:58 ` Stefan Monnier
2012-06-22 13:38 ` Lawrence Mitchell
2012-06-24 17:08 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mx47h8wp.fsf@gmx.li \
--to=wence@gmx.li \
--cc=11686@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).