Subject: bug#58025: [PATCH] Ensure `byte-compile-dest-file-function' is used

From: Richard Hopkins <[email-masked]>
Date: Fri, 23 Sep 2022 19:11:18 +0100

On 2022-09-23 16:15, Zack Weinberg wrote:
> 
> Thank you for the patch.  Are you able to test it with a version of
> GNU Emacs older than 23.2?  I see that you tested it with XEmacs 21,
> but as I recall there were quite substantial differences between
> XEmacs 21 and GNU Emacs of similar vintage.

Not yet, I'm trying to obtain access but don't know if I can.

> 
> In addition, if you are able to do the archaeology to report *when
> bytecomp.el was added to Emacs*, i.e. how far back you have to go
> before `emacs -l bytecomp` will fail, that would be helpful.  I'm
> betting it's well before the oldest version we care about, given that
> bytecomp.el (in 27.1) lists its oldest copyright year as 1985 and
> <[email-masked]> as the original author, but I'd still like to know for
> sure.
> 

The Emacs git repository doesn't have tags for all releases, but these
two are the most relevant for now: 18.59 (1992-10-30) and 19.34 
(1996-08-21).

The ability to load bytecomp.el and use `batch-byte-compile' has been
present since at least 18.59 with (lisp/bytecomp.el), and still
available in 19.34 via lisp/emacs-lisp/bytecomp.el.  It should have
been present in earlier versions too as it's in NEWS.1-17.

However, it looks like only 19.34 onwards supports
`byte-compile-dest-file' which automake falls back to for the output
.elc; 18.59 just appends a "c" to the source file (see
`byte-recompile-directory'). The newer and preferred
`byte-compile-dest-file-function' came in 23.2 (2010-05-08).

So it looks like this patch is ok to load bytecomp, as that is where
both `batch-byte-compile' and `byte-compile-dest-file' comes from in
early GNU Emacs and XEmacs, along with
`byte-compile-dest-file-function' for later GNU Emacs.

Any thoughts?