Subject: bug#19371: 25.0.50; doc of functions and macros defined in macroexp.el

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 02 Aug 2019 23:10:43 +0200

Drew Adams <[email-masked]> writes:

> 1. `macroexp-let2' is used plenty in the Lisp sources now.  And its
> documentation is in complete/rudimentary.  Please fix this.

Looks like Paul added extensive documentation to this macro i 2015.

> 2. And then there is `macroexp-let2*', whose doc string says only to
> bind each binding (bind a binding?!) "as `macrolet2' does".  That
> means nothing.  Presumably, based on the `*' in the name, the behavior
> is similar to that of `let*'.  If so, you can use the doc of `let*
> as inspiration.

Uhm...  I have no idea what it does:

(defmacro macroexp-let2* (test bindings &rest body)
  "Bind each binding in BINDINGS as `macroexp-let2' does."
  (declare (indent 2) (debug (sexp (&rest (sexp form)) body)))
  (pcase-exhaustive bindings
    ('nil (macroexp-progn body))
    (`((,var ,exp) . ,tl)
     `(macroexp-let2 ,test ,var ,exp
        (macroexp-let2* ,test ,tl ,@body)))))

Perhaps somebody could use their decoder ring.

> 3. The doc strings of `macroexp-let*', `macroexp-progn', and others
> say that the function returns "an expression equivalent to" some
> expression.  They should say what they mean by equivalence, here.
> If you mean that they use `macroexp-quote' to create the
> "equivalent" expression then say so.

No, the meaning here seems to be that they are semantically equivalent.
I changed the doc string of macroexp-progn to 

  "Return EXPS with `progn' prepended.
If EXPS is a single expression, `progn' is not prepended."

but I think the rest are OK.

> The doc string of `macroexp-let*' needs to use BINDINGS and EXP, not
> the same in lowercase, in the equivalent expression.

I've now fixed this.

> Similarly, the doc string of `macroexp-if' needs to use uppercase
> TEST, THEN, and ELSE.

Somebody else has fixed that in the intervening years.

> 4. The doc string of `macroexp--accumulate' refers to parameters
> that do not exist: VAR and LIST.  It should say explicitly (and
> not just via `(fn ...)') that the first parameter is a list of
> the form `(VAR LIST)'.  (And no, it does not matter that this
> macro is internal.)

This has been fixed, too.

> 5. The doc string of `macroexp--cons' is incomprehensible.

I've now fixed it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no