Subject: bug#67455: (Record source position, etc., in doc strings, and use this in *Help* and backtraces.)

From: Alan Mackenzie <[email-masked]>
Date: Tue, 19 Mar 2024 16:18:43 +0000

Hello Stefan.

On Wed, Mar 13, 2024 at 07:52:50 -0400, Stefan Monnier wrote:
> > OK, so it seems like I'll need a new pcase arm in macroexp--expand-all,
> > and this new code will need to handle (function (cons 'lambda ...)), and
> > the like.

> If macroexp--expand-all receives code of the form

>     (function (cons 'lambda ...))

> it means it received broken code.
> IOW, such an arm will never do anything useful (the best it can do is
> emit a warning).

> I suspect what you're looking for is yet different.

How about the following (as yet vague) idea?
(i) Amend backquote slightly so that the integer part of the result of
backquote-process gets transmitted to the caller, somehow.  This would
let macroexp--expand-all know it's dealing with smething awkward like
`#'(lambda ,@args . ,body).
(ii) On encountering such, m--e-all would insert a call to (new macro)
macroexp--maybe-posify-lamda-form at ME1 time.
(iii) At ME2 time, m--e-all should be able to tell whether or not the
lambda form is "real".  In this case the macro would be replaced by a
call to (existing) byte-run--posify-lambda-position.  Whether or not this
is done, the SWP lambda would be stripped of its position.

This might work.  What do you think?

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany)