Subject: bug#11686: 24.1.50; defun should return name

From: Lawrence Mitchell <[email-masked]>
Date: Fri, 22 Jun 2012 14:38:30 +0100

Stefan Monnier wrote:
>>> Maybe a simpler way is to change defalias to return the name rather than
>>> the value.
>> But defalias says:
>> | (defalias SYMBOL DEFINITION &optional DOCSTRING)
>> | Set SYMBOL's function definition to DEFINITION, and return DEFINITION.
>> So you'll probably then get a bug report about that instead.

> We'll see, I just installed a patch that does that.

I think the following (NEWS) patch should be applied on top.
This is an incompatible change to defalias.  So it should go in
the appropriate part of NEWS.  Additionally, we should mention
defmacro and defun.

diff --git a/etc/NEWS b/etc/NEWS
index 3cd4d21..65f4269 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -418,6 +418,12 @@ Only variables defined using `defcustom' are considered user options.
 The function `user-variable-p' is now an obsolete alias for
 `custom-variable-p'.
 
++++
+** The return values of `defalias', `defun' and `defmacro' have changed,
+and are now undefined.  For backwards compatibility, defun and
+defmacro currently return the name of the newly defined function/macro
+but this should not be relied upon.
+
 ** `face-spec-set' no longer sets frame-specific attributes when the
 third argument is a frame (that usage was obsolete since Emacs 22.2).
 
@@ -434,8 +440,6 @@ still be supported for Emacs 24.x.
 
 * Lisp changes in Emacs 24.2
 
-** The return value of `defalias' has changed and is now undefined.
-
 ** `defun' also accepts a (declare DECLS) form, like `defmacro'.
 The interpretation of the DECLS is determined by `defun-declarations-alist'.

-- 
Lawrence Mitchell <[email-masked]>