emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r108650: Fix return value of `defun'


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108650: Fix return value of `defun' and un-define it.
Date: Mon, 18 Jun 2012 11:57:41 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108650
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11686
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-06-18 11:57:41 -0400
message:
  Fix return value of `defun' and un-define it.
  * src/data.c (Fdefalias): Return `symbol'.
  * doc/lispref/functions.texi (Defining Functions):
  * doc/lispref/macros.texi (Defining Macros): Un-define the return value of
  `defun', `defmacro' and `defalias'.
modified:
  doc/lispref/ChangeLog
  doc/lispref/functions.texi
  doc/lispref/macros.texi
  etc/NEWS
  lisp/emacs-lisp/byte-run.el
  src/ChangeLog
  src/data.c
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2012-06-17 05:13:40 +0000
+++ b/doc/lispref/ChangeLog     2012-06-18 15:57:41 +0000
@@ -1,3 +1,9 @@
+2012-06-18  Stefan Monnier  <address@hidden>
+
+       * functions.texi (Defining Functions):
+       * macros.texi (Defining Macros): Un-define the return value of `defun',
+       `defmacro' and `defalias'.
+
 2012-06-17  Chong Yidong  <address@hidden>
 
        * elisp.texi: Remove urlcolor setting.

=== modified file 'doc/lispref/functions.texi'
--- a/doc/lispref/functions.texi        2012-06-17 05:13:40 +0000
+++ b/doc/lispref/functions.texi        2012-06-18 15:57:41 +0000
@@ -530,8 +530,7 @@
 @end example
 
 @code{defun} stores this lambda expression in the function cell of
address@hidden  It returns the value @var{name}, but usually we ignore this
-value.
address@hidden  Its return value is @emph{undefined}.
 
 As described previously, @var{argument-list} is a list of argument
 names and may include the keywords @code{&optional} and @code{&rest}.
@@ -543,9 +542,6 @@
 @example
 @group
 (defun foo () 5)
-     @result{} foo
address@hidden group
address@hidden
 (foo)
      @result{} 5
 @end group
@@ -553,9 +549,6 @@
 @group
 (defun bar (a &optional b &rest c)
     (list a b c))
-     @result{} bar
address@hidden group
address@hidden
 (bar 1 2 3 4 5)
      @result{} (1 2 (3 4 5))
 @end group
@@ -576,7 +569,6 @@
   (forward-word 1)
   (backward-char 1)
   (capitalize-word 1))
-     @result{} capitalize-backwards
 @end group
 @end example
 
@@ -593,7 +585,7 @@
 @anchor{Definition of defalias}
 This special form defines the symbol @var{name} as a function, with
 definition @var{definition} (which can be any valid Lisp function).
-It returns @var{definition}.
+Its return value is @emph{undefined}.
 
 If @var{docstring} is address@hidden, it becomes the function
 documentation of @var{name}.  Otherwise, any documentation provided by
@@ -1015,9 +1007,6 @@
 @example
 @group
 (defun bar (n) (+ n 2))
-     @result{} bar
address@hidden group
address@hidden
 (symbol-function 'bar)
      @result{} (lambda (n) (+ n 2))
 @end group
@@ -1063,9 +1052,6 @@
 @example
 @group
 (defun foo (x) x)
-     @result{} foo
address@hidden group
address@hidden
 (foo 1)
      @result{}1
 @end group

=== modified file 'doc/lispref/macros.texi'
--- a/doc/lispref/macros.texi   2012-06-17 05:13:40 +0000
+++ b/doc/lispref/macros.texi   2012-06-18 15:57:41 +0000
@@ -113,7 +113,6 @@
 @group
 (defmacro inc (var)
     (list 'setq var (list '1+ var)))
-     @result{} inc
 @end group
 
 @group
@@ -124,7 +123,6 @@
 @group
 (defmacro inc2 (var1 var2)
     (list 'progn (list 'inc var1) (list 'inc var2)))
-     @result{} inc2
 @end group
 
 @group
@@ -207,9 +205,8 @@
 @end example
 
 (Note that the @sc{cdr} of this list is a function---a lambda expression.)
-This macro object is stored in the function cell of @var{name}.  The
-value returned by evaluating the @code{defmacro} form is @var{name}, but
-usually we ignore this value.
+This macro object is stored in the function cell of @var{name}.  Its return
+value is @emph{undefined}.
 
 The shape and meaning of @var{argument-list} is the same as in a
 function, and the keywords @code{&rest} and @code{&optional} may be used
@@ -342,7 +339,6 @@
               (cons (list '<= var final)
                     (append body (list (list 'inc var)))))))
 @end group
address@hidden for
 
 @group
 (for i from 1 to 3 do
@@ -512,7 +508,6 @@
 @group
 (defmacro foo (a)
   (list 'setq (eval a) t))
-     @result{} foo
 @end group
 @group
 (setq x 'b)

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-06-17 08:53:31 +0000
+++ b/etc/NEWS  2012-06-18 15:57:41 +0000
@@ -429,6 +429,8 @@
 
 * 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'.
 

=== modified file 'lisp/emacs-lisp/byte-run.el'
--- a/lisp/emacs-lisp/byte-run.el       2012-06-09 02:26:47 +0000
+++ b/lisp/emacs-lisp/byte-run.el       2012-06-18 15:57:41 +0000
@@ -123,7 +123,8 @@
 and the result should be a form to be evaluated instead of the original.
 DECL is a declaration, optional, of the form (declare DECLS...) where
 DECLS is a list of elements of the form (PROP . VALUES).  These are
-interpreted according to `macro-declarations-alist'."
+interpreted according to `macro-declarations-alist'.
+The return value is undefined."
        (if (stringp docstring) nil
          (if decl (setq body (cons decl body)))
          (setq decl docstring)
@@ -158,6 +159,7 @@
 DECL is a declaration, optional, of the form (declare DECLS...) where
 DECLS is a list of elements of the form (PROP . VALUES).  These are
 interpreted according to `defun-declarations-alist'.
+The return value is undefined.
 
 \(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)"
   ;; We can't just have `decl' as an &optional argument, because we need

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-18 07:20:19 +0000
+++ b/src/ChangeLog     2012-06-18 15:57:41 +0000
@@ -1,8 +1,12 @@
+2012-06-18  Stefan Monnier  <address@hidden>
+
+       * data.c (Fdefalias): Return `symbol' (bug#11686).
+
 2012-06-18  Martin Rudalics  <address@hidden>
 
        * buffer.c (Fkill_buffer): Don't throw an error when the buffer
-       gets killed during executing of this function (Bug#11665).  Try
-       to always return Qt when the buffer has been actually killed.
+       gets killed during executing of this function (Bug#11665).
+       Try to always return Qt when the buffer has been actually killed.
        (Vkill_buffer_query_functions): In doc-string say that functions
        run by this hook should not change the current buffer.
 
@@ -56,8 +60,8 @@
        (x_draw_glyph_string): Use them.
        * xfaces.c (Qline, Qwave): New Lisp objects.
        (check_lface_attrs, merge_face_ref)
-       (Finternal_set_lisp_face_attribute, realize_x_face): Handle
-       wave-style underline face attributes.
+       (Finternal_set_lisp_face_attribute, realize_x_face):
+       Handle wave-style underline face attributes.
        * xterm.c (x_draw_underwave): New function.
        (x_draw_glyph_string): Use it.
 
@@ -130,8 +134,8 @@
 
 2012-06-16  Eli Zaretskii  <address@hidden>
 
-       * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.  If
-       all the glyphs of the glyph row came from strings, and we have no
+       * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.
+       If all the glyphs of the glyph row came from strings, and we have no
        cursor positioning clues, put the cursor on the first glyph of the
        row.
        (handle_face_prop): Use chunk-relative overlay string index when
@@ -164,8 +168,8 @@
        Simplify under the assumption that USE_2_TAGS_FOR_INTS is defined.
        (INTTYPEBITS): New macro, for clarity.
        (INTMASK, MOST_POSITIVE_FIXNUM): Use it.
-       (LISP_INT1_TAG, LISP_STRING_TAG, LISP_INT_TAG_P): Simplify
-       now that USE_LSB_TAG is always defined.
+       (LISP_INT1_TAG, LISP_STRING_TAG, LISP_INT_TAG_P):
+       Simplify now that USE_LSB_TAG is always defined.
        (TYPEMASK, XINT) [USE_LSB_TAG]: Remove unnecessary cast.
        (make_number) [!USE_LSB_TAG]: Use INTMASK; that's simpler.
 
@@ -183,11 +187,11 @@
        * lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
        instead of union.
        (XLI, XIL): Define.
-       (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use
-       them.
-       * emacs.c (gdb_use_struct): Renamed from gdb_use_union.
+       (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG):
+       Use them.
+       * emacs.c (gdb_use_struct): Rename from gdb_use_union.
        * .gdbinit: Check gdb_use_struct instead of gdb_use_union.
-       * alloc.c (widen_to_Lisp_Object): Removed.
+       * alloc.c (widen_to_Lisp_Object): Remove.
        (mark_memory): Use XIL instead of widen_to_Lisp_Object.
        * frame.c (delete_frame): Remove outdated comment.
        * w32fns.c (Fw32_register_hot_key): Use XLI instead of checking

=== modified file 'src/data.c'
--- a/src/data.c        2012-06-13 00:26:40 +0000
+++ b/src/data.c        2012-06-18 15:57:41 +0000
@@ -637,8 +637,9 @@
     Fput (symbol, Qautoload, XCDR (function));
 
   XSYMBOL (symbol)->function = definition;
-  /* Handle automatic advice activation */
-  if (CONSP (XSYMBOL (symbol)->plist) && !NILP (Fget (symbol, 
Qad_advice_info)))
+  /* Handle automatic advice activation.  */
+  if (CONSP (XSYMBOL (symbol)->plist)
+      && !NILP (Fget (symbol, Qad_advice_info)))
     {
       call2 (Qad_activate_internal, symbol, Qnil);
       definition = XSYMBOL (symbol)->function;
@@ -647,11 +648,12 @@
 }
 
 DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
-       doc: /* Set SYMBOL's function definition to DEFINITION, and return 
DEFINITION.
+       doc: /* Set SYMBOL's function definition to DEFINITION.
 Associates the function with the current load file, if any.
 The optional third argument DOCSTRING specifies the documentation string
 for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string
-determined by DEFINITION.  */)
+determined by DEFINITION.
+The return value is undefined.  */)
   (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
@@ -666,7 +668,10 @@
   LOADHIST_ATTACH (Fcons (Qdefun, symbol));
   if (!NILP (docstring))
     Fput (symbol, Qfunction_documentation, docstring);
-  return definition;
+  /* We used to return `definition', but now that `defun' and `defmacro' expand
+     to a call to `defalias', we return `symbol' for backward compatibility
+     (bug#11686).  */
+  return symbol;
 }
 
 DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,


reply via email to

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